source: FOIAVistA/trunk/r/ENGINEERING-EN/ENFAXMTM.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 8.1 KB
Line 
1ENFAXMTM ;WIRMFO/KLD,SAB-VALIDATE/TRANSMIT FAP EQUIPMENT; 6/9/97
2 ;;7.0;ENGINEERING;**25,29,39**;Aug 17, 1993
3 ;This routine should not be modified.
4ST Q
5 ;
6EQUIP ;Validite/Transmit FA docs by Equipment
7 ; Input
8 ; ENBAT("XMT") - flag; true (1) to transmit after validation
9 ; not returned
10 Q:$G(ENBAT("XMT"))="" ; required
11 W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets) for specified equipment.",!
12EQUIPA ; ask equipment
13 D GETEQ^ENUTL G:Y<1 EQUIPX
14 S ENEQ("DA")=+Y
15 S X=$$CHKFA^ENFAUTL(ENEQ("DA")) I +X D G EQUIPA
16 . S Y=$P(X,U,2) D DD^%DT S ENFADT("E")=Y
17 . W !!,"FA document for ENTRY #",ENEQ("DA")," was processed on ",ENFADT("E"),"."
18 . W !,"No action taken.",!,$C(7)
19 . K DA,ENFADT,X,Y
20 ; set variables for calls to ENFAVAL or ENFAACQ
21 S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
22 S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
23 K ^TMP($J)
24 I 'ENBAT("XMT") D ; validate only
25 . F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
26 . D ^ENFAVAL
27 I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
28 ; report results
29 I '$D(^TMP($J)) W !!,"Equipment Entry #: ",ENEQ("DA")," ",$S(ENBAT("XMT"):"was transmitted.",1:"looks OK!")
30 I $D(^TMP($J)) D LISTP W ! I ENBAT("XMT") W !,"Please correct the Equipment Record before sending a FA Document for this item.",!
31 G EQUIPA ; ask for another item
32EQUIPX ; exit point for EQUIP
33 K DIC,DIR,DIRUT,DUOUT,ENBAT,ENFAP,I,X,Y
34 Q
35 ;
36CMR ;Validite/Transmit FA docs by CMR
37 ; Input
38 ; ENBAT("XMT") - flag; true (1) to transmit after validation
39 ; not returned
40 Q:$G(ENBAT("XMT"))="" ; required
41 W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
42 W !,"for all equipment that belongs to a specified CMR.",!
43 ; ask cmr
44 S DIC="^ENG(6914.1,",DIC(0)="QEAM" D ^DIC Q:Y<1
45 S ENBAT("SEL","I")=+Y ; selected cmr
46 ; ask device
47 W !,"Now select the device to print results on."
48 S %ZIS="Q" D ^%ZIS G:POP CMRX
49 I $D(IO("Q")) D G CMRX
50 . S ZTRTN="CMRQ^ENFAXMTM"
51 . S ZTDESC=$S(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by CMR"
52 . F I="ENBAT(" S ZTSAVE(I)=""
53 . D ^%ZTLOAD W:$D(ZTSK) !,"Queued! Task #",ZTSK K ZTSK
54CMRQ ; queued entry point to process cmr
55 ; Input
56 ; ENBAT("SEL","I") = ien of selected CMR
57 ; ENBAT("XMT") = flag; when true FA Documents will be transmitted
58 ; set variables for calls to ENFAVAL or ENFAACQ
59 S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
60 S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
61 K ^TMP($J)
62 S (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
63 ; loop thru equipment on cmr
64 S ENEQ("DA")=0
65 F S ENEQ("DA")=$O(^ENG(6914,"AD",ENBAT("SEL","I"),ENEQ("DA"))) Q:'ENEQ("DA") D
66 . Q:'$P($G(^ENG(6914,ENEQ("DA"),8)),U,2) ; not capitalized
67 . S ENT("BAT")=ENT("BAT")+1
68 . I +$$CHKFA^ENFAUTL(ENEQ("DA")) S ENT("FAP")=ENT("FAP")+1 Q ; already
69 . I 'ENBAT("XMT") D ; validate only
70 . . F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
71 . . D ^ENFAVAL
72 . I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
73 ; report results
74 S ENBAT("TYPE")="CMR"
75 S ENBAT("SEL","E")=$P($G(^ENG(6914.1,ENBAT("SEL","I"),0)),U) ; cmr name
76 D RPTB
77CMRX ; exit point for CMR
78 K DIC,ENBAT,ENFA,ENFAP,X,Y
79 Q
80 ;
81STN ;Validite/Transmit FA Docs by Station
82 ; Input
83 ; ENBAT("XMT") - flag; true (1) to transmit after validation
84 ; not returned
85 Q:$G(ENBAT("XMT"))="" ; required
86 W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
87 W !,"for all equipment that belongs to a specified Station.",!
88 ; ask station
89 S DIR(0)="F^3:5",DIR("A")="STATION NUMBER"
90 S DIR("B")=$$GET1^DIQ(6910,"1,",1)
91 D ^DIR K DIR G:$D(DIRUT) STNX
92 S ENBAT("SEL","I")=Y ; selected station
93 ; ask device
94 W !,"Now select the device to print results on."
95 S %ZIS="Q" D ^%ZIS G:POP STNX
96 I $D(IO("Q")) D G STNX
97 . S ZTRTN="STNQ^ENFAXMTM"
98 . S ZTDESC=$S(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by Station"
99 . F I="ENBAT(" S ZTSAVE(I)=""
100 . D ^%ZTLOAD W:$D(ZTSK) !,"Queued! Task #",ZTSK K ZTSK
101STNQ ; queued entry point to process station
102 ; Input
103 ; ENBAT("SEL","I") = selected Station Number (3-5 characters)
104 ; ENBAT("XMT") = flag; when true FA Documents will be transmitted
105 ; set variables for calls to ENFAVAL or ENFAACQ
106 S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
107 S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
108 K ^TMP($J)
109 S (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
110 ; loop thru equipment on station
111 S ENSND=$$GET1^DIQ(6910,"1,",1) ; default station number
112 S ENEQ("DA")=0
113 F S ENEQ("DA")=$O(^ENG(6914,ENEQ("DA"))) Q:'ENEQ("DA") D
114 . Q:'$P($G(^ENG(6914,ENEQ("DA"),8)),U,2) ; not capitalized
115 . S ENSN=$P($G(^ENG(6914,ENEQ("DA"),9)),U,5) S:ENSN="" ENSN=ENSND
116 . Q:ENSN'=ENBAT("SEL","I") ; not station
117 . Q:$$GET1^DIQ(6914,ENEQ("DA"),19)']"" ; not on a CMR
118 . ; included in batch
119 . S ENT("BAT")=ENT("BAT")+1
120 . I +$$CHKFA^ENFAUTL(ENEQ("DA")) S ENT("FAP")=ENT("FAP")+1 Q ; already
121 . I 'ENBAT("XMT") D ; validate only
122 . . F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
123 . . D ^ENFAVAL
124 . I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
125 ; report results
126 S ENBAT("TYPE")="STATION"
127 S ENBAT("SEL","E")=ENBAT("SEL","I")
128 D RPTB
129 ;
130STNX ; exit point for STN
131 K DIC,ENBAT,ENFA,ENFAP,ENSN,ENSND,X,Y
132 Q
133 ;
134RPTB ; Report of Batch Validate/Transmit FA Documents for Equipment
135 ; Input - required
136 ; ENBAT("TYPE") = type of batch (CMR or STATION)
137 ; ENBA("SEL","E") = value specified (either a CMR or STATION NUMBER)
138 ; ENT("BAT") = count of equipment in batch (meets basic criteria)
139 ; ENT("FAP") = count of batch items already established in FAP
140 ; ENBAT("XMT") = flag (0 or 1), true for transmit options
141 ; Input - optional
142 ; ^TMP($J,"BAD",equip entry #,line number) = validation problem
143 ; Output
144 ; Kills ^TMP($J
145 U IO
146 S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENFA("NOW")=Y
147 D RPTBHD
148 ; count batch items which failed validation
149 S I=0 F S I=$O(^TMP($J,"BAD",I)) Q:I'>0 S ENT("BAD")=ENT("BAD")+1
150 S ENT("SENT")=ENT("BAT")-(ENT("FAP")+ENT("BAD"))
151 ; summarize validate/transmit results
152 W !!,+ENT("BAT")_" records have been processed from ",ENBAT("TYPE")
153 W ": ",ENBAT("SEL","E")_"."
154 W !!,ENT("SENT")_" record",$S(ENT("SENT")=1:" ",1:"s ")
155 W $S('ENBAT("XMT"):"would have been",1:$S(ENT("SENT")=1:"was",1:"were"))_" sent to FAP."
156 W !,ENT("FAP")_$S('ENBAT("XMT"):" would not have been",1:$S(ENT("FAP")=1:" was not",1:" were not"))_" sent due to already being established in FAP."
157 W !,ENT("BAD")_$S('ENBAT("XMT"):" would not have been",1:$S(ENT("BAD")=1:" was not",1:" were not"))_" sent due to validation problems."
158 ; detailed validation problems
159 I ENT("BAD")>0 D
160 . W !!,"Equipment Records not sent because of validation problems: "
161 . W !!,"Entry #",?24,"Reason"
162 . S I=0 F S I=$O(^TMP($J,"BAD",I)) Q:'I D Q:END
163 . . S II=0 F S II=$O(^TMP($J,"BAD",I,II)) Q:'II D Q:END
164 . . . I $Y+4>IOSL D RPTBHD Q:END W !!,"Entry #",?24,"Reason"
165 . . . W !,$J(I,11)," ",^TMP($J,"BAD",I,II)
166 . . W !
167 I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR
168 K ^TMP($J),DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,II,X,Y
169 K END,ENEQ,ENFA,ENFAP,ENPG,ENT
170 S:$D(ZTQUEUED) ZTREQ="Q"
171 D ^%ZISC
172 Q
173RPTBHD ; header for FA batch validate/transmit report
174 I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR I 'Y S END=1 Q
175 I $E(IOST,1,2)="C-"!ENPG W @IOF
176 S ENPG=ENPG+1
177 W !,"FA DOCUMENT ",$S(ENBAT("XMT"):"TRANSMISSION",1:"VALIDITY CHECK")
178 W " FOR ",ENBAT("TYPE"),": ",ENBAT("SEL","E")
179 W ?49,ENFA("NOW"),?72,"page ",ENPG
180 Q
181LISTP ; List Problems with Equipment/Document
182 ; Called from various FAP Document routines
183 ; Input
184 ; ENEQ("DA") - equipment entry #
185 ; ^TMP($J,"BAD",ENEQ("DA")) - number of problems
186 ; ^TMP($J,"BAD",ENEQ("DA"),seqn #) - description of a problem
187 ; ENBAT("XMT") - optional, flag; true when transmitting (for FA only)
188 ; Output
189 ; Problems are listed to the screen
190 ; ^TMP($J is killed
191 N I
192 W $C(7),!!,"This record "_$S($G(ENBAT("XMT"))=0:"would not have been",1:"was not")_" sent to FAP!"
193 W !,"Reason" W:^TMP($J,"BAD",ENEQ("DA"))>1 "s" W ":"
194 F I=1:1:^TMP($J,"BAD",ENEQ("DA")) W !?2,^TMP($J,"BAD",ENEQ("DA"),I)
195 K ^TMP($J)
196 Q
197 ;ENFAXMTM
Note: See TracBrowser for help on using the repository browser.