source: FOIAVistA/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDF2D2.m@ 1528

Last change on this file since 1528 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.0 KB
Line 
1IBDF2D2 ;ALB/CJM - ENCOUNTER FORM - PRINT SELECTION LIST (cont'd) ;NOV 16,1992
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
3 ;
4OTHER ;prints area at bottom of list for 'other'
5 N MAX,NODE,NAR,CODE,REQLEN,WIDTH,AREA,SC,IBY,IBX,COLWIDTH,ICR,NOTICR,COLUMNS,HT,I,J,HDR
6 ;
7 ;for ICR, each char will take up 172.7654
8 ;for non-ICR, allocate 103.6593 for each hand printed char
9 S ICR=172.7654
10 S NOTICR=103.65924
11 ;
12 ;how much space for each machine printed char?
13 D
14 .I IBFORM("WIDTH")>96 S COLWIDTH=720/16.67 Q
15 .I IBFORM("WIDTH")>80 S COLWIDTH=60 Q
16 .S COLWIDTH=72
17 ;
18 Q:'IBLIST("INPUT_RTN")
19 Q:'IBLIST("OTHER")
20 I IBLIST("NAR_PRINT")!IBLIST("NAR_READ") D
21 .S NAR=IBLIST("NAR_DATATYPE")
22 .I 'NAR S (IBLIST("NAR_READ"),IBLIST("NAR_PRINT"))=0 Q
23 .D DATATYPE^IBDFU1B(.NAR)
24 .S:NAR("MAX_INPUT")<NAR("SPACE") NAR("MAX_INPUT")=NAR("SPACE")
25 I IBLIST("CODE_PRINT")!IBLIST("CODE_READ") D
26 .S CODE=IBLIST("CODE_DATATYPE")
27 .I 'CODE S (IBLIST("CODE_READ"),IBLIST("CODE_PRINT"))=0 Q
28 .D DATATYPE^IBDFU1B(.CODE)
29 Q:'IBLIST("CODE_PRINT")&'IBLIST("NAR_PRINT")
30 ;
31 ;print field for code in ICR format? read with ICR?
32 I IBLIST("CODE_PRINT") S IBLIST("CODE_PRINT")=2
33 I '$G(IBFORM("SCAN",IBBLK("PAGE"))) D
34 .S (IBLIST("CODE_READ"),IBLIST("NAR_READ"))=0
35 .I IBLIST("CODE_PRINT"),IBLIST("CODE_READ") S IBLIST("CODE_READ")=3 ;read without ICR, but in ICR format
36 .I 'IBLIST("CODE_PRINT"),IBLIST("NAR_PRINT") S IBLIST("CODE_READ")=1 ;read the code without ICR from the narrative - not printed in ICR format
37 E I IBFORM("SCAN","ICR") D
38 .I IBLIST("NAR_READ"),IBLIST("NAR_PRINT") S (IBLIST("NAR_PRINT"),IBLIST("NAR_READ"))=2
39 .I IBLIST("CODE_PRINT") S IBLIST("CODE_READ")=2
40 .I 'IBLIST("CODE_PRINT"),IBLIST("CODE_READ"),IBLIST("NAR_PRINT")=2 S IBLIST("CODE_PRINT")=3 ;read the code without ICR, but it is printed in ICR format
41 ;
42 ;calculate required width=REQLEN
43 S MAX=IBBLK("W")-BOX
44 S REQLEN=1+BOX
45 F SC=1:1:8 I IBLIST("SCTYPE",SC)=2 D
46 .I IBLIST("ROUTINE",SC)]"" S AREA(REQLEN)=SC,REQLEN=REQLEN+4 Q
47 .I $L(IBLIST("SCSYMBOL",SC)) S AREA(REQLEN)=SC,REQLEN=REQLEN+$L(IBLIST("SCSYMBOL",SC))+1
48 I REQLEN<(BOX+2) S REQLEN=BOX
49 S (CODE("COL"),NAR("COL"))=REQLEN
50 S:IBLIST("CODE_PRINT") REQLEN=REQLEN+$FN(((CODE("SPACE")*ICR)/COLWIDTH)+.49,"",0)
51 Q:REQLEN>MAX
52 ;
53 ;use ICR format? Set WIDTH=width of a handprinted character accordingly
54 S WIDTH=$S(IBFORM("SCAN","ICR")&IBLIST("NAR_READ")&$G(IBFORM("SCAN",IBBLK("PAGE"))):ICR,1:NOTICR)
55 I IBLIST("NAR_PRINT") D
56 .S NAR("LINES")=0
57 .F D Q:I<MAX
58 ..S NAR("LINES")=NAR("LINES")+1
59 ..S NAR("WIDTH")=$FN((NAR("SPACE")/NAR("LINES"))+.49,"",0)
60 ..S I=REQLEN+$FN(.49+((NAR("WIDTH")*WIDTH)/COLWIDTH),"",0)
61 .S REQLEN=I+1
62 .I (MAX-REQLEN)<(CWIDTH-2),(IBLIST("OTHER")<2)!(REQLEN<((MAX\2))-2) S NAR("WIDTH")=NAR("WIDTH")+(((MAX-REQLEN)*COLWIDTH)\WIDTH) I WIDTH=ICR,NAR("WIDTH")>NAR("MAX_INPUT") S NAR("WIDTH")=NAR("MAX_INPUT")
63 .;
64 .S CODE("COL")=NAR("COL")+1+$FN(.49+((NAR("WIDTH")*WIDTH)/COLWIDTH),"",0)
65 ;
66 S HT=2 S:IBLIST("NAR_PRINT") HT=NAR("LINES") D:IBLIST("NAR_PRINT")=1 CNVRTHT^IBDF2D1(HT,.HT) S:IBLIST("NAR_PRINT")=2 HT=HT*2 S:IBLIST("OTHER")>1 HT=HT+1
67 S COLUMNS=1 I IBLIST("OTHER")>1 S COLUMNS=(MAX-BOX)\(REQLEN-BOX+1) S:'COLUMNS COLUMNS=1
68 ;
69 S J=($FN((IBLIST("OTHER")/COLUMNS)+.49,"",0)*HT)+1 ;J=the hight needed
70 I (J+COL("Y"))>(IBBLK("H")-BOX) S IBLIST("OTHER")=(IBBLK("H")-BOX)\(HT*COLUMNS),J=$FN((IBLIST("OTHER")/COLUMNS)+.49,"",0)*HT
71 S J=J+1 ;want one line space between the 'other' and the list above it
72 S I=IBBLK("H")-(COL("Y")+J+BOX) I I<COL("H") S:I<0 I=0 S (COL("ROWSLEFT"),COL("H"))=I S:IBLIST("H",2)>I IBLIST("H",2)=I S:IBLIST("H",3)>I IBLIST("H",3)=I
73 S J=$FN(.49+(CWIDTH\(COLUMNS*REQLEN)),"",0)+1 ;now J=width needed
74 S:($G(IBLIST("X",J))<(COLUMNS*REQLEN)) J=J+1
75 I ('$D(IBLIST("X",J)))!($G(IBLIST("X",J))'<(COLUMNS*REQLEN)) I '$G(IBLIST("H",J)) S IBLIST("H",J)=99
76 S IBY=COL("Y")+COL("H")+1,IBX=0
77 ;
78 ;draw the headers
79 I IBLIST("NAR_PRINT") S HDR=IBLIST("NAR_HDR") D CNVRTLEN^IBDF2D1(NAR("WIDTH"),.WIDTH) I $L(HDR)>WIDTH S HDR=$E("NARRATIVE",1,WIDTH)
80 F J=0:1:(COLUMNS-1) D
81 .D:IBLIST("NAR_PRINT") DRWSTR^IBDFU(IBY,NAR("COL")+(J*REQLEN),HDR,"s") D:IBLIST("CODE_PRINT") DRWSTR^IBDFU(IBY,CODE("COL")+(J*REQLEN),IBLIST("CODE_HDR"),"s")
82 ;
83 S IBY=IBY+1
84 F J=0:1:(IBLIST("OTHER")-1) S I=J#COLUMNS,CNT=CNT+1 S:(I=0)&J IBY=IBY+HT D AREAS(IBY,I,CNT)
85 Q
86 ;
87AREAS(IBY,COLUMN,CNT) ;draw the bubbles, etc.
88 S IBX="" F S IBX=$O(AREA(IBX)) Q:'IBX D
89 .S SC=AREA(IBX)
90 .I IBLIST("ROUTINE",SC)]"" D
91 ..D DRWBBL^IBDFM1((IBLIST("OTHER")>1)+IBY,IBX+(COLUMN*REQLEN),IBLIST("INPUT_RTN"),"",IBLIST("NAME"),"S"_IBLIST_"("_SC,IBLIST("RULE",SC),"OTHER#"_CNT_")","OTHER",IBLIST("QLFR",SC),0,CNT)
92 .E D
93 ..S I=IBLIST("SCSYMBOL",SC) I " "[I S I=$TR(I," ","_")
94 ..D DRWSTR^IBDFU(1+IBY,IBX+(COLUMN*REQLEN),I)
95 .;
96 .D:IBLIST("SCHDR",SC)'="" DRWSTR^IBDFU(IBY+1+(IBLIST("OTHER")>1),IBX+(COLUMN*REQLEN)+((IBLIST("SCW",SC)-$L(IBLIST("SCHDR",SC)))\2),IBLIST("SCHDR",SC))
97 ;
98 ;add fields for the narrative
99 I IBLIST("NAR_PRINT")!IBLIST("NAR_READ") D
100 .D DRWHAND^IBDFM1(IBY+(IBLIST("OTHER")>1),NAR("COL")+(COLUMN*REQLEN),NAR("WIDTH"),IBLIST("INPUT_RTN"),NAR("LINES"),"S"_IBLIST_"(N",IBLIST("NAME")_"(OTHER)","OTHER","",CNT,IBLIST("NAR_PRINT"),IBLIST("NAR_READ"),NAR)
101 .D:IBLIST("OTHER")>1 DRWSTR^IBDFU(IBY,NAR("COL")+(COLUMN*REQLEN),"(OTHER#"_CNT_")")
102 ;
103 ;add fields for the code
104 I IBLIST("CODE_PRINT")!IBLIST("CODE_READ") D
105 .I IBLIST("CODE_PRINT") D
106 ..D DRWHAND^IBDFM1(IBY+(IBLIST("OTHER")>1),CODE("COL")+(COLUMN*REQLEN),CODE("SPACE"),IBLIST("INPUT_RTN"),1,"S"_IBLIST_"(C",IBLIST("NAME")_"(OTHER)","OTHER","",CNT,IBLIST("CODE_PRINT"),IBLIST("CODE_READ"),CODE)
107 .D:('IBLIST("NAR_PRINT"))&(IBLIST("OTHER")>1) DRWSTR^IBDFU(IBY,CODE("COL")+(COLUMN*REQLEN),"(OTHER#"_CNT_")")
108 .;
109 .;if there wasn't a field printed on the form for the code, but there was for the narrative, read the code from the narrative - ICR should not be used, rather, require the operator to key in the code
110 .I ('IBLIST("CODE_PRINT"))&IBLIST("NAR_PRINT") D
111 ..D DRWHAND^IBDFM1(IBY+(IBLIST("OTHER")>1),NAR("COL")+(COLUMN*REQLEN),NAR("WIDTH"),IBLIST("INPUT_RTN"),NAR("LINES"),"S"_IBLIST_"(C",IBLIST("NAME")_"(OTHER)","OTHER","",CNT,0,IBLIST("CODE_READ"),CODE)
112 Q
Note: See TracBrowser for help on using the repository browser.