source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7SMP.m@ 1683

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

initial load of FOIAVistA 6/30/08 version

File size: 7.9 KB
Line 
1LA7SMP ;DALOI/JMC - Shipping Manifest Print ;11/25/96 14:39
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,45,46,64**;Sep 27, 1994
3EN ;
4 D EN^DDIOL("Print Shipping Manifest","","!!")
5 D KILL^LA7SMP0
6 D INIT^LA7SMP0
7 I LA7QUIT D KILL^LA7SMP0 Q
8 S LA7SM=$$SELSM^LA7SMU(+LA7SCFG)
9 I LA7SM<0 D Q
10 . D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
11 . D KILL^LA7SMP0
12 S LA7CHK=1 ; flag to check for missing info.
13 W !
14 D DEV
15 D END^LA7SMP0
16 Q
17 ;
18 ;
19DEV ; Alternate entry point when user has already selected a manifest.
20 ;
21 ; Determine if bar codes on manifest
22 S LA7SBC=$$GET1^DIQ(62.9,+LA7SCFG_",",.09,"I")
23 ; If not in shipping status then don't print, save paper
24 I $P($G(^LAHM(62.8,+LA7SM,0)),"^",3)<4 S LA7SBC=0
25 I LA7SBC,$P($G(^LAHM(62.8,+LA7SM,0)),"^",3)=4 D
26 . N DIR,DIRUT,DTOUT,DUOUT,X,Y
27 . S DIR(0)="YO",DIR("A")="Print barcodes on manifest",DIR("B")="YES"
28 . D ^DIR
29 . I $D(DIRUT) S LA7EXIT=1
30 . I Y'=1 S LA7SBC=0
31 I $G(LA7EXIT) Q
32 ;
33 S %ZIS="MQ" D ^%ZIS
34 I POP D Q
35 . D HOME^%ZIS
36 . S LA7EXIT=1
37 I $D(IO("Q")) D Q
38 . N ZTDTH,ZTSK,ZTRTN,ZTIO,ZTSAVE
39 . S ZTRTN="DQ^LA7SMP",ZTSAVE("LA7*")="",ZTDESC="Lab Shipping Manifest Print"
40 . D ^%ZTLOAD,^%ZISC
41 . D EN^DDIOL("Request "_$S($G(ZTSK):"queued - Task #"_ZTSK,1:"NOT queued"),"","!")
42 . S LA7EXIT=1
43DQ ;
44 ;
45 U IO
46 ;
47 S LA7SM(0)=$G(^LAHM(62.8,+LA7SM,0))
48 S LA7SCFG=+$P(LA7SM(0),"^",2),LA7SCFG(0)=$G(^LAHM(62.9,LA7SCFG,0))
49 S (LA7DC,LA7EXIT,LA7END,LA7ITEM,LA7PAGE,LA7SMR,LA760,LA762801)=0
50 ;
51 ; Get collecting site's names and station numbers
52 D GETSITE^LA7SMP($P(LA7SCFG(0),"^",2),$P(LA7SCFG(0),"^",3),.LA7FSITE,.LA7TSITE)
53 ;
54 ; Flag - skip if accession deleted
55 S LA7SKIP=0
56 ; Check manifest for missing info.
57 I $G(LA7CHK)="" S LA7CHK=1
58 ;
59 S LA7NOW=$$HTE^XLFDT($H,"1M")
60 ; Manifest status
61 S LA7SMST=$P(LA7SM(0),"^",3)
62 I LA7SMST=4 D
63 . ; Get shipping date
64 . S LA7SDT=$$SMED^LA7SMU(LA7SM,"SM05")
65 . ; Flag to print receipt.
66 . I IOST["P-" S LA7SMR=$P(LA7SCFG(0),"^",10)
67 ;
68 ; Set barcode flag to "off"
69 I LA7SBC,IOST'["P-" S LA7SBC=0
70 ;
71 S $P(LA7SMST,"^",2)=$$EXTERNAL^DILFD(62.8,.03,"",LA7SMST)
72 S LA7LINE="",$P(LA7LINE,"-",IOM)=""
73 S LA7SVIA=$S($P(LA7SM(0),"^",4):$$GET1^DIQ(62.92,$P(LA7SM(0),"^",4)_",",.01),1:"None Specified")
74 ;
75 F S LA762801=$O(^LAHM(62.8,+LA7SM,10,LA762801)) Q:'LA762801 D
76 . F I=0,1,2 S LA762801(I)=$G(^LAHM(62.8,+LA7SM,10,LA762801,I))
77 . I $P(LA762801(0),"^",8)=0 Q ; Test previously "removed".
78 . S LA7SKIP=$$CHKTST^LA7SMU(+LA7SM,LA762801)
79 . I LA7SKIP,LA7SKIP<3 Q ; Accession/test deleted
80 . I $G(LA7CHK) D CHKREQI^LA7SM2(+LA7SM,LA762801)
81 . S ^TMP("LA7SM",$J,+$P(LA762801(0),"^",7),+$P(LA762801(0),"^",9),$P(LA762801(0),"^",5),LA762801)=""
82 . D BUILDRI^LA7SM2
83 ;
84 S (LA7SCOND,LA7SCONT,LA7UID)=""
85 ;
86 I '$D(^TMP("LA7SM",$J)) D
87 . D HED^LA7SMP0
88 . W !!,$$CJ^XLFSTR("No entries to print",IOM)
89 ;
90 S LA7ROOT="^TMP(""LA7SM"",$J)"
91 F S LA7ROOT=$Q(@LA7ROOT) Q:LA7ROOT="" Q:$QS(LA7ROOT,1)'="LA7SM"!($QS(LA7ROOT,2)'=$J) D Q:LA7EXIT
92 . I LA7EXIT Q
93 . I $L(LA7UID),LA7UID'=$QS(LA7ROOT,5) W !,LA7LINE
94 . I LA7SCOND'=$QS(LA7ROOT,3)!(LA7SCONT'=$QS(LA7ROOT,4)) D Q:LA7EXIT
95 . . I $L(LA7UID),LA7UID=$QS(LA7ROOT,5) W !,LA7LINE
96 . . I LA7PAGE,+LA7SMST'=4 W ! D WARN^LA7SMP0
97 . . S LA7SCOND=$QS(LA7ROOT,3),LA7SCONT=$QS(LA7ROOT,4)
98 . . D HED^LA7SMP0 S LA7UID=""
99 . S LA762801=$QS(LA7ROOT,6)
100 . F I=0,.1,2,5 S LA762801(I)=$G(^LAHM(62.8,+LA7SM,10,LA762801,I))
101 . S LA760=+$P(LA762801(0),"^",2) ; File #60 test ien
102 . I LA7UID'=$QS(LA7ROOT,5) D Q:LA7EXIT
103 . . S LA7UID=$QS(LA7ROOT,5)
104 . . S LRDFN=+LA762801(0) D PTID^LA7SMP0
105 . . S X=$Q(^LRO(68,"C",LA7UID))
106 . . I LA7UID'=$QS(X,3) S LA7SKIP=1 ; Skip - UID missing.
107 . . S LA7AA=+$QS(X,4),LA7AD=+$QS(X,5),LA7AN=+$QS(X,6)
108 . . S LA7SKIP=$$CHKTST^LA7SMU(+LA7SM,LA762801)
109 . . I LA7SKIP,LA7SKIP<3 Q ; Skip - accession/test deleted.
110 . . S LA7ACC=$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,.2),"Accession not available"),"^")
111 . . S X=$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,0),"Not available"),U,8)
112 . . S LA7PROV=$S(X>0:X,1:"")_"^"_$S(X>0:$$PRAC^LRX(X),1:X)
113 . . S LA7CDT=$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,3),"Not available"),U,1)
114 . . S LA7SPEC=$G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,5,1,0),"Not available")
115 . . I LA7SPEC S LA7SPEC(0)=$G(^LAB(61,+LA7SPEC,0))
116 . . E S LA7SPEC(0)="Specimen info not assigned"
117 . . S LA762=$P(LA7SPEC,"^",2)
118 . . I LA762 S LA762(0)=$G(^LAB(62,LA762,0))
119 . . E S LA762(0)="Collection info not assigned"
120 . . S LA7ITEM=LA7ITEM+1
121 . . I ($Y+12)>IOSL D Q:LA7EXIT
122 . . . W !
123 . . . I +LA7SMST'=4 D WARN^LA7SMP0
124 . . . D HED^LA7SMP0
125 . . D SH^LA7SMP0
126 . I LA7SKIP,LA7SKIP<3 Q ; Skip - accession/test deleted.
127 . I ($Y+6)>IOSL D Q:LA7EXIT
128 . . W !,LA7LINE
129 . . I +LA7SMST'=4 W ! D WARN^LA7SMP0
130 . . D HED^LA7SMP0 Q:LA7EXIT
131 . . S LA7DC=1 D SH^LA7SMP0
132 . W !,?11,$E(LA7LINE,1,41)
133 . W !,?11,$P(^LAB(60,LA760,0),"^",1),?43,$P(LA7SPEC(0),"^")
134 . I +LA7SMST'=4 D
135 . . N LA7TCOST
136 . . S LA7TCOST=$$GET1^DIQ(60,LA760_",",1,"E") Q:'$L(LA7TCOST)
137 . . W:$X>(IOM-15) ! W ?(IOM-15)," Cost: $",$FN(LA7TCOST,",",2)
138 . I LA762801(.1)'="" D
139 . . K ^UTILITY($J),LA7CMT
140 . . S DIWL=1,DIWR=IOM-13,DIWF=""
141 . . S X="Relevant clinical information: "_LA762801(.1) D ^DIWP
142 . . M LA7CMT=^UTILITY($J,"W",DIWL)
143 . . W ! D CMT^LA7SMP0 W !
144 . W !,?13,"VA NLT Code [Name]: "
145 . S LA7NLT=$$GET1^DIQ(64,+$$GET1^DIQ(60,LA760_",",64,"I")_",",1) ; NLT code.
146 . W $S($L(LA7NLT):LA7NLT,1:"*** None specified ***")
147 . S LA7NLTN=""
148 . I $L(LA7NLT) S LA7NLTN=$$GET1^DIQ(64,+$$GET1^DIQ(60,LA760_",",64,"I")_",",.01) ; NLT code test name.
149 . I $L(LA7NLTN) W:($X+$L(LA7NLTN)+3)>IOM !,?32 W " [",LA7NLTN,"]"
150 . I $P(LA7SM(0),"^",5) D ; Print non-VA test code info
151 . . N LA7X,LA7Y,LA7Z
152 . . S LA7X=$P($G(^DIC(4,+$P(LA7SCFG(0),"^",3),0),"UNKNOWN"),"^",1)_" Order Code [Name]: "
153 . . W !,?11,LA7X,$S($L($P(LA762801(5),"^")):$P(LA762801(5),"^"),1:"*** None specified ***")," "
154 . . S LA7Y="["_$S($L($P(LA762801(5),"^",2)):$P(LA762801(5),"^",2),1:"*** None specified ***")_"]"
155 . . I $L(LA7Y)<(IOM-$X) W LA7Y Q
156 . . S LA7X=IOM-$X W $E(LA7Y,1,LA7X)
157 . . S LA7Y=$E(LA7Y,LA7X+1,$L(LA7Y)),LA7Z=IOM-11
158 . . F S LA7X=$E(LA7Y,1,LA7Z) Q:LA7X="" W !,?11,LA7X S LA7Y=$E(LA7Y,LA7Z+1,$L(LA7Y))
159 ;
160 I LA7EXIT Q
161 ;
162 W !,LA7LINE,!!,"End of Shipping Manifest"
163 ;
164 I +LA7SMST'=4 D
165 . I IOM<131 W !
166 . D WARN^LA7SMP0
167 ;
168 ; Print shipping manifest receipt.
169 I LA7SMR D
170 . ; Flag that we're now printing receipt
171 . S $P(LA7SMR,"^",2)=1
172 . D HED^LA7SMP0
173 . W !!,"Number of specimens: ",LA7ITEM
174 . W !!,"Receipted by: ",$$REPEAT^XLFSTR("_",40)
175 . W !!," Date/time: ",$$REPEAT^XLFSTR("_",20)
176 ;
177 ; Print error listing if any.
178 I $O(LA7ERR(""))'="" D
179 . S $P(LA7SMR,"^",2)=2 ; Flag printing of error listing
180 . D HED^LA7SMP0
181 . S LA7I=0
182 . F S LA7I=$O(LA7ERR(LA7I)) Q:LA7I="" D Q:LA7EXIT
183 . . I ($Y+6)>IOSL D HED^LA7SMP0 Q:LA7EXIT
184 . . W LA7ERR(LA7I)
185 . . S LA7ROOT="^TMP(""LA7ERR"",$J,LA7I,$P(LA7SM,""^""))"
186 . . F S LA7ROOT=$Q(@LA7ROOT) Q:$QS(LA7ROOT,1)'="LA7ERR"!($QS(LA7ROOT,2)'=$J)!($QS(LA7ROOT,3)'=LA7I)!($QS(LA7ROOT,4)'=$P(LA7SM,"^")) D Q:LA7EXIT
187 . . . I ($Y+6)>IOSL D HED^LA7SMP0 Q:LA7EXIT W LA7ERR(LA7I)," (Cont'd)"
188 . . . W !,?10,"UID: ",$QS(LA7ROOT,5)," Test: ",$$GET1^DIQ(60,$QS(LA7ROOT,6)_",",.01)
189 . . W !!
190 ;
191 I $D(ZTQUEUED) D END^LA7SMP0
192 ;
193 Q
194 ;
195 ;
196GETSITE(LA7X,LA7Y,LA7FS,LA7TS) ; Setup variables for ordering and host sites
197 ;
198 ; Call with LA7X = File #4 ordering site ien
199 ; LA7Y = File #4 host site ien
200 ; LA7FS = array to return collecting site info
201 ; LA7TS = array to return host site info
202 ;
203 ; Get ordering site's names and station numbers
204 S LA7FS=$$GET1^DIQ(4,LA7X_",",.01)
205 I LA7FS="" S LA7FS="UNKNOWN:Entry #"_+LA7X
206 S LA7FS(99)=$$RETFACID^LA7VHLU2(LA7X,2,1)
207 I LA7FS(99)="" S LA7FS(99)="UNK: #"_+LA7X
208 ;
209 ; Get host site's names and station numbers
210 S LA7TS=$$GET1^DIQ(4,LA7Y_",",.01)
211 I LA7TS="" S LA7TS="UNKNOWN:Entry #"_+LA7Y
212 S LA7TS(99)=$$RETFACID^LA7VHLU2(LA7X,1,1)
213 I LA7TS(99)="" S LA7TS(99)="UNK: #"_+LA7Y
214 Q
215 ;
216 ;
217ASK(LA7SM) ; Ask it user wants to print manifest.
218 ; Call with array LA7SM = ien of 62.8^.01 field of #62.8
219 ;
220 N DIR,DIRUT,DTOUT,DUOUT,X,Y
221 ;
222 S DIR(0)="YO",DIR("A")="Print Shipping Manifest",DIR("B")="NO"
223 D ^DIR Q:$D(DIRUT)
224 I Y=1 D DEV,END^LA7SMP0
225 ;
226 Q
Note: See TracBrowser for help on using the repository browser.