source: FOIAVistA/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPLO2A.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 8.6 KB
Line 
1PRCPLO2A ;WOIFO/DAP-stock status report (cont) ; 1/26/06 12:00pm
2V ;;5.1;IFCAP;**83,98,112**;Oct 20, 2000;Build 2
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 ;External reference to $$GET1^DIQ(4, is supported by ICR# 10090
5 ; *112 changes by: VMP, Holloway,T.
6 ;
7ENT ;*83 Building ^TMP with total result data, totaling logic pulled from PRCPRSS0
8 N PRCPIN,PRCPIN1,PRCPIN2,PRCPIN3,TOTVAL,TOTCLOS,TOTCLO1,TOTCLO2,SSRIEN
9 S U="^",STA=PRC("SITE"),INV=PRCP("I")
10 ;
11SSR1 ;*98 First Stock Status Report data field set
12 ;
13 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,1)=STA ;Station #
14 S DATRN=$$FMTE^XLFDT(DATESTRT)
15 S DATRN1=$P(DATRN," ",1)_","_$P(DATRN," ",2)
16 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,2)=DATRN1 ;Date Range
17 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,3)=INARNG ;Inactivity Range
18 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,4)=INV ;Inventory Point #
19 ;*83 Retrieve external inventory point name and primary/secondary/
20 ;warehouse indicator
21 S PRCPIN=$G(^PRCP(445,INV,0))
22 I PRCPIN'="" S PRCPIN1=$P(PRCPIN,"^",1),PRCPIN2=$P(PRCPIN1,"-",2,99)
23 I PRCPIN'="" S PRCPIN3=$P(PRCPIN,"^",3)
24 I PRCPIN="" S PRCPIN2="",PRCPIN3=""
25 S PRCPIN2=$TR(PRCPIN2,"*","|") ; Needed due to "*" delimiter
26 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,5)=PRCPIN2 ;Inventory Point Name
27 S $P(^TMP($J,"PRCPSSR1",STA,INV),U,6)=PRCPIN3 ;P/S/W Indicator
28 ;
29 S PRCPDX=$TR(^TMP($J,"PRCPSSR1",STA,INV),"^","*"),DR="3///"_PRCPDX
30 D FILE
31 ;
32SSR2 ;*98 Second Stock Status Report data field set
33 ;
34 S TOTOPEN=0 F ACCT=1,2,3,6,8 S %=$P($G(^TMP($J,1,"OPEN",ACCT)),U,2),TOTOPEN=TOTOPEN+%
35 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,1)=TOTOPEN ;Std. Open Balance Total $
36 S TOTOPEN=0 F ACCT=1,2,3,6,8 S %=$P($G(^TMP($J,2,"OPEN",ACCT)),U,2),TOTOPEN=TOTOPEN+%
37 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,2)=TOTOPEN ;ODI Open Balance Total $
38 S TOTOPEN=0 F ACCT=1,2,3,6,8 S %=$P($G(^TMP($J,3,"OPEN",ACCT)),U,2),TOTOPEN=TOTOPEN+%
39 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,3)=TOTOPEN ;All Open Balance Total $
40 ;
41 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,4)=+$G(^TMP($J,1,"REC","TOTAL"))
42 ;Std. Receipts Total $
43 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,5)=+$G(^TMP($J,2,"REC","TOTAL"))
44 ;ODI Receipts Total $
45 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,6)=+$G(^TMP($J,3,"REC","TOTAL"))
46 ;All Receipts Total $
47 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,7)=+$G(^TMP($J,1,"ISS","TOTAL"))
48 ;Std. Usages Total $
49 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,8)=+$G(^TMP($J,2,"ISS","TOTAL"))
50 ;ODI Usages Total $
51 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,9)=+$G(^TMP($J,3,"ISS","TOTAL"))
52 ;All Usages Total $
53 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,10)=+$G(^TMP($J,1,"ADJ","TOTAL"))
54 ;Std. Adjustments Total $
55 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,11)=+$G(^TMP($J,2,"ADJ","TOTAL"))
56 ;ODI Adjustments Total $
57 S $P(^TMP($J,"PRCPSSR2",STA,INV),U,12)=+$G(^TMP($J,3,"ADJ","TOTAL"))
58 ;All Adjustments Total $
59 ;
60 S PRCPDX=$TR(^TMP($J,"PRCPSSR2",STA,INV),"^","*"),DR="4///"_PRCPDX
61 D FILE
62 ;
63SSR3 ;*98 Third Stock Status Report data field set
64 ;
65 S TOTCLOS=0
66 S TOTCLOS=$P($G(^TMP($J,"PRCPSSR2",STA,INV)),U,1)+$G(^TMP($J,1,"REC","TOTAL"))
67 S TOTCLOS=TOTCLOS+$G(^TMP($J,1,"ISS","TOTAL"))+$G(^TMP($J,1,"ADJ","TOTAL"))
68 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,1)=TOTCLOS ;Std. Closing Bal Total $
69 S TOTCLO1=0
70 S TOTCLO1=$P($G(^TMP($J,"PRCPSSR2",STA,INV)),U,2)+$G(^TMP($J,2,"REC","TOTAL"))
71 S TOTCLO1=TOTCLO1+$G(^TMP($J,2,"ISS","TOTAL"))+$G(^TMP($J,2,"ADJ","TOTAL"))
72 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,2)=TOTCLO1 ;ODI Closing Bal Total $
73 S TOTCLO2=0
74 S TOTCLO2=$P($G(^TMP($J,"PRCPSSR2",STA,INV)),U,3)+$G(^TMP($J,3,"REC","TOTAL"))
75 S TOTCLO2=TOTCLO2+$G(^TMP($J,3,"ISS","TOTAL"))+$G(^TMP($J,3,"ADJ","TOTAL"))
76 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,3)=TOTCLO2 ;All Closing Bal Total $
77 ;
78 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,4)=+$G(^TMP($J,1,"RECN","TOTAL"))
79 ;# Std. Receipts
80 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,5)=+$G(^TMP($J,2,"RECN","TOTAL"))
81 ;# ODI Receipts
82 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,6)=+$G(^TMP($J,3,"RECN","TOTAL"))
83 ;# All Receipts
84 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,7)=+$G(^TMP($J,1,"ISSN","TOTAL"))
85 ;# Std. Issues
86 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,8)=+$G(^TMP($J,2,"ISSN","TOTAL"))
87 ;# ODI Issues
88 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,9)=+$G(^TMP($J,3,"ISSN","TOTAL"))
89 ;# All Issues
90 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,10)=+$G(^TMP($J,1,"ADJN","TOTAL"))
91 ;# Std. Adjustments
92 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,11)=+$G(^TMP($J,2,"ADJN","TOTAL"))
93 ;# ODI Adjustments
94 S $P(^TMP($J,"PRCPSSR3",STA,INV),U,12)=+$G(^TMP($J,3,"ADJN","TOTAL"))
95 ;# All Adjustments
96 ;
97 S PRCPDX=$TR(^TMP($J,"PRCPSSR3",STA,INV),"^","*"),DR="5///"_PRCPDX
98 D FILE
99 ;
100SSR4 ;*98 Fourth Stock Status Report data field set
101 ;
102 ;*83 Turnover computation logic also pulled from PRCPRSS0
103 S DAYS=$P("31^28^31^30^31^30^31^31^30^31^30^31",U,+$E(DATESTRT,4,5))
104 I DAYS=28 S %=(17+$E(DATESTRT))_$E(DATESTRT,2,3),DAYS=$S(%#400=0:29,(%#4=0&(%#100'=0)):29,1:28)
105 ;
106 S %=($G(^TMP($J,1,"ISS","TOTAL"))*365)/DAYS,%=$S('TOTCLOS:0,1:-%/TOTCLOS)
107 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,1)=$J(%,0,2)
108 ;Std. Turnover
109 S %=($G(^TMP($J,2,"ISS","TOTAL"))*365)/DAYS,%=$S('TOTCLO1:0,1:-%/TOTCLO1)
110 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,2)=$J(%,0,2)
111 ;ODI Turnover
112 S %=($G(^TMP($J,3,"ISS","TOTAL"))*365)/DAYS,%=$S('TOTCLO2:0,1:-%/TOTCLO2)
113 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,3)=$J(%,0,2)
114 ;All Turnover
115 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,4)=+$G(^TMP($J,1,"INACTN","TOTAL"))
116 ;# Std. Inactive
117 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,5)=+$G(^TMP($J,2,"INACTN","TOTAL"))
118 ;# ODI Inactive
119 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,6)=+$G(^TMP($J,3,"INACTN","TOTAL"))
120 ;# All Inactive
121 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,7)=+$G(^TMP($J,1,"INACT","TOTAL"))
122 ;Std Inactive Total $
123 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,8)=+$G(^TMP($J,2,"INACT","TOTAL"))
124 ;ODI Inactive Total $
125 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,9)=+$G(^TMP($J,3,"INACT","TOTAL"))
126 ;All Inactive Total $
127 ;
128 S %=$S('$G(^TMP($J,1,"VALUE","TOTAL")):0,1:$G(^TMP($J,1,"INACT","TOTAL"))/$G(^TMP($J,1,"VALUE","TOTAL")))
129 I %="" S %=0
130 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,10)=$J(%,0,2)
131 ;Std. Inactive %
132 S %=$S('$G(^TMP($J,2,"VALUE","TOTAL")):0,1:$G(^TMP($J,2,"INACT","TOTAL"))/$G(^TMP($J,2,"VALUE","TOTAL")))
133 I %="" S %=0
134 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,11)=$J(%,0,2)
135 ;ODI Inactive %
136 S %=$S('$G(^TMP($J,3,"VALUE","TOTAL")):0,1:$G(^TMP($J,3,"INACT","TOTAL"))/$G(^TMP($J,3,"VALUE","TOTAL")))
137 I %="" S %=0
138 S $P(^TMP($J,"PRCPSSR4",STA,INV),U,12)=$J(%,0,2)
139 ;All Inactive %
140 ;
141 S PRCPDX=$TR(^TMP($J,"PRCPSSR4",STA,INV),"^","*"),DR="6///"_PRCPDX
142 D FILE
143 ;
144SSR5 ;*98 Fifth Stock Status Report data field set
145 ;
146 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,1)=+$G(^TMP($J,1,"LONGN","TOTAL"))
147 ;# Std. Long Supply
148 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,2)=+$G(^TMP($J,2,"LONGN","TOTAL"))
149 ;# ODI Long Supply
150 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,3)=+$G(^TMP($J,3,"LONGN","TOTAL"))
151 ;# All Long Supply
152 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,4)=+$G(^TMP($J,1,"LONG","TOTAL"))
153 ;Std. Long Supply Total $
154 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,5)=+$G(^TMP($J,2,"LONG","TOTAL"))
155 ;ODI Long Supply Total $
156 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,6)=+$G(^TMP($J,3,"LONG","TOTAL"))
157 ;All Long Supply Total $
158 ;
159 S %=$S('$G(^TMP($J,1,"VALUE","TOTAL")):0,1:$G(^TMP($J,1,"LONG","TOTAL"))/$G(^TMP($J,1,"VALUE","TOTAL")))
160 I %="" S %=0
161 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,7)=$J(%,0,2)
162 ;Std. Long Supply %
163 S %=$S('$G(^TMP($J,2,"VALUE","TOTAL")):0,1:$G(^TMP($J,2,"LONG","TOTAL"))/$G(^TMP($J,2,"VALUE","TOTAL")))
164 I %="" S %=0
165 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,8)=$J(%,0,2)
166 ;ODI Long Supply %
167 S %=$S('$G(^TMP($J,3,"VALUE","TOTAL")):0,1:$G(^TMP($J,3,"LONG","TOTAL"))/$G(^TMP($J,3,"VALUE","TOTAL")))
168 I %="" S %=0
169 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,9)=$J(%,0,2)
170 ;All Long Supply %
171 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,10)=+$G(^TMP($J,1,"CNT","TOTAL"))
172 ;# Std. Items
173 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,11)=+$G(^TMP($J,2,"CNT","TOTAL"))
174 ;# On-Demand Items
175 S $P(^TMP($J,"PRCPSSR5",STA,INV),U,12)=+$G(^TMP($J,3,"CNT","TOTAL"))
176 ;# All Items
177 ;
178 S PRCPDX=$TR(^TMP($J,"PRCPSSR5",STA,INV),"^","*"),DR="7///"_PRCPDX
179 D FILE
180 K Y
181 ;
182 Q
183 ;
184 ;*98 Created filing subroutine
185FILE ; Subroutine that creates entries in File #446.7 fields as they
186 ; are created
187 ;
188 N PRCPDR,PRCPSNM,PRCPDA,PRCPDX,X,Y
189 S PRCPDR=DR
190 S SSRIEN=STA_INV
191 S DIC="^PRCP(446.7,",DIC(0)="L",DLAYGO=446.7,X=SSRIEN D ^DIC K DIC,DLAYGO
192 S PRCPDA=Y+0
193 ;*98 Send enhanced mail message if exception occurs during FileMan set
194 I Y=-1 N PRCPMSG D Q
195 . S PRCPMSG(1)="Error saving to File #446.7 for Stock Status Report, related data: "
196 . S PRCPSNM=$$GET1^DIQ(4,STA_",",.01)
197 . S PRCPMSG(2)="",PRCPMSG(3)="Station: "_STA_" "_PRCPSNM
198 . S PRCPMSG(4)="Inventory Point: "_$P(^TMP($J,"PRCPSSR1",STA,INV),U,4)_" "_$P(^TMP($J,"PRCPSSR1",STA,INV),U,5)
199 . S PRCPMSG(5)="File #446.7 Field Set Attempted: "_PRCPDR
200 . D MAIL^PRCPLO3 Q
201 ;
202 S DIE="^PRCP(446.7,",DA=PRCPDA D ^DIE K DIE,DR,DA
203 ;
204 Q
Note: See TracBrowser for help on using the repository browser.