source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPR5HQ2.m@ 1036

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

initial load of WorldVistAEHR

File size: 7.4 KB
Line 
1RMPR5HQ2 ;HCIOFO/RVD - ITEM & HCPCS USAGE REPORT ; 15 AUG 00
2 ;;3.0;PROSTHETICS;**51**;Feb 09, 1996
3 ;
4MANUAL ;run the USAGE report manually. User needs to enter the month the
5 ;report should be ran.
6 N RLN,RMPAGE,R5,REQ,RSL,RMTVAL,RMTCOML,RMTDLEL,RMTUSEL,RHCPC,RMTVAH
7 N RMTUSEG,RMTVAG,RMTCOMG,RMTQOHG,RMTVALG,RMGVAL,RGCNT,RLCNT,RSCNT,RFL
8 N RLINE,RGRP,RST,RI,RST,RJ,RK,RGRP,RDAT,RMBD,RMED,RPR,RMARRAY,RMTUSEH
9 N RMTQOHNL,RMTQOHUL,RMTISNL,RMTISUL,RMTVALNL,RMTVALUL,RMTAVELU
10 N RMTQOHNG,RMTQOHUG,RMTISNG,RMTISUG,RMTVALNG,RMTVALUG,RMTCOMH,RMTISUH,RMTISNH
11 N RMTVALUH,RMTVALNH,RMTQOHUH,RMTQOHNH,RMTDLEH,RMTDLEG,RMTAVEG,RMGTOT
12 N RTAVEGA,RTAVEGC,RTDLEGA,RTDLEGC,RTUSEGA,RTUSEGC,RMGTIU,RMGTIN
13 N RTAVELA,RTAVELC,RTDLELA,RTDLELC,RTUSELA,RTUSELC,RMTUSELU,RMTUSELN
14 N RTAVEHA,RTAVEHC,RTDLEHA,RTDLEHC,RTUSEHA,RTUSEHC,RMCALDAY,RMTAVELN
15 ;
16 S X1=RMPREDT,X2=RMPRSDT
17 D ^%DTC S RMCALDAY=X+1
18 S Y=RMPRSDT D DD^%DT S RMBD=Y S Y=RMPREDT D DD^%DT S RMED=Y
19 D NOW^%DTC S Y=% X ^DD("DD") S RMRDATE=Y
20 S $P(RLN,"-",IOM)="",RMPAGE=0,R5="RMPR5"
21 S $P(REQ,"=",IOM)=""
22 S (RMTVAL,RMTCOML,RMTDLEL,RMTUSEL,RMTAVEG,RMGTOT,RMTUSELU,RMGISNG,RMGISUG)=0
23 S (RMTQOHNL,RMTQOHUL,RMTISNL,RMTISUL,RMTVALNL,RMTVALUL,RMTAVELU,RMTUSELN)=0
24 S (RMTQOHNG,RMTQOHUG,RMTISNG,RMTISUG,RMTVALNG,RMTVALUG,RMTISUH,RMTISNH)=0
25 S (RMTUSEG,RMTVAG,RMTCOMG,RMGTOU,RMGTON,RMTVAH,RMTCOMH,RMTVALUH,RMTVALNH,RMTQOHUH)=0
26 S (RMGVAL,RGCNT,RLCNT,RSCNT,RFL,RPRINT,RMTQOHNH,RMTUSEH,RMTDLEH)=0
27 S (RTAVEGA,RTAVEGC,RTDLEGA,RTDLEGC,RTUSEGA,RTUSEGC,RMGTIU,RMGTIN)=0
28 S (RTAVELA,RTAVELC,RTDLELA,RTDLELC,RTUSELA,RTUSELC,RMTAVELN)=0
29 S (RTAVEHA,RTAVEHC,RTDLEHA,RTDLEHC,RTUSEHA,RTUSEHC)=0
30 S (RLINE,RGRP,RST,RNPGRP,RNPLINE,RHCPC,RMTDLEG)=""
31 D GRPARY^RMPR5HQ4(.RMARRAY)
32 ;
33ITEM ;entry point for Item Detail Usage report
34 G:RMPRDET="I" DQ1
35 ;
36HCPCS ;entry point for HCPCS Summary Usage report.
37 I RMPRDET="H" D ^RMPR5HQH G TOT
38LINE ;entry point for NPPD LINE Usage report.
39 I RMPRDET="L" D ^RMPR5HQL G TOT
40 ;
41GROUP ;entry point for NPPD GROUP Usage report.
42 I RMPRDET="G" D ^RMPR5HQG
43 G CLEAN1
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45 ;
46DQ1 ;print PIP Report (Item Detail Usage report).
47 ;$O the ^TMP( global for all the records
48 ;print all records based on the sort criteria given.
49 I IOST["C-" W @IOF
50 ;
51 F RST=0:0 S RST=$O(^TMP($J,R5,RST)) Q:RST'>0 S RSTN=$$STN^RMPR5HQL(RST),RPR=0 F RI=0:0 S RI=$O(^TMP($J,R5,RST,RI)) Q:$G(RFL) Q:RI'>0 D
52 .D:RPR=0 HDRI
53 .S RNPGRP=RMARRAY(RI)
54 .S RJ=""
55 .F S RJ=$O(^TMP($J,R5,RST,RI,RJ)) Q:$G(RFL) D:(RLINE'="")&(RLINE'=RJ) SUML1 Q:RJ="" D
56 ..S RLINE=RJ,RNPLINE=$$NPLIN^RMPR5HQ5(RJ)
57 ..I RGCNT=0 S RGCNT=RGCNT+1
58 ..S RK="" F S RK=$O(^TMP($J,R5,RST,RI,RJ,RK)) Q:$G(RFL)!(RK="") D
59 ...S RL=""
60 ...F S RL=$O(^TMP($J,R5,RST,RI,RJ,RK,RL)) Q:$G(RFL)!(RL="") D
61 ....S RHCPC=$P(RK,"/",1)
62 ....S:RMPRDET="I" RHCPC=RHCPC_"-"_RL
63 ....S RNPITEM=$$GETITEM^RMPR5HQ5($P(RK,"/",2),RL)
64 ....I RLCNT=0 D GLN1
65 ....S RLCNT=RLCNT+1
66 ....S RDAT=^TMP($J,R5,RST,RI,RJ,RK,RL)
67 ....S RMVA=$P(RDAT,U,1)
68 ....S RMCOM=$P(RDAT,U,2)
69 ....S RMUSE=$P(RDAT,U,3)
70 ....S RMISU=$P(RDAT,U,4)
71 ....S RMISN=$P(RDAT,U,5)
72 ....S RMAVEN=$P(RDAT,U,6)
73 ....S RMDLEN=$P(RDAT,U,7)
74 ....S RMQOHU=$P(RDAT,U,8)
75 ....S RMQOHN=$P(RDAT,U,9)
76 ....S RMVALU=$P(RDAT,U,10)
77 ....S RMVALN=$P(RDAT,U,11)
78 ....S RMAVEU=$P(RDAT,U,12)
79 ....S RMDLEU=$P(RDAT,U,13)
80 ....S RMDLEU=$S(RMDLEU>999:">999",1:$J(RMDLEU,7,0))
81 ....S RMDLEN=$S(RMDLEN>999:">999",1:$J(RMDLEN,7,0))
82 ....S:(RMVA<1)&(RMVALU>0) RMDLEU=">"_RMCALDAY
83 ....S:(RMCOM<1)&(RMVALN>0) RMDLEN=">"_RMCALDAY
84 ....;total for line item
85 ....S RMTVAL=RMTVAL+RMVA
86 ....S RMTCOML=RMTCOML+RMCOM
87 ....S:RMVA'="" RMTUSELU=RMTUSELU+RMVA
88 ....S:RMCOM'="" RMTUSELN=RMTUSELN+RMCOM
89 ....S RMTISUL=RMTISUL+RMISU
90 ....S RMTISNL=RMTISNL+RMISN
91 ....;S RMTAVELU=RMTAVELU+RMAVEU
92 ....;S RMTAVELN=RMTAVELN+RMAVEN
93 ....S RMTQOHUL=RMTQOHUL+RMQOHU
94 ....S RMTQOHNL=RMTQOHNL+RMQOHN
95 ....S RMTVALUL=RMTVALUL+RMVALU
96 ....S RMTVALNL=RMTVALNL+RMVALN
97 ....;total for group
98 ....S RMTVAG=RMTVAG+RMVA
99 ....S RMTCOMG=RMTCOMG+RMCOM
100 ....S RMTUSEG=RMTUSEG+RMVA
101 ....S RMTISUG=RMTISUG+RMISU
102 ....S RMTISNG=RMTISNG+RMISN
103 ....S RMTQOHUG=RMTQOHUG+RMQOHU
104 ....S RMTQOHNG=RMTQOHNG+RMQOHN
105 ....S RMTVALUG=RMTVALUG+RMVALU
106 ....S RMTVALNG=RMTVALNG+RMVALN
107 ....S RMGTOU=RMGTOU+RMVALU
108 ....S RMGTON=RMGTON+RMVALN
109 ....S RMGTIU=RMGTIU+RMISU
110 ....S RMGTIN=RMGTIN+RMISN
111 ....S:'RMISU RMISU=""
112 ....S:'RMISN RMISN=""
113 ....S RMVALU=$FN(RMVALU,",",2) S:'RMVALU RMVALU=""
114 ....S RMVALN=$FN(RMVALN,",",2) S:'RMVALN RMVALN=""
115 ....S:RMVA="" RMVA=0 S:RMISU="" RMISU=0 S:RMCOM="" RMCOM=0
116 ....S:RMISN="" RMISN=0
117 ....;for used item
118 ....W:$G(RMVA)!$G(RMVALU) !,RHCPC,?10,$E(RNPITEM,1,15),?26,$J(RMVA,5),?33,$J($FN(RMISU,",",2),7),?40,"|",?59,"|",?60,$J(RMVA,5),?67,"|",?71,$J(RMAVEU,5,2),?78,"|",?81,$J(RMQOHU,5)
119 ....W:$G(RMVA)!$G(RMVALU) ?94,"|",?96,$J(RMDLEU,7),?103,"|",?104,$J(RMVALU,11)
120 ....;for new item
121 ....W:$G(RMCOM)!$G(RMVALN) !,RHCPC,?10,$E(RNPITEM,1,15),?40,"|",?41,$J(RMCOM,4),?49,$J($FN(RMISN,",",2),9),?59,"|",?60,$J(RMCOM,5),?67,"|",?71,$J(RMAVEN,5,2),?78,"|"
122 ....W:$G(RMCOM)!$G(RMVALN) ?87,$J(RMQOHN,6),?94,"|",?96,$J(RMDLEN,7),?103,"|",?116,$J(RMVALN,11)
123 ....S (RPRINT,RPR)=1
124 ....I $Y+8>IOSL,IOST["C-" K DIR S DIR(0)="E" D ^DIR S:+Y'>0 RFL=1 Q:+Y'>0 W @IOF D HDRI,LBL1
125 ....I $Y+8>IOSL,IOST'["C-" W @IOF D HDRI,LBL1
126 ;print total for Used and New items (all report type)
127TOT G:$G(RFL) CLEAN1
128 I '$G(RPRINT) W !!,"No Records to Print !!" G CLEAN1
129 W !!,?10,"GRAND TOTAL $ VALUE ISSUED (Used) = ",?38,"$",$J($FN(RMGTIU,",",2),10)
130 W ?80,"GRAND TOTAL $ VALUE ON-HAND (Used) = ",?115,"$",$J($FN(RMGTOU,",",2),12)
131 W !,?10,"GRAND TOTAL $ VALUE ISSUED (New) = ",?38,"$",$J($FN(RMGTIN,",",2),10)
132 W ?80,"GRAND TOTAL $ VALUE ON-HAND (New) = ",?115,"$",$J($FN(RMGTON,",",2),12)
133 W !,"<End of Report>"
134 ;
135CLEAN1 ; Clean and EXITS program.
136 I $E(IOST)["C",'$D(DUOUT) K DIR S DIR(0)="E" D ^DIR
137 I $D(ZTQUEUED) S ZTREQ="@" Q
138 D ^%ZISC
139 N RMPR,RMPRSITE
140 D KILL^XUSCLEAN
141 K ^TMP($J)
142 Q
143 ;
144HDRI ;print heading.
145 Q:$G(RFL)
146 S RMPAGE=RMPAGE+1
147 W !,"PROSTHETIC INVENTORY ITEM DETAIL REPORT",?50,"Run Date: ",RMRDATE,?100,"Page: ",RMPAGE
148 W !,"STATION: ",$E(RSTN,1,20)
149 W ?32,RMBD," - ",RMED," [ ",RMCALDAY," calendar days ]"
150 Q
151 ;
152LBL1 ;print column header.
153 Q:$G(RFL)
154 W !,RLN
155 W:RMPRDET="I" !,"HCPCS PSAS/ITEM"
156 W:RMPRDET="H" !,"HCPCS DESCRIPTION"
157 W:RMPRDET="L" !,"NPPD LINE"
158 W:RMPRDET="G" !,"NPPD GROUP"
159 W ?23,"V.A.(Used) Total| COM. (New) Total| Total |Days Ave | Stock On-Hand| Days |Total $ Value On-Hand"
160 W !,?23,"Issue $ Value| Issue $ Value| Issue |Usage Rate| Used New | On-Hand| Used New"
161 W:RMPRDET'="G" !,RLN
162 Q
163 ;
164GLN1 ;print NPPD GROUP and LINE header.
165 Q:$G(RFL)
166 W !!,RJ," ",RNPLINE," [",RNPGRP," ]"
167 D LBL1
168 Q
169 ;
170SUML1 ;print summary total for NPPD LINE
171 Q:$G(RFL)
172 W !,REQ
173 S:$G(RMTUSELU) RMTAVELU=RMTUSELU/RMCALDAY
174 S:$G(RMTUSELN) RMTAVELN=RMTUSELN/RMCALDAY
175 ;S:RMTDLEL>999 RMTDLEL=">999"
176 ;next two lines print used total
177 W !,?5,"(Used)",?26,$J(RMTVAL,5),?34,$J($FN(RMTISUL,",",2),6),?40,"|",?59,"|",?60,$J(RMTUSELU,5),?67,"|",?71,$J(RMTAVELU,5,2),?78,"|"
178 W ?81,$J(RMTQOHUL,5),?94,"|",?103,"|",?104,$J($FN(RMTVALUL,",",2),11)
179 ;next two lines print new total
180 W !,?5,"(New)",?40,"|",?41,$J(RMTCOML,4),?49,$J($FN(RMTISNL,",",2),9),?59,"|",?60,$J(RMTUSELN,5),?67,"|",?71,$J(RMTAVELN,5,2),?78,"|"
181 W ?87,$J(RMTQOHNL,6),?94,"|",?103,"|",?116,$J($FN(RMTVALNL,",",2),11)
182 S (RMTVAL,RMTISUL,RMTCOML,RMTISNL,RMTUSEL,RMTAVELU,RMTAVELN,RMTQOHUL,RMTQOHNL,RMTVALUL,RMTVALNL,RLCNT,RMTUSELU,RMTUSELN)=0
183 S (RNPLINE,RLINE)=""
184 Q
Note: See TracBrowser for help on using the repository browser.