source: FOIAVistA/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDF4A.m@ 1203

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

initial load of FOIAVistA 6/30/08 version

File size: 6.7 KB
Line 
1IBDF4A ;ALB/CJM - ENCOUNTER FORM - BUILD FORM(editing group's selections - continued from IBDF4) ;NOV 16,1992
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;**38**;APR 24, 1997
3 ;
4EDIT ;allows editing of an existing selection
5 N SEL,SUB,SLCTN,SC,NODE,OQTY,NQTY
6 D EN^VALM2($G(XQORNOD(0)),"S")
7 S SEL="" F S SEL=$O(VALMY(SEL)) Q:'SEL D
8 .W !,"Editing Entry #",SEL
9 .S SLCTN=$G(@VALMAR@("IDX",SEL,SEL)) Q:'SLCTN
10 .S NODE=$G(^IBE(357.3,SLCTN,0))
11 .;re-index the record, to insure it is good
12 .K DIK,DA S DIK="^IBE(357.3,",DA=SLCTN D IX^DIK K DIK
13 .;edit the order of the selection - also, for placeholders, the text, then quit
14 .D FULL^VALM1
15 .I $P(NODE,"^",2) D Q
16 ..S DA=SLCTN,DIE=357.3,DR="[IBDF EDIT PLACE HOLDER]" D ^DIE K DIE,DA,DR
17 .S DA=SLCTN,DIE=357.3,DR=".05;I '$P($G(^IBE(357.6,$P($G(^IBE(357.2,+IBLIST,0)),""^"",11),16)),""^"",8) S Y=""@99"";S OQTY=$P(^IBE(357.3,DA,0),""^"",9);.09;S NQTY=X;@99;S CONT=1" S CONT=0 D ^DIE K DIE,DA,DR
18 .D CODES
19 .D ADD^IBDF4C
20 .;add any missing subcolumns
21 .S SC=0 F SC=1:1:8 I $G(IBLIST("SCTYPE",SC))=1 I '$D(^IBE(357.3,SLCTN,1,"B",SC)) D
22 ..K DA,DO,DINUM,DIC
23 ..N DLAYGO
24 ..S DIC="^IBE(357.3,"_SLCTN_",1,",DA(1)=SLCTN,X=SC,DIC(0)="L",DLAYGO=357.3 D FILE^DICN
25 .;now allow the user to edit editable subcolumns - CONT=0 means the user up-arrowed out, so stop
26 .I CONT S SUB=0 F S SUB=$O(^IBE(357.3,SLCTN,1,SUB)) Q:'SUB D
27 ..S SC=+$G(^IBE(357.3,SLCTN,1,SUB,0)) I $G(IBLIST("SCTYPE",SC))=1,$G(IBLIST("SCPIECE",SC)),$G(IBLIST("SCEDITABLE",SC)) D
28 ...I $G(^IBE(357.3,SLCTN,1,0))="" S ^IBE(357.3,SLCTN,1,0)="^357.31AI^"
29 ...S DIE="^IBE(357.3,"_SLCTN_",1,",DA(1)=SLCTN,DA=SUB,DR=".02;S CONT=1",CONT=0 W !!,"Editing Subcolumn "_SC_": Header="_IBLIST("SCHDR",SC)
30 ...S IBVAL=$P($G(^IBE(357.3,SLCTN,1,SUB,0)),"^",2)
31 ...I $G(OQTY)'=$G(NQTY) S IBVAL=$P(IBVAL," x "_OQTY)_$S(NQTY>1:" x "_NQTY,1:""),DR=".02////^S X=IBVAL;I;"_DR
32 ...;--added for modifiers
33 ...I $P($G(^IBE(357.3,SLCTN,3,0)),"^",4)>0 D
34 ....S:IBVAL'["w/ mod" IBVAL=IBVAL_" w/ mod"
35 ....S DR=".02////^S X=IBVAL;I;"_DR
36 ...D ^DIE K DIE,DA,DR,IBVAL I 'CONT Q
37 .D NARR^IBDF4 W !
38 .D TERM^IBDF4 W !
39 D IDXSLCTN^IBDF4
40 S VALMBCK="R"
41EDITEXIT ;
42 Q
43CODES ; -- allow editing of 2nd & 3rd codes that are associated w/ original
44 N IBPI S IBPI=+$P($G(^IBE(357.2,+IBLIST,0)),U,11) Q:'IBPI
45 Q:'$P($G(^IBE(357.6,IBPI,16)),U,9)!('$D(^IBE(357.6,IBPI,17)))
46 N IBI,IBEXT,FLD
47 F IBI=3,4 S FLD="2.0"_IBI D
48 .S IBEXT=$P($G(^IBE(357.3,SLCTN,2)),"^",IBI)
49 .I $G(IBEXT)]"" D
50 ..W !,$S(IBI=3:"SECOND",1:"THIRD")," CODE: ",IBEXT
51 ..S DIR(0)="Y",DIR("A")="Delete?",DIR("B")="NO" D ^DIR K DIR
52 ..I Y=1 S IBEXT="",DIE="^IBE(357.3,",DA=SLCTN,DR=FLD_"////@" D ^DIE K DIE,DA,DR
53 .S DIC("A")="Select a "_$S(IBI=3:"SECOND",1:"THIRD")_" code to associate with the original:",DIC("B")=$S($G(IBEXT)]"":IBEXT,1:"")
54 .I '$$DORTN^IBDFU1B(.IBRTN) Q
55 .S IBEXT=$S(+$G(Y)>0:$P($G(Y(0)),"^"),1:"")
56 .I $G(IBEXT)]"" D
57 ..S DIE="^IBE(357.3,",DA=SLCTN,DR=FLD_"////^S X=IBEXT"
58 ..D ^DIE K DIE,DA,DR
59 Q
60DELETE ;allows the user to select selections to delete
61 N SEL
62 D EN^VALM2($G(XQORNOD(0)))
63 K DA
64 S SEL="" F S SEL=$O(VALMY(SEL)) Q:'SEL D
65 .S DIK="^IBE(357.3,",DA=$G(@VALMAR@("IDX",SEL,SEL))
66 .Q:'$$RUSURE^IBDFU5("Selection #"_SEL)
67 .D ^DIK
68 .D KILL^VALM10(SEL)
69 K DIK,DA
70 D IDXSLCTN^IBDF4
71 S VALMBCK="R"
72 Q
73 ;
74ADDBLANK ;allows the user to add a dummy selection to the selection group
75 ;i.e., a place holder that will not actually print a selection
76 ;
77 D FULL^VALM1
78 D ADD
79 D IDXSLCTN^IBDF4
80 S VALMBCK="R"
81 Q
82 ;
83NEXT(IBLIST,IBGRP) ;returns the next print order to assign=last + 1
84 Q (1+$O(^IBE(357.3,"APO",IBLIST,IBGRP,""),-1))
85 ;
86ASKMORE() ;ask if the user wants to add another, returns 1 or 0
87 K DIR
88 S DIR(0)="Y",DIR("A")="Do you want to add another",DIR("B")="NO"
89 D ^DIR
90 K DIR
91 I $D(DIRUT)!'Y Q 0
92 Q 1
93 ;
94ADD ;allows the user to add a dummy selection to the selection group
95 ;i.e., a place holder that will not actually print a selection
96 ;
97 N QUIT,ORDER,SLCTN,NODE
98 S QUIT=0 F D Q:QUIT Q:'$$ASKMORE()
99 .S ORDER=$$NEXT(IBLIST,IBGRP)
100 .;we have all the data needed to add the selection - so add it
101 .S NODE=ORDER_"^"_1_"^"_IBLIST_"^"_IBGRP_"^"_ORDER
102 .K DIC,DD,DO,DINUM
103 .N DLAYGO
104 .S DIC="^IBE(357.3,",X=ORDER,DIC(0)="FL",DLAYGO=357.3
105 .D FILE^DICN K DIC,DIE,DA
106 .S SLCTN=$S(+Y<0:"",1:+Y)
107 .I 'SLCTN W !,"Unable to create the place holder!" D PAUSE^VALM1 S QUIT=1 Q
108 .S ^IBE(357.3,SLCTN,0)=NODE
109 .K DA S DA=SLCTN,DIK="^IBE(357.3," D IX^DIK K DIK,DA
110 .K DIE S DA=SLCTN,DIE=357.3,DR="[IBDF EDIT PLACE HOLDER]" D ^DIE K DIE,DA,DR
111 .K DA S DA=SLCTN,DIK="^IBE(357.3," D IX^DIK K DIK,DA
112 Q
113EN ; -- Resequence selection lists not taking into account the
114 ; the place holders. Will put the selection list into alphabetic
115 ; or numeric order..... the place holders will be used as exta
116 ; lines of description and not as separators or headers within
117 ; the group.
118 N CNTR,COUNT,IBGROUP,IBORDER
119 S (CNTR,COUNT,IBGROUP)=0
120 K ^TMP("BLANK",$J),^TMP("IBDF",$J)
121 ; -- Resequence only specific groups in block.
122 I $D(IBGRUP) F S IBGROUP=$O(IBGRUP(IBGROUP)) Q:'IBGROUP D RESEQ
123 I $D(IBGRUP) D ORDER Q
124 ; -- Resequence all groups of the block.
125 I '$D(IBGRUP) F S IBGROUP=$O(^IBE(357.3,"APO",IBLIST,IBGROUP)) Q:'IBGROUP D RESEQ
126 I '$D(IBGRUP) D ORDER Q
127 Q
128 ;
129RESEQ S IBORDER=0 F S IBORDER=$O(^IBE(357.3,"APO",IBLIST,IBGROUP,IBORDER)) Q:'IBORDER S ITEM=0 F S ITEM=$O(^IBE(357.3,"APO",IBLIST,IBGROUP,IBORDER,ITEM)) Q:'ITEM D
130 .S NODE=$G(^IBE(357.3,ITEM,0))
131 .I ($P(NODE,"^",3)'=IBLIST) Q
132 .S GROUP=+$P(NODE,"^",4)
133 .Q:$P($G(^IBE(357.4,GROUP,0)),"^",3)'=IBLIST
134 .S COUNT=COUNT+1
135 .I $P(NODE,"^",2) S ^TMP("BLANK",$J,GROUP,CNTR,COUNT,ITEM)=""
136 .S IEN=$O(^IBE(357.3,ITEM,1,"B",SUBCOL,0)) Q:'IEN
137 .S VALUE=$P($G(^IBE(357.3,ITEM,1,IEN,0)),"^",2)
138 .S VALUE=$S(SORT=1:VALUE=" "_VALUE,1:+$P(NODE,"^",1))
139 .S CNTR=CNTR+1
140 .S ^TMP("IBDF",$J,"RESEQUENCE LIST",GROUP,$E(VALUE,1,40),ITEM)=CNTR
141 .S ^TMP("BLANK",$J,GROUP,CNTR,COUNT,ITEM)=""
142 ;
143 ;set the order
144ORDER S (GROUP,CNTR)=0
145 F S GROUP=$O(^TMP("IBDF",$J,"RESEQUENCE LIST",GROUP)) Q:'GROUP D
146 .S VALUE="",CNT=0
147 .F S VALUE=$O(^TMP("IBDF",$J,"RESEQUENCE LIST",GROUP,VALUE)) Q:VALUE="" D
148 ..S ITEM=0 F S ITEM=$O(^TMP("IBDF",$J,"RESEQUENCE LIST",GROUP,VALUE,ITEM)) Q:'ITEM S CNTR=^TMP("IBDF",$J,"RESEQUENCE LIST",GROUP,VALUE,ITEM) D:'$D(^TMP("BLANK",$J,GROUP,CNTR)) I $D(^TMP("BLANK",$J,GROUP,CNTR)) D BLANK
149 ...S CNT=CNT+1
150 ...K DIE,DA,DR S DIE="^IBE(357.3,",DR=".05///"_CNT,DA=ITEM D ^DIE K DIE,DA,DR
151 ;
152 K Y,X,DIR,^TMP("IBDF",$J,"RESEQUENCE LIST")
153 D IDXGRP^IBDF3
154 Q
155BLANK ; -- Check to see if there is any place holders.
156 N IBDITEM,COUNT
157 F COUNT=0:0 S COUNT=$O(^TMP("BLANK",$J,GROUP,CNTR,COUNT)) Q:'COUNT F IBDITEM=0:0 S IBDITEM=$O(^TMP("BLANK",$J,GROUP,CNTR,COUNT,IBDITEM)) Q:'IBDITEM D
158 .S CNT=CNT+1
159 .K DIE,DA,DR S DIE="^IBE(357.3,",DR=".05///"_CNT,DA=IBDITEM D ^DIE K DIE,DA,DR
160 .Q
161 Q
Note: See TracBrowser for help on using the repository browser.