IBDFBKS ;ALB/CJM/AAS - ENCOUNTER FORM - create form spec for scanning (Broker Version) ; 6-JUN-95 [ 11/13/96 3:34 PM ]
;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
;
SCAN(IBFORMID) ;
;
Q:'$G(IBFORMID)
N IBLC,PERPAGE,PAGE,ROW,COL,PAGESIZE,SCAN,ARY,X,Y,ROWHT,ROWWIDTH,CONVERT,COUNT,LINE,TAG,NAME,XOFFSET,YOFFSET,NODE,FID,TYPE,XBUBOS,YBUBOS,COUNT,YHANDOS,FIELD,IEN,QLFR,PRIORPAG,END,LN,FIELDS,IBDFILL,IBDBKGND
;XOFFSET,YOFFSET are the page margins (in decipoints)
;XBUBOS,YBUBOS are the offsets within the col,row of the bubbles
;YHANDOS is the offset for a handprint field within the row
;
I $D(^IBD(359.2,IBFORMID,0)),$D(^IBD(357.95,IBFORMID,0)) S DIK="^IBD(359.2,",DA=IBFORMID D ^DIK
I '$D(DT) D DT^DICRW
S IBLC=0
D PARAM
S CONVERT=.352778 ;for converting PCL decipoints to .1mm
; This number is actually 254/720 ... 254 PK points (.1 mm) = 1 inch
; 720 PCL5 decipoints = 1 inch
; A PCL5 decipoint = .352778 PK points
S SCAN="^TMP(""IBDF"",$J,""SCAN"",IBFORMID)"
K @SCAN
;
S FIELDS="^TMP(""IBDF"",$J,""FIELDS"")"
K @FIELDS
;
;get form description
S NODE=$G(^IBD(357.95,IBFORMID,0))
Q:NODE=""
S PERPAGE=$P(NODE,"^",10)
;determine sizes and offsets - in terms of PCL decipoints
S XOFFSET=180 ; This is 1/4 inch ... .25*720 PCL decipoints
S YOFFSET=360 ; This is 1/2 inch ... .5*720 PCL decipoints
; rowht = # of PCL decipoints/line in height
; 80 lines (133 Col) = 720/8 lines per inch)
; 72 lines (96 Col) = 720/7.2 lines per inch)
; 60 lines (80 Col) = 720/6 lines per inch)
S ROWHT=$P(NODE,"^",10),ROWHT=$S(ROWHT>72:90,ROWHT>60:100.0005,1:120)
S COLWIDTH=$P(NODE,"^",9)
S XBUBOS=$S(COLWIDTH>96:.5,COLWIDTH>80:.75,1:1) ;leaves offset in terms of fraction of column width - must still convert to decipoints
S YBUBOS=$S(COLWIDTH>96:65,COLWIDTH>80:75,1:85)
; colwidth = # of PCL decipoints/character in width
; 133 Col = 720/16.67 char per inch
; 96 Col = 720/12 char per inch
; 80 Col = 720/10 char per inch
S COLWIDTH=$S(COLWIDTH>96:(720/16.67),COLWIDTH>80:60,1:72) ;converted to decipoints
S XBUBOS=XBUBOS*COLWIDTH ;converted to decipoints
S YHANDOS=$S(ROWHT=90:0,ROWHT=100.0005:15,1:30)
;
;get the list of scannable pages
S IEN=0 F S IEN=$O(^IBD(357.95,IBFORMID,3,IEN)) Q:'IEN S NODE=$G(^IBD(357.95,IBFORMID,3,IEN,0)) S:$P(NODE,"^",2) PAGE(+NODE)=""
;
;
S PAGE=0 F S PAGE=$O(PAGE(PAGE)) Q:'PAGE D
.;
.;list all the bubbles
.S ROW=((PAGE-1)*PERPAGE)-1
.S ARY="^IBD(357.95,""AC"","_IBFORMID_")"
.F S ROW=$O(@ARY@(ROW)) Q:ROW="" D
..Q:(ROW\PERPAGE)+1'=PAGE
..S COL="" F S COL=$O(@ARY@(ROW,COL)) Q:COL="" S IEN=0 F S IEN=$O(@ARY@(ROW,COL,IEN)) Q:'IEN D
...S NODE=$G(^IBD(357.95,IBFORMID,1,IEN,0))
...Q:($P(NODE,"^",6)="")!(($P(NODE,"^",4)="")&($P(NODE,"^",8)=""))!('$P(NODE,"^",3))
...S NAME=$E($P(NODE,"^",5),1,17),QLFR=$P(NODE,"^",10)
...S TYPE=$P(NODE,"^",7)
...I (TYPE=0)!(TYPE=3) S:QLFR QLFR=$P($G(^IBD(357.98,QLFR,0)),"^",3)
...I (TYPE=1)!(TYPE=2) S:QLFR QLFR=$E($P($G(^IBD(357.98,QLFR,0)),"^"),1,12)
...I QLFR'="" S NAME=NAME_"("_QLFR_")"
...I QLFR="" S NAME=NAME_"-"
...S @SCAN@(PAGE,$P(NODE,"^",6),+$P(NODE,"^",7),COL,(ROW-((PAGE-1)*PERPAGE)),IEN)=$P(NODE,"^",3,12)
...S @SCAN@(PAGE,$P(NODE,"^",6))=NAME
...;
.;
.;list all the handprint fields
.S ARY="^IBD(357.95,""AD"","_IBFORMID_")"
.S ROW=((PAGE-1)*PERPAGE)-1
.F S ROW=$O(@ARY@(ROW)) Q:ROW="" D
..Q:(ROW\PERPAGE)+1'=PAGE
..S COL="" F S COL=$O(@ARY@(ROW,COL)) Q:COL="" S IEN=0 F S IEN=$O(@ARY@(ROW,COL,IEN)) Q:'IEN D
...S NODE=$G(^IBD(357.95,IBFORMID,2,IEN,0))
...Q:($P(NODE,"^",8)="")!('$P(NODE,"^",4))!('$P(NODE,"^",15))
...S @SCAN@(PAGE,$P(NODE,"^",8),6,COL,(ROW-((PAGE-1)*PERPAGE)),IEN)=$P(NODE,"^",3,17),NAME=$E($P(NODE,"^",5),1,15)
...I $P(NODE,"^",17) S NAME=NAME_"("_$P($G(^IBE(359.1,$P(NODE,"^",17),0)),"^")_")"
...S @SCAN@(PAGE,$P(NODE,"^",8))=NAME
;
;make form description
F COUNT=1:1 S LINE=$T(FORM+COUNT^IBDFBKS1),TAG=$P(LINE,";;"),LINE=$P(LINE,";;",2) Q:TAG["QUIT" D
.N PG
.D BLDARY("")
.I TAG["NAME" S IBDFSA(IBLC)=IBDFSA(IBLC)_" NAME = ""ENCOUNTER FORM "_IBFORMID_""";" Q
.I TAG["PGCK" S IBDFSA(IBLC)=IBDFSA(IBLC)_" else if (" D Q
..S PG=$O(PAGE(0))
..S IBDFSA(IBLC)=IBDFSA(IBLC)_"(page!="_PG_")"
..F S PG=$O(PAGE(PG)) Q:'PG S IBDFSA(IBLC)=IBDFSA(IBLC)_"&&(page!="_PG_")"
..S IBDFSA(IBLC)=IBDFSA(IBLC)_"){"
.S IBDFSA(IBLC)=IBDFSA(IBLC)_LINE
.;D BLDARY(LINE)
;
;make fields
S PAGE=0,FIELD=9,PRIORPG=$O(@SCAN@(0)),LN=0,BLN=0
F S PAGE=$O(@SCAN@(PAGE)) D:PRIORPG'=PAGE PRINTEND^IBDFBKS3 Q:'PAGE S FID="" F S FID=$O(@SCAN@(PAGE,FID)) Q:FID="" S TYPE=$O(@SCAN@(PAGE,FID,"")) Q:TYPE="" D
.S NAME=$G(@SCAN@(PAGE,FID))
.;
.; -- 1 = EXACTLY ONE, 2 = AT MOST ONE (0 or 1)
.I (TYPE=1)!(TYPE=2) S FIELD=FIELD+1,@FIELDS@(PAGE,FIELD)="" D
..I TYPE=1 S NAME=NAME_" (1 Required)"
..I TYPE=2 S NAME=NAME_" (1 Optional)"
..S NAME=$$NAME(NAME)
..D BUBBLE^IBDFBKS3 Q
.;
.I TYPE=6 D Q
..N OLDNAME S OLDNAME=NAME
..S COL="" F S COL=$O(@SCAN@(PAGE,FID,TYPE,COL)) Q:COL="" S ROW="" F S ROW=$O(@SCAN@(PAGE,FID,TYPE,COL,ROW)) Q:ROW="" S IEN=0 F S IEN=$O(@SCAN@(PAGE,FID,TYPE,COL,ROW,IEN)) Q:'IEN D
...S NAME=$$NAME(OLDNAME)
...;S IBDLAST=0 I $O(@SCAN@(PAGE,FID,TYPE,COL,ROW))="",$O(@SCAN@(PAGE,FID,TYPE,COL))="",$O(@SCAN@(PAGE,FID,TYPE))="" S IBDLAST=1
...S NODE=$G(@SCAN@(PAGE,FID,6,COL,ROW,IEN)) D HANDPRNT^IBDFBKS2(IEN,NAME,PAGE,ROW,COL,$P(NODE,"^",1),$P(NODE,"^",4),$P(NODE,"^",13),$P(NODE,"^",15),$P(NODE,"^",2))
.;
.;0 = ANY NUMBER
.;3 = AT LEAST ONE (1 or more)
.I (TYPE=0)!(TYPE=3) D
..N OLDNAME
..;I TYPE=3 N FIRST,LAST S LAST=FIELD+1,LAST=""
..I TYPE=3 N FIRST,LAST S FIRST=FIELD+1,LAST=""
..S COL="" F S COL=$O(@SCAN@(PAGE,FID,TYPE,COL)) Q:COL="" S ROW="" F S ROW=$O(@SCAN@(PAGE,FID,TYPE,COL,ROW)) Q:ROW="" S IEN=$O(@SCAN@(PAGE,FID,TYPE,COL,ROW,0)) D:IEN
...S FIELD=FIELD+1,@FIELDS@(PAGE,FIELD)="",NODE=$G(@SCAN@(PAGE,FID,TYPE,COL,ROW,IEN))
...S (NAME,OLDNAME)=$G(@SCAN@(PAGE,FID))
...S NAME=$$NAME(NAME)
...I TYPE=3,$O(@SCAN@(PAGE,FID,TYPE,COL,ROW))="",($O(@SCAN@(PAGE,FID,TYPE,COL))="") S LAST=FIELD
...D BUBBLE^IBDFBKS3
;
END ; -- end of routine
K @SCAN
K @FIELDS
K ^TMP("IBDF-NAME",$J)
S ^IBD(359.2,IBFORMID,10,IBLC,0)=IBDFSA(IBLC)
S ^IBD(359.2,IBFORMID,10,0)="^^"_IBLC_"^"_IBLC_"^"_DT_"^"
Q
;
NAME(NAME) ;
; -- make sure name is unique
N X
I (TYPE=0)!(TYPE=3) S NAME=NAME_" "_$P(NODE,"^",6) I TYPE=3
I TYPE=1,NAME'["Required" S NAME=NAME_" Required"
S X=$G(^TMP("IBDF-NAME",$J,NAME))+1
S ^TMP("IBDF-NAME",$J,NAME)=+X
I X>1 S NAME=NAME_" #"_X
Q NAME
;
BLDARY(TEXT) ;
; -- builds the export array IBDFS(linecount) = text
N DIC,DA,DINUM,X,Y,I,J,DLAYGO
I IBLC=1 D
.S DIC="^IBD(359.2,",DIC(0)="L",DLAYGO=359.2,(DINUM,X)=IBFORMID D FILE^DICN
.Q
;
I IBLC>0 D
.S ^IBD(359.2,IBFORMID,10,IBLC,0)=IBDFSA(IBLC)
.K IBDFSA(IBLC)
.Q
;
S IBLC=IBLC+1
S IBDFSA(IBLC)=$G(TEXT)
Q
;
WRITE(IBFORMID) ;
N LINE S LINE=0
S X=0 X ^%ZOSF("RM")
F S LINE=$O(^IBD(359.2,IBFORMID,10,LINE)) Q:'LINE W !,$G(^IBD(359.2,IBFORMID,10,LINE,0))
S X=80 X ^%ZOSF("RM")
Q
;
PARAM ; -- get values from parameter file
; ibdfill := % fill required
; ibdbkgnd := % background expected
S IBDFILL=$P($G(^IBD(357.09,1,0)),"^",8) I IBDFILL="" S IBDFILL=20
S IBDBKGND=$P($G(^IBD(357.09,1,0)),"^",9) I IBDBKGND="" S IBDBKGND=5
Q
IBDFBKS ;ALB/CJM/AAS - ENCOUNTER FORM - create form spec for scanning (Broker Version) ; 6-JUN-95 [ 11/13/96 3:34 PM ]
+1 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
+2 ;
SCAN(IBFORMID) ;
+1 ;
+2 IF '$GET(IBFORMID)
QUIT
+3 NEW IBLC,PERPAGE,PAGE,ROW,COL,PAGESIZE,SCAN,ARY,X,Y,ROWHT,ROWWIDTH,CONVERT,COUNT,LINE,TAG,NAME,XOFFSET,YOFFSET,NODE,FID,TYPE,XBUBOS,YBUBOS,COUNT,YHANDOS,FIELD,IEN,QLFR,PRIORPAG,END,LN,FIELDS,IBDFILL,IBDBKGND
+4 ;XOFFSET,YOFFSET are the page margins (in decipoints)
+5 ;XBUBOS,YBUBOS are the offsets within the col,row of the bubbles
+6 ;YHANDOS is the offset for a handprint field within the row
+7 ;
+8 IF $DATA(^IBD(359.2,IBFORMID,0))
IF $DATA(^IBD(357.95,IBFORMID,0))
SET DIK="^IBD(359.2,"
SET DA=IBFORMID
DO ^DIK
+9 IF '$DATA(DT)
DO DT^DICRW
+10 SET IBLC=0
+11 DO PARAM
+12 ;for converting PCL decipoints to .1mm
SET CONVERT=.352778
+13 ; This number is actually 254/720 ... 254 PK points (.1 mm) = 1 inch
+14 ; 720 PCL5 decipoints = 1 inch
+15 ; A PCL5 decipoint = .352778 PK points
+16 SET SCAN="^TMP(""IBDF"",$J,""SCAN"",IBFORMID)"
+17 KILL @SCAN
+18 ;
+19 SET FIELDS="^TMP(""IBDF"",$J,""FIELDS"")"
+20 KILL @FIELDS
+21 ;
+22 ;get form description
+23 SET NODE=$GET(^IBD(357.95,IBFORMID,0))
+24 IF NODE=""
QUIT
+25 SET PERPAGE=$PIECE(NODE,"^",10)
+26 ;determine sizes and offsets - in terms of PCL decipoints
+27 ; This is 1/4 inch ... .25*720 PCL decipoints
SET XOFFSET=180
+28 ; This is 1/2 inch ... .5*720 PCL decipoints
SET YOFFSET=360
+29 ; rowht = # of PCL decipoints/line in height
+30 ; 80 lines (133 Col) = 720/8 lines per inch)
+31 ; 72 lines (96 Col) = 720/7.2 lines per inch)
+32 ; 60 lines (80 Col) = 720/6 lines per inch)
+33 SET ROWHT=$PIECE(NODE,"^",10)
SET ROWHT=$SELECT(ROWHT>72:90,ROWHT>60:100.0005,1:120)
+34 SET COLWIDTH=$PIECE(NODE,"^",9)
+35 ;leaves offset in terms of fraction of column width - must still convert to decipoints
SET XBUBOS=$SELECT(COLWIDTH>96:.5,COLWIDTH>80:.75,1:1)
+36 SET YBUBOS=$SELECT(COLWIDTH>96:65,COLWIDTH>80:75,1:85)
+37 ; colwidth = # of PCL decipoints/character in width
+38 ; 133 Col = 720/16.67 char per inch
+39 ; 96 Col = 720/12 char per inch
+40 ; 80 Col = 720/10 char per inch
+41 ;converted to decipoints
SET COLWIDTH=$SELECT(COLWIDTH>96:(720/16.67),COLWIDTH>80:60,1:72)
+42 ;converted to decipoints
SET XBUBOS=XBUBOS*COLWIDTH
+43 SET YHANDOS=$SELECT(ROWHT=90:0,ROWHT=100.0005:15,1:30)
+44 ;
+45 ;get the list of scannable pages
+46 SET IEN=0
FOR
SET IEN=$ORDER(^IBD(357.95,IBFORMID,3,IEN))
IF 'IEN
QUIT
SET NODE=$GET(^IBD(357.95,IBFORMID,3,IEN,0))
IF $PIECE(NODE,"^",2)
SET PAGE(+NODE)=""
+47 ;
+48 ;
+49 SET PAGE=0
FOR
SET PAGE=$ORDER(PAGE(PAGE))
IF 'PAGE
QUIT
Begin DoDot:1
+50 ;
+51 ;list all the bubbles
+52 SET ROW=((PAGE-1)*PERPAGE)-1
+53 SET ARY="^IBD(357.95,""AC"","_IBFORMID_")"
+54 FOR
SET ROW=$ORDER(@ARY@(ROW))
IF ROW=""
QUIT
Begin DoDot:2
+55 IF (ROW\PERPAGE)+1'=PAGE
QUIT
+56 SET COL=""
FOR
SET COL=$ORDER(@ARY@(ROW,COL))
IF COL=""
QUIT
SET IEN=0
FOR
SET IEN=$ORDER(@ARY@(ROW,COL,IEN))
IF 'IEN
QUIT
Begin DoDot:3
+57 SET NODE=$GET(^IBD(357.95,IBFORMID,1,IEN,0))
+58 IF ($PIECE(NODE,"^",6)="")!(($PIECE(NODE,"^",4)="")&($PIECE(NODE,"^",8)=""))!('$PIECE(NODE,"^",3))
QUIT
+59 SET NAME=$EXTRACT($PIECE(NODE,"^",5),1,17)
SET QLFR=$PIECE(NODE,"^",10)
+60 SET TYPE=$PIECE(NODE,"^",7)
+61 IF (TYPE=0)!(TYPE=3)
IF QLFR
SET QLFR=$PIECE($GET(^IBD(357.98,QLFR,0)),"^",3)
+62 IF (TYPE=1)!(TYPE=2)
IF QLFR
SET QLFR=$EXTRACT($PIECE($GET(^IBD(357.98,QLFR,0)),"^"),1,12)
+63 IF QLFR'=""
SET NAME=NAME_"("_QLFR_")"
+64 IF QLFR=""
SET NAME=NAME_"-"
+65 SET @SCAN@(PAGE,$PIECE(NODE,"^",6),+$PIECE(NODE,"^",7),COL,(ROW-((PAGE-1)*PERPAGE)),IEN)=$PIECE(NODE,"^",3,12)
+66 SET @SCAN@(PAGE,$PIECE(NODE,"^",6))=NAME
+67 ;
End DoDot:3
End DoDot:2
+68 ;
+69 ;list all the handprint fields
+70 SET ARY="^IBD(357.95,""AD"","_IBFORMID_")"
+71 SET ROW=((PAGE-1)*PERPAGE)-1
+72 FOR
SET ROW=$ORDER(@ARY@(ROW))
IF ROW=""
QUIT
Begin DoDot:2
+73 IF (ROW\PERPAGE)+1'=PAGE
QUIT
+74 SET COL=""
FOR
SET COL=$ORDER(@ARY@(ROW,COL))
IF COL=""
QUIT
SET IEN=0
FOR
SET IEN=$ORDER(@ARY@(ROW,COL,IEN))
IF 'IEN
QUIT
Begin DoDot:3
+75 SET NODE=$GET(^IBD(357.95,IBFORMID,2,IEN,0))
+76 IF ($PIECE(NODE,"^",8)="")!('$PIECE(NODE,"^",4))!('$PIECE(NODE,"^",15))
QUIT
+77 SET @SCAN@(PAGE,$PIECE(NODE,"^",8),6,COL,(ROW-((PAGE-1)*PERPAGE)),IEN)=$PIECE(NODE,"^",3,17)
SET NAME=$EXTRACT($PIECE(NODE,"^",5),1,15)
+78 IF $PIECE(NODE,"^",17)
SET NAME=NAME_"("_$PIECE($GET(^IBE(359.1,$PIECE(NODE,"^",17),0)),"^")_")"
+79 SET @SCAN@(PAGE,$PIECE(NODE,"^",8))=NAME
End DoDot:3
End DoDot:2
End DoDot:1
+80 ;
+81 ;make form description
+82 FOR COUNT=1:1
SET LINE=$TEXT(FORM+COUNT^IBDFBKS1)
SET TAG=$PIECE(LINE,";;")
SET LINE=$PIECE(LINE,";;",2)
IF TAG["QUIT"
QUIT
Begin DoDot:1
+83 NEW PG
+84 DO BLDARY("")
+85 IF TAG["NAME"
SET IBDFSA(IBLC)=IBDFSA(IBLC)_" NAME = ""ENCOUNTER FORM "_IBFORMID_""";"
QUIT
+86 IF TAG["PGCK"
SET IBDFSA(IBLC)=IBDFSA(IBLC)_" else if ("
Begin DoDot:2
+87 SET PG=$ORDER(PAGE(0))
+88 SET IBDFSA(IBLC)=IBDFSA(IBLC)_"(page!="_PG_")"
+89 FOR
SET PG=$ORDER(PAGE(PG))
IF 'PG
QUIT
SET IBDFSA(IBLC)=IBDFSA(IBLC)_"&&(page!="_PG_")"
+90 SET IBDFSA(IBLC)=IBDFSA(IBLC)_"){"
End DoDot:2
QUIT
+91 SET IBDFSA(IBLC)=IBDFSA(IBLC)_LINE
+92 ;D BLDARY(LINE)
End DoDot:1
+93 ;
+94 ;make fields
+95 SET PAGE=0
SET FIELD=9
SET PRIORPG=$ORDER(@SCAN@(0))
SET LN=0
SET BLN=0
+96 FOR
SET PAGE=$ORDER(@SCAN@(PAGE))
IF PRIORPG'=PAGE
DO PRINTEND^IBDFBKS3
IF 'PAGE
QUIT
SET FID=""
FOR
SET FID=$ORDER(@SCAN@(PAGE,FID))
IF FID=""
QUIT
SET TYPE=$ORDER(@SCAN@(PAGE,FID,""))
IF TYPE=""
QUIT
Begin DoDot:1
+97 SET NAME=$GET(@SCAN@(PAGE,FID))
+98 ;
+99 ; -- 1 = EXACTLY ONE, 2 = AT MOST ONE (0 or 1)
+100 IF (TYPE=1)!(TYPE=2)
SET FIELD=FIELD+1
SET @FIELDS@(PAGE,FIELD)=""
Begin DoDot:2
+101 IF TYPE=1
SET NAME=NAME_" (1 Required)"
+102 IF TYPE=2
SET NAME=NAME_" (1 Optional)"
+103 SET NAME=$$NAME(NAME)
+104 DO BUBBLE^IBDFBKS3
QUIT
End DoDot:2
+105 ;
+106 IF TYPE=6
Begin DoDot:2
+107 NEW OLDNAME
SET OLDNAME=NAME
+108 SET COL=""
FOR
SET COL=$ORDER(@SCAN@(PAGE,FID,TYPE,COL))
IF COL=""
QUIT
SET ROW=""
FOR
SET ROW=$ORDER(@SCAN@(PAGE,FID,TYPE,COL,ROW))
IF ROW=""
QUIT
SET IEN=0
FOR
SET IEN=$ORDER(@SCAN@(PAGE,FID,TYPE,COL,ROW,IEN))
IF 'IEN
QUIT
Begin DoDot:3
+109 SET NAME=$$NAME(OLDNAME)
+110 ;S IBDLAST=0 I $O(@SCAN@(PAGE,FID,TYPE,COL,ROW))="",$O(@SCAN@(PAGE,FID,TYPE,COL))="",$O(@SCAN@(PAGE,FID,TYPE))="" S IBDLAST=1
+111 SET NODE=$GET(@SCAN@(PAGE,FID,6,COL,ROW,IEN))
DO HANDPRNT^IBDFBKS2(IEN,NAME,PAGE,ROW,COL,$PIECE(NODE,"^",1),$PIECE(NODE,"^",4),$PIECE(NODE,"^",13),$PIECE(NODE,"^",15),$PIECE(NODE,"^",2))
End DoDot:3
End DoDot:2
QUIT
+112 ;
+113 ;0 = ANY NUMBER
+114 ;3 = AT LEAST ONE (1 or more)
+115 IF (TYPE=0)!(TYPE=3)
Begin DoDot:2
+116 NEW OLDNAME
+117 ;I TYPE=3 N FIRST,LAST S LAST=FIELD+1,LAST=""
+118 IF TYPE=3
NEW FIRST,LAST
SET FIRST=FIELD+1
SET LAST=""
+119 SET COL=""
FOR
SET COL=$ORDER(@SCAN@(PAGE,FID,TYPE,COL))
IF COL=""
QUIT
SET ROW=""
FOR
SET ROW=$ORDER(@SCAN@(PAGE,FID,TYPE,COL,ROW))
IF ROW=""
QUIT
SET IEN=$ORDER(@SCAN@(PAGE,FID,TYPE,COL,ROW,0))
IF IEN
Begin DoDot:3
+120 SET FIELD=FIELD+1
SET @FIELDS@(PAGE,FIELD)=""
SET NODE=$GET(@SCAN@(PAGE,FID,TYPE,COL,ROW,IEN))
+121 SET (NAME,OLDNAME)=$GET(@SCAN@(PAGE,FID))
+122 SET NAME=$$NAME(NAME)
+123 IF TYPE=3
IF $ORDER(@SCAN@(PAGE,FID,TYPE,COL,ROW))=""
IF ($ORDER(@SCAN@(PAGE,FID,TYPE,COL))="")
SET LAST=FIELD
+124 DO BUBBLE^IBDFBKS3
End DoDot:3
End DoDot:2
End DoDot:1
+125 ;
END ; -- end of routine
+1 KILL @SCAN
+2 KILL @FIELDS
+3 KILL ^TMP("IBDF-NAME",$JOB)
+4 SET ^IBD(359.2,IBFORMID,10,IBLC,0)=IBDFSA(IBLC)
+5 SET ^IBD(359.2,IBFORMID,10,0)="^^"_IBLC_"^"_IBLC_"^"_DT_"^"
+6 QUIT
+7 ;
NAME(NAME) ;
+1 ; -- make sure name is unique
+2 NEW X
+3 IF (TYPE=0)!(TYPE=3)
SET NAME=NAME_" "_$PIECE(NODE,"^",6)
IF TYPE=3
+4 IF TYPE=1
IF NAME'["Required"
SET NAME=NAME_" Required"
+5 SET X=$GET(^TMP("IBDF-NAME",$JOB,NAME))+1
+6 SET ^TMP("IBDF-NAME",$JOB,NAME)=+X
+7 IF X>1
SET NAME=NAME_" #"_X
+8 QUIT NAME
+9 ;
BLDARY(TEXT) ;
+1 ; -- builds the export array IBDFS(linecount) = text
+2 NEW DIC,DA,DINUM,X,Y,I,J,DLAYGO
+3 IF IBLC=1
Begin DoDot:1
+4 SET DIC="^IBD(359.2,"
SET DIC(0)="L"
SET DLAYGO=359.2
SET (DINUM,X)=IBFORMID
DO FILE^DICN
+5 QUIT
End DoDot:1
+6 ;
+7 IF IBLC>0
Begin DoDot:1
+8 SET ^IBD(359.2,IBFORMID,10,IBLC,0)=IBDFSA(IBLC)
+9 KILL IBDFSA(IBLC)
+10 QUIT
End DoDot:1
+11 ;
+12 SET IBLC=IBLC+1
+13 SET IBDFSA(IBLC)=$GET(TEXT)
+14 QUIT
+15 ;
WRITE(IBFORMID) ;
+1 NEW LINE
SET LINE=0
+2 SET X=0
XECUTE ^%ZOSF("RM")
+3 FOR
SET LINE=$ORDER(^IBD(359.2,IBFORMID,10,LINE))
IF 'LINE
QUIT
WRITE !,$GET(^IBD(359.2,IBFORMID,10,LINE,0))
+4 SET X=80
XECUTE ^%ZOSF("RM")
+5 QUIT
+6 ;
PARAM ; -- get values from parameter file
+1 ; ibdfill := % fill required
+2 ; ibdbkgnd := % background expected
+3 SET IBDFILL=$PIECE($GET(^IBD(357.09,1,0)),"^",8)
IF IBDFILL=""
SET IBDFILL=20
+4 SET IBDBKGND=$PIECE($GET(^IBD(357.09,1,0)),"^",9)
IF IBDBKGND=""
SET IBDBKGND=5
+5 QUIT