Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBDF9C

IBDF9C.m

Go to the documentation of this file.
IBDF9C ;ALB/CJM - ENCOUNTER FORM - (edit header block) ;FEB 1,1993
 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
 ;
EDITHDR ;edit the header block
 N HDRBLK,HDRFLD,TOP1,BOT1,TOP2,BOT2,HDRLINES,MAXLEN,QUIT,NEWBLOCK
 S VALMBCK="R",(TOP1,TOP2,BOT1,BOT2,QUIT,NEWBLOCK)=0
 D FULL^VALM1
 S HDRBLK=$$FINDBLK I 'HDRBLK S HDRBLK=$$MAKEBLK I 'HDRBLK Q
 D TOPNBOT^IBDFU5(HDRBLK,.TOP1,.BOT1)
 S HDRFLD=$$FINDFLD I 'HDRFLD S HDRFLD=$$MAKEFLD I 'HDRFLD Q
 D EDITFLD
 D:'QUIT EDITBLK,MOVEFLD
 I HDRBLK D TOPNBOT^IBDFU5(HDRBLK,.TOP2,.BOT2),UNCMPBLK^IBDF19(HDRBLK)
 D IDXFORM^IBDF5A($S(TOP1<TOP2:TOP1,1:TOP2),$S(BOT1>BOT2:BOT1,1:BOT2))
 S VALMBCK="R"
 Q
FINDBLK() ;
 S HDRBLK="" F  S HDRBLK=$O(^IBE(357.1,"C",IBFORM,HDRBLK)) Q:'HDRBLK  Q:$P($G(^IBE(357.1,HDRBLK,0)),"^")="HEADER"
 Q HDRBLK
MAKEBLK() ;
 S NEWBLOCK=1
 K DIC,DD,DO,DINUM S DIC="^IBE(357.1,",X="HEADER",DIC(0)="",DIC("DR")=".02////"_IBFORM
 D FILE^DICN K DIC,DIE
 Q $S(+Y<0:"",1:+Y)
FINDFLD() ;
 S HDRFLD="" F  S HDRFLD=$O(^IBE(357.5,"C",HDRBLK,HDRFLD)) Q:'HDRFLD  Q:$P($G(^IBE(357.5,HDRFLD,0)),"^")="HEADER"
 Q HDRFLD
MAKEFLD() ;
 K DIC,DD,DO,DINUM S DIC="^IBE(357.5,",X="HEADER",DIC(0)="",DIC("DR")=".02////"_HDRBLK
 D FILE^DICN K DIC,DIE
 Q $S(+Y<0:"",1:+Y)
EDITFLD ;allows the user to edit the header lines
 N NODE,SUBFLD
 K DIE,DA S DIE=357.5,DA=HDRFLD,DR="[IBDF EDIT FORM HEADER]",DIE("NO^")="BACKOUTOK" D ^DIE K DIE,DR,DA
 ;find the number of lines and the maximum length
 S (HDRLINES,MAXLEN)=0
 S SUBFLD=0 F  S SUBFLD=$O(^IBE(357.5,HDRFLD,2,SUBFLD)) Q:'SUBFLD  S NODE=$G(^(SUBFLD,0)) I NODE'="" S HDRLINES=HDRLINES+1 S MAXLEN=$S(MAXLEN>$L($P(NODE,"^",1)):MAXLEN,1:$L($P(NODE,"^",1)))
 I 'MAXLEN D DLTBLK^IBDFU3(HDRBLK,IBFORM,357.1) S QUIT=1,HDRBLK=""
 Q
EDITBLK ;allows the user to position the header block & draw a box around it
 N IBBOX,IBDELETE
 S IBBOX=0,IBDELETE=1
 D RE^VALM4
 K DIE,DA S DIE=357.1,DA=HDRBLK,DR="[IBDF EDIT HEADER BLOCK]",DIE("NO^")="BACKOUTOK" D ^DIE K DIE,DR,DA
 I IBDELETE,NEWBLOCK D DLTBLK^IBDFU3(HDRBLK,IBFORM,357.1)
 Q
DFLTCOL() ;finds the column that would center the header block
 Q ((IBFORM("WIDTH")-(+$G(MAXLEN)+(+$G(IBBOX))))\2)+1
MOVEFLD ;centers each header line in the block
 N START,SUBFLD,HDR,LINES
 S LINES=0
 S START=$S($P($G(^IBE(357.1,HDRBLK,0)),"^",10)=1:1,1:0)
 S SUBFLD=0
 F  S SUBFLD=$O(^IBE(357.5,HDRFLD,2,SUBFLD)) Q:'SUBFLD  S NODE=$G(^IBE(357.5,HDRFLD,2,SUBFLD,0)),HDR=$P(NODE,"^",1) D
 .I HDR'="" S $P(NODE,"^",4)=((MAXLEN-$L(HDR))\2)+START,$P(NODE,"^",5)=LINES+START,LINES=LINES+1 S ^IBE(357.5,HDRFLD,2,SUBFLD,0)=NODE
 Q