source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPI04.m@ 1476

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1RMPRPI04 ;HIN/RVD-PROS STOCK ITEM RECORDS ;3/8/05 11:24
2 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
3 ; DBIA #10090 - Read Access to entire file #4.
4 ;
5 D DIV4^RMPRSIT I $D(Y),(Y<0) Q
6 S RS=RMPR("STA")
7 ;
8EN K ^TMP($J),RMPRI,RMPRFLG S RMPREND=0 D HOME^%ZIS
9 S DIC="^RMPR(661.1,",DIC(0)="AEQM"
10 F HCPCS=1:1 S DIC("A")="Select HCPCS "_HCPCS_": " D ^DIC G:$D(DTOUT)!(X["^")!(X=""&(HCPCS=1)) EXIT1 Q:X="" D
11 .Q:'$D(^RMPR(661.1,+Y,0)) S RMHCPC=$P(^RMPR(661.1,+Y,0),U,1)
12 .I $D(RMPRI(RMHCPC)) W $C(7)," ??",?40,"..Duplicate HCPCS" S HCPCS=HCPCS-1 Q
13 .S:RMHCPC'="" RMPRI(RMHCPC)=+Y
14 S RMPRCOUN=0 W !! S %DT("A")="Beginning Date: ",%DT="AEPX"
15 S %DT("B")="T-30" D ^%DT S RMPRBDT=Y G:Y<0 EXIT1
16 ;
17ENDATE S %DT("A")="Ending Date: ",%DT="AEX",%DT("B")="TODAY" D ^%DT
18 G:Y<0 EXIT1
19 I RMPRBDT>Y W !,$C(7),"Invalid Date Range Selection!!" G ENDATE
20 G:Y<0 EXIT S RMPREDT=Y,Y=RMPRBDT D DD^%DT S RMPRX=Y,Y=RMPREDT
21 D DD^%DT S RMPRY=Y
22 S %ZIS="MQ" K IOP D ^%ZIS G:POP EXIT
23 I '$D(IO("Q")) U IO G PRINT
24 K IO("Q") S ZTDESC="STOCK ITEM REPORT",ZTRTN="PRINT^RMPRPI04",ZTIO=ION
25 S ZTSAVE("RMPRBDT")="",ZTSAVE("RMPREDT")="",ZTSAVE("RMPRI(")=""
26 S ZTSAVE("RMPRX")="",ZTSAVE("RMPRY")="",ZTSAVE("RMPR(""STA"")")=""
27 S ZTSAVE("RMPR(")=""
28 D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EXIT1
29 ;
30 ;Entry point for printing report.
31PRINT I $E(IOST)["C" W @IOF,!!,"Processing report......"
32 I '$D(RMPRI) D NONEALL G EXIT
33 ;call API
34 ;input variables:
35 ; RM = 'RM' subscript
36 ; RS = station
37 ; RMPRI = array of HCPCS
38 ; RMPRBDT = beginning date
39 ; RMPREDT = ending date
40 ;
41 S RS=RMPR("STA"),RM="RM"
42 S RMCHK=$$THIS^RMPRPI03(RM,RS,RMPRBDT,RMPREDT,.RMPRI)
43 I RMCHK W !!,"ERROR NUMBER = ",RMCHK,!,"*** Error in API RMPRPI03 !!!" G EXIT
44 ;
45 S RMBDATE=$E(RMPRBDT,4,5)_"/"_$E(RMPRBDT,6,7)_"/"_$E(RMPRBDT,2,3)
46 S RMPAGE=1
47 S (RMPREND,RP,QTYT,RMIFL,RMCO,RMTOCO,RMTOCOH,RMSTAFL,RMSUF,RMQTYT)=0
48 D HEAD
49 S RQ="" F S RQ=$O(RMPRI(RQ)) Q:RQ="" I '$D(^TMP($J,"RM",RQ)) D NONE
50 D WRI
51 W !,"<End of Report>"
52 ;
53EXIT ;exit here if report prints in home device.
54 I $E(IOST)["C",'$D(DUOUT),'$G(RMPREND) K DIR S DIR(0)="E" D ^DIR
55 ;
56EXIT1 ;close device and clean-up variables.
57 D ^%ZISC
58 N RMPR,RMPRSITE D KILL^XUSCLEAN
59 K ^TMP($J)
60 Q
61 ;end of processing (exit program)
62 ;
63 ; RH = HCPCS
64 ; RI = HCPCS ITEM NAME
65 ; R2 = ITEM NUMBER
66 ; R3 =SEQUENCE
67 ;
68WRI S (RMFH,RMFI,RMPRFLG,RMTOCO,RMTOCOH,RMTOCOI)=0
69 S (RMITEM,RH)=""
70 F S RH=$O(^TMP($J,"RM",RH)) D:RMFH HTOTAL D:RH'="" HEAD1 Q:RH="" S (RIT2,RI)="" F S RI=$O(^TMP($J,"RM",RH,RI)) Q:RI="" D
71 .F R2=0:0 S R2=$O(^TMP($J,"RM",RH,RI,R2)) D:RMFI ITOTAL Q:(R2'>0)!(RMPREND) D:RIT2'=R2 IHEAD F R3=0:0 S R3=$O(^TMP($J,"RM",RH,RI,R2,R3)) Q:(R3'>0)!(RMPREND) D
72 ..S RDATA=^TMP($J,"RM",RH,RI,R2,R3)
73 ..S RMDAT=$P(RDATA,U,1),RMTIM=$P(RDATA,U,2),RMOPE=$P(RDATA,U,3)
74 ..S RMCLO=$P(RDATA,U,4),RMQTY=$P(RDATA,U,5)
75 ..S RMVAL=$P(RDATA,U,6),RMTRA=$P(RDATA,U,7),RMPAT=$P(RDATA,U,8)
76 ..S RMSSN=$P(RDATA,U,9),RMUSE=$E($P(RDATA,U,10),1,10)
77 ..S RMITE=$P(RDATA,U,11)
78 ..S RMAVCO=$P(RDATA,U,11) S:RMAVCO'="" RMCO=RMAVCO*RMQTY
79 ..S RIT2=R2
80 ..I 'RMPRFLG D HEAD1
81 ..S (RMFH,RMFI)=1
82 ..W !,RMDAT
83 ..I RMPAT'="" D
84 ...W ?9,$E(RMPAT,1,14),?26,$P(RMSSN,"-",3),?31,RMUSE,?45,$J(RMQTY,4)
85 ...W ?69,$J(RMVAL,9,2)
86 ..I RMTRA="PATIENT ISSUE" S RMTOCO=RMTOCO+RMVAL
87 ..I RMTRA="RETURN IN" S RMTOCO=RMTOCO-RMVAL
88 ..I RMPAT="" D
89 ...W:RMTRA="RECEIPT" ?9,"**Note: ",RMTRA,?31,RMUSE,?60,$J(RMQTY,4),?69,$J(RMVAL,9,2)
90 ...W:RMTRA="ORDER" ?9,"**Note: ",RMTRA,?31,RMUSE,?54,$J(RMQTY,4),?69,$J(RMVAL,9,2)
91 ...I (RMTRA'="RECEIPT"),(RMTRA'="ORDER") W ?9,"**Note: ",RMTRA,?31,RMUSE,?45,$J(RMQTY,4),?69,$J(RMVAL,9,2)
92 ..S RMPRFLG=1
93 ..I $E(IOST)["C"&($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD,HEAD1 Q
94 ..I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 S RMPRFLG=1
95 Q
96 ;
97HEAD ;print headers
98 W !,"*** ISSUE and STOCK CONTROL RECORD - PROSTHETICS STOCK ITEMS ***"
99 W ?65,"Page: ",RMPAGE,!,?30,"station: "
100 W $E($P($G(^DIC(4,RMPR("STA"),0)),U,1),1,20)
101 N X,% S Y=RMPRBDT D DD^%DT W !,Y," to " S Y=RMPREDT D DD^%DT W Y
102 S RMPAGE=RMPAGE+1
103 Q
104 ;
105IHEAD S RMDAHC=$O(^RMPR(661.1,"B",RH,0))
106 S RMITEM=$E(RMITEM,1,26)
107 W !,"HCPCS: ",RH,"-",R2,?16,"Item: ",RI
108 S RMI=1
109 Q
110 ;
111HEAD1 ;write column headers
112 I $E(IOST)["C"&($Y>(IOSL-7)) S DIR(0)="E" D ^DIR S:$D(DTOUT)!(Y=0) RMPREND=1 Q:RMPREND W @IOF D HEAD
113 W !,RMPR("L")
114 W !,?45,"QTY",?54,"QTY",?61,"QTY",?72,"DOLLAR"
115 W !," DATE",?9,"PATIENT",?26,"SSN",?31,"USER",?44,"ISSUE"
116 W ?53,"ORDER",?61,"REC",?72,"VALUE"
117 W !," ----",?9,"-------",?26,"---",?31,"----",?44,"-----"
118 W ?53,"-----",?61,"---",?72,"------"
119 S RMPRFLG=1
120 Q
121 ;
122HTOTAL ;
123 I RMFH,'RMPREND D
124 .W !!,?23,"*** Dollar Value of HCPCS Issued",?60,"="
125 .W ?60,$J(RMTOCOH,10,2)
126 S (RMTOCOH,RMFH)=0
127 Q
128 ;
129ITOTAL ;prints totals.
130 I RMFI,'RMPREND D
131 .W !,?42,"--------------------------------------",!
132 .W ?23,"*** Dollar Value of Item Issued",?60,"=",?60,$J(RMTOCO,10,2)
133 S RMTOCOH=RMTOCOH+RMTOCO,(RMTOCO,RMCO,RMFI)=0
134 Q
135 ;
136NONE ;nothing to report.
137 W !,RMPR("L"),!,"No Item Statistics for HCPCS: "
138 W RQ,"...for this date range !!!"
139 Q
140 ;
141NONEALL W !!,"NO DATA AT THIS DATE RANGE!!!!"
142 Q
Note: See TracBrowser for help on using the repository browser.