source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPI08.m@ 1742

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1RMPRPI08 ;HIN/RVD-PRINT ITEM DETAIL BY LOCATION ;3/8/05 11:37
2 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
3 ; DBIA #10090 - Read Access to entire file #4.
4 ; DBIA #10096 - Access to all %ZOSF nodes.
5 ;
6 K DIC,DIR,%DT
7 D DIV4^RMPRSIT I $D(Y),(Y<0) Q
8 S X="NOW" D ^%DT D DD^%DT S RMDAT=Y
9 ;
10EN K RMPRI,RMPRFLG S RMPREND=0 D HOME^%ZIS
11 S DIC="^RMPR(661.5,",DIC(0)="AEQ"
12 S DIC("S")="I $P(^RMPR(661.5,+Y,0),U,2)=RMPR(""STA"")"
13 ;
14EN1 R !!,"Enter 'ALL' for all Locations or 'RETURN' to select individual Locations: ",RMENTER:DTIME G:$D(DTOUT)!$D(DUOUT)!(RMENTER="^") EXIT1
15 G:RMENTER["?" EN1
16 S X=RMENTER X ^%ZOSF("UPPERCASE") S RMENTER=Y
17 I RMENTER="ALL" S RMPRI="*" G CONT
18 W ! F RML=1:1 S DIC("A")="Select Location "_RML_": " D ^DIC G:$D(DTOUT)!(X["^")!(X=""&(RML=1)) EXIT1 Q:X="" D
19 .S RMLOCI=+Y
20 .I $D(RMPRI(RMLOCI)) W $C(7)," ??",?40,"..Duplicate Location" S RML=RML-1 Q
21 .S RMPRI(RMLOCI)=""
22 ;
23CONT ;
24 K DIR
25 S DIR("B")="NEW Items",DIR("A")="Enter a SOURCE Creteria"
26 S DIR(0)="S^V:OLD Items;C:NEW Items"
27 D ^DIR G:$D(DUOUT)!$D(DIRUT)!$D(DTOUT) EXIT1
28 S RE=Y K DIR
29 ;
30DT ;
31 W ! S %DT("A")="Beginning Date: ",%DT="AEPX",%DT("B")="T-30" D ^%DT S RMB=Y G:Y<0 EXIT1
32ENDATE S %DT("A")="Ending Date: ",%DT="AEX",%DT("B")="TODAY" D ^%DT G:Y<0 EXIT1 I RMB>Y W !,$C(7),"Invalid Date Range Selection!!" G ENDATE
33 S RME=Y
34 ;
35 G:'$D(RMPRI) EXIT1 S %ZIS="MQ" K IOP D ^%ZIS G:POP EXIT1
36 I '$D(IO("Q")) U IO G PRINT
37 K IO("Q") S ZTDESC="PROSTHETIC INVENTORY LOCATION SUMMARY"
38 S ZTRTN="PRINT^RMPRPI08",ZTIO=ION,ZTSAVE("RMPRI(")=""
39 S ZTSAVE("RMPR(""STA"")")="",ZTSAVE("RMDAT")="",ZTSAVE("RMPR(")=""
40 S ZTSAVE("RE")="",ZTSAVE("RMPRI")=""
41 S ZTSAVE("RME")="",ZTSAVE("RMB")=""
42 D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EXIT1
43 ;
44PRINT I $E(IOST)["C" W !!,"Processing report....."
45 ;
46 ;call API
47 ;input variables:
48 ; RM = any subscript to be used
49 ; RS = rmpr("sta")
50 ; RE = source (V or C)
51 ; RMPRI = rmpri(location array; '*' for all location )
52 ; RMB = beginning date
53 ; RME = ending date
54 ;
55 S X1=RME,X2=RMB
56 D ^%DTC S RMCALDAY=X+1
57 S Y=RMB D DD^%DT S RMBDAT=Y S Y=RME D DD^%DT S RMEDAT=Y
58 D NOW^%DTC S Y=% X ^DD("DD") S RMDAT=Y
59 S RSOU=$S(RE="V":"USED",RE="C":"NEW",1:"")
60 S RS=RMPR("STA"),RM="RM"
61 ;
62 S RMCHK=$$LOC^RMPRPI07(RM,RS,.RMPRI,RE,RMB,RME)
63 I RMCHK W !!,"ERROR NUMBER = ",RMCHK,!,"***Error in API RMPRPI07 !!!!",!! G EXIT
64 ;
65 S RMPAGE=1,RMPREND=0
66 I '$D(^TMP($J,"RM")) D NONE G EXIT
67 W:$E(IOST)["C" @IOF
68 D HEAD,WRI
69 G EXIT
70 ;
71 ;write/print report
72 ;rl = Location
73 ;rh = HCPCS
74 ;j = Item
75 ;k = Item description
76 ;
77 ;
78WRI S RL=""
79 F S RL=$O(^TMP($J,"RM",RL)) Q:(RL="")!(RMPREND) K RMPRFLG S RH="" F S RH=$O(^TMP($J,"RM",RL,RH)) Q:(RH="")!(RMPREND) S J="" D
80 .F S J=$O(^TMP($J,"RM",RL,RH,J)) Q:(J="")!(RMPREND) S K="" F S K=$O(^TMP($J,"RM",RL,RH,J,K)) Q:(K="")!(RMPREND) D
81 ..S RM3=^TMP($J,"RM",RL,RH,J,K)
82 ..S RMIT=K
83 ..S RMQTY=$P(RM3,U,1)
84 ..S RMCOS=$P(RM3,U,2)
85 ..S RMDAU=RMQTY/RMCALDAY
86 ..S RMDOH=""
87 ..S RMSOH=$P(RM3,U,5)
88 ..S:+RMDAU RMDOH=$J(RMSOH/RMDAU,0,1) S:RMDOH>999 RMDOH=">999"
89 ..S RMDAU=$J(RMDAU,0,3)
90 ..S RMTDV=$P(RM3,U,6)
91 ..I '$D(RMPRFLG) D HEAD1
92 ..S RMIDE=$E(J,1,13)
93 ..W !,RH_"-"_RMIT,?10,RMIDE,?24,$J(RMQTY,4),?29,$J($FN(RMCOS,",",2),9),?42,RMDAU,?54,$J(RMDOH,4)
94 ..W ?61,$J(RMSOH,5),?70,$J($FN(RMTDV,",",2),10)
95 ..S RMPRFLG=1
96 ..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
97 ..I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 Q
98 W !,RMPR("L"),!,"<End of Report>"
99 Q
100 ;
101HEAD W !,"*** DETAIL ITEM USAGE BY LOCATION ***"," for ",RSOU," Items"
102 W !,"Station: ",$E($P($G(^DIC(4,RS,0)),U,1),1,20),?30,"Run Date: ",RMDAT
103 W ?68,"PAGE: ",RMPAGE
104 W !,RMBDAT," to ",RMEDAT,?30,"[ ",RMCALDAY," calendar days ]"
105 S RMPAGE=RMPAGE+1
106 Q
107 ;
108HEAD1 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
109 I $E(IOST)'["C",($Y>(IOSL-6)) W @IOF D HEAD
110 W !,RMPR("L")
111 W !,"Location: ",$P($G(^RMPR(661.5,RL,0)),"^",1)
112 W !,?25,"QTY",?35,"$",?41,"DAYS AVE"
113 W ?54,"DAYS",?62,"STOCK",?72,"TOTAL $"
114 W !,"HCPCS",?10,"ITEM",?24,"ISSUE",?33,"VALUE"
115 W ?40,"USAGE RATE",?52,"ON-HAND",?61,"ON-HAND",?70,"VAL ON-HND"
116 W !,"-----",?10,"----",?24,"-----",?33,"-----"
117 W ?40,"----------",?52,"-------",?61,"-------",?70,"----------"
118 S RMPRFLG=1
119 Q
120 ;
121EXIT I $E(IOST)["C",'RMPREND W ! S DIR(0)="E" D ^DIR
122 ;
123EXIT1 D ^%ZISC
124 N RMPR,RMPRSITE D KILL^XUSCLEAN
125 K ^TMP($J)
126 Q
127 ;
128NONE ;
129 W:$E(IOST)["C" @IOF
130 D HEAD
131 W !,RMPR("L")
132 W !!,"NO DATA to print !!!"
133 Q
Note: See TracBrowser for help on using the repository browser.