source: FOIAVistA/tag/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRPI10.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1RMPRPI10 ;HIN/RVD-PRINT ITEM DETAIL OVER 30 DAYS ;3/8/05 11:40
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^RMPRPI10",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 ..I 'RMDAU S RMDOH=">"_RMCALDAY
90 ..S RMDAU=$J(RMDAU,0,3)
91 ..S RMTDV=$P(RM3,U,6)
92 ..I '$D(RMPRFLG) D HEAD1
93 ..S RMIDE=$E(J,1,13)
94 ..W !,RH_"-"_RMIT,?10,RMIDE,?24,$J(RMQTY,4),?29,$J($FN(RMCOS,",",2),9),?42,RMDAU,?54,$J(RMDOH,4)
95 ..W ?61,$J(RMSOH,5),?70,$J($FN(RMTDV,",",2),10)
96 ..S RMPRFLG=1
97 ..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
98 ..I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 Q
99 W !,RMPR("L"),!,"<End of Report>"
100 Q
101 ;
102HEAD W !,"*** STOCK ON HAND OVER DATE RANGE ***"," for ",RSOU," Items"
103 W !,"Station: ",$E($P($G(^DIC(4,RS,0)),U,1),1,20),?30,"Run Date: ",RMDAT
104 W ?68,"PAGE: ",RMPAGE
105 W !,RMBDAT," to ",RMEDAT,?30,"[ ",RMCALDAY," calendar days ]"
106 S RMPAGE=RMPAGE+1
107 Q
108 ;
109HEAD1 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
110 I $E(IOST)'["C",($Y>(IOSL-6)) W @IOF D HEAD
111 W !,RMPR("L")
112 W !,"Location: ",$P($G(^RMPR(661.5,RL,0)),"^",1)
113 W !,?25,"QTY",?35,"$",?41,"DAYS AVE"
114 W ?54,"DAYS",?62,"STOCK",?72,"TOTAL $"
115 W !,"HCPCS",?10,"ITEM",?24,"ISSUE",?33,"VALUE"
116 W ?40,"USAGE RATE",?52,"ON-HAND",?61,"ON-HAND",?70,"VAL ON-HND"
117 W !,"-----",?10,"----",?24,"-----",?33,"-----"
118 W ?40,"----------",?52,"-------",?61,"-------",?70,"----------"
119 S RMPRFLG=1
120 Q
121 ;
122EXIT I $E(IOST)["C",'RMPREND W ! S DIR(0)="E" D ^DIR
123 ;
124EXIT1 D ^%ZISC
125 N RMPR,RMPRSITE D KILL^XUSCLEAN
126 K ^TMP($J)
127 Q
128 ;
129NONE ;
130 W:$E(IOST)["C" @IOF
131 D HEAD
132 W !,RMPR("L")
133 W !!,"NO DATA to print !!!"
134 Q
Note: See TracBrowser for help on using the repository browser.