source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPRSP6.m@ 824

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1RMPRSP6 ;HIN/RVD-PRINT 2319 WITH SUSPENSE LINK ;8/27/01
2 ;;3.0;PROSTHETICS;**62**;Feb 09, 1996
3 ;RVD 8/27/01 patch #62 - PCE data print
4 ;
5 D DIV4^RMPRSIT I $D(Y),(Y<0) Q
6 ; Prompt for Start Date
7STDT ;RMPRSDT is start date in FM internal form.
8 K %DT,X,Y
9 S %DT("A")="Starting Date: "
10 S %DT(0)=-DT
11 S %DT="AEP"
12 D ^%DT I Y<0 G EXIT1
13 S RMPRSDT=$P(Y,".",1)
14 S %DT("A")="Ending Date: ",%DT="AEX" D ^%DT G:Y<0 EXIT1
15 S RMPREDT=$P(Y,".",1)
16 I RMPRSDT>RMPREDT W !,$C(7),"Invalid Date Range Selection!!" G STDT
17 ;
18CONT G:'$D(RMPRSDT) EXIT1 S %ZIS="MQ" K IOP D ^%ZIS G:POP EXIT1 I '$D(IO("Q")) U IO G PRINT
19 K IO("Q") S ZTDESC="PROSTHETIC PATIENT RECORDS WITH SUSPENSE",ZTRTN="PRINT^RMPRSP6",ZTIO=ION,ZTSAVE("RMPRSDT")=""
20 S ZTSAVE("RMPR(""STA"")")="",ZTSAVE("RMPR(")="",ZTSAVE("RMPREDT")=""
21 D ^%ZTLOAD W:$D(ZTSK) !,"REQUEST QUEUED!" H 1 G EXIT
22 ;
23PRINT I $E(IOST)["C" W !!,"Processing report......."
24 K ^TMP($J)
25 K %DT,X,Y
26 S X="NOW" D ^%DT S RMDATE=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)
27 S RMPAGE=1,(RMTOBAL,RMPREND)=0,RS=RMPR("STA")
28 S RDT=RMPRSDT-1,RET=RMPREDT+1,RS=RMPR("STA")
29 S Y=RMPRSDT D DD^%DT S RMSDAT=Y
30 S Y=RMPREDT D DD^%DT S RMEDAT=Y
31 D BUILD
32 I '$D(^TMP($J)) D HEAD,NONE G EXIT
33 D HEAD,HEAD1
34 D WRITE
35 G EXIT
36 ;
37BUILD ;build a tmp global.
38 S RMPR("ROUTINE")=0
39 S RMPR("EYEGLASS")=0
40 S RMPR("CONTACT")=0
41 S RMPR("OXYGEN")=0
42 S RMPR("MANUAL")=0
43 F RI=RDT:0:RET S RI=$O(^RMPR(660,"B",RI)) Q:(RI'>0)!(RMPREND)!(RI>RMPREDT) F RJ=0:0 S RJ=$O(^RMPR(660,"B",RI,RJ)) Q:(RJ'>0) D
44 .S RM0=$G(^RMPR(660,RJ,0))
45 .S RM10=$G(^RMPR(660,RJ,10))
46 .Q:$P(RM10,U,14)'>0
47 .I $P(RM0,U,10)=RS D
48 ..S RMDFN=$P(RM0,U,2)
49 ..S RMITIEN=$P(RM0,U,6)
50 ..S (RMITEM,RMPAT)=""
51 ..I RMITIEN,($D(^RMPR(661,RMITIEN,0))),($D(^PRC(441,$P(^RMPR(661,RMITIEN,0),U,1),0))) D
52 ...S RMITEM=$P(^PRC(441,$P(^RMPR(661,RMITIEN,0),U,1),0),U,2)
53 ..S RMITEM=$E(RMITEM,1,18)
54 ..I $D(^DPT(RMDFN,0)) S RMPAT=$E($P(^DPT(RMDFN,0),U,1),U,10)
55 ..S RMINIE=$P(RM0,U,27)
56 ..I RMINIE,$D(^VA(200,RMINIE,0)) S RMINI=$E($P(^VA(200,RMINIE,0),U,1),1,10)
57 ..E S RMINI=""
58 ..S RMSUSP=$P(RM10,U,1)
59 ..S RMRXDT=$P(RM10,U,2)
60 ..S RMIADT=$P(RM10,U,3)
61 ..S RCDT=$P(RM10,U,4)
62 ..S RMTYRE=$P(RM10,U,5)
63 ..S RMSURE=$P(RM10,U,6)
64 ..S RMPRDI=$P(RM10,U,7)
65 ..S RMICD9=$P(RM10,U,8)
66 ..S RMCOSU=$P(RM10,U,9)
67 ..S RMSUST=$P(RM10,U,11)
68 ..S RMPCEP=$P(RM10,U,12)
69 ..S RPDT=$P(RM10,U,13)
70 ..D SUMTYP
71 ..I RMICD9,($D(^ICD9(RMICD9,0))) S RMICD=$P(^ICD9(RMICD9,0),U,1)
72 ..E S RMICD=""
73 ..S:RMTYRE'="" RMTYRE=$E(RMTYRE,1,8)
74 ..I RMSURE,($D(^VA(200,RMSURE,0))) S RMSURE=$E($P(^VA(200,RMSURE,0),U,1),1,10)
75 ..S RDDT=$E(RI,4,5)_"/"_$E(RI,6,7)_"/"_$E(RI,2,3)
76 ..S:RPDT'="" RPDT=$E(RPDT,4,5)_"/"_$E(RPDT,6,7)_"/"_$E(RPDT,2,3)
77 ..S:RCDT'="" RCDT=$E(RCDT,4,5)_"/"_$E(RCDT,6,7)_"/"_$E(RCDT,2,3)
78 ..S ^TMP($J,RI,RMPAT,RJ)=RMITEM_"^"_RDDT_"^"_RMTYRE_"^"_RMSURE_"^"_RMINI_"^"_RPDT_"^"_$E(RMPRDI,1,10)
79 Q
80 ;
81WRITE ;write report to a selected device
82 S (RI,RM,RMPREND)=0
83 F S RI=$O(^TMP($J,RI)) Q:(RI'>0)!(RMPREND) S RJ="" F S RJ=$O(^TMP($J,RI,RJ)) Q:(RJ="")!(RMPREND) F S RM=$O(^TMP($J,RI,RJ,RM)) Q:(RM'>0)!(RMPREND) D
84 .S RMDAT=$G(^TMP($J,RI,RJ,RM))
85 .S RMPAT=RJ
86 .S RMITEM=$P(RMDAT,U,1)
87 .S RDDT=$P(RMDAT,U,2)
88 .S RMTYRE=$P(RMDAT,U,3)
89 .S RMSURE=$P(RMDAT,U,4)
90 .S RMINI=$P(RMDAT,U,5)
91 .S RPDT=$P(RMDAT,U,6)
92 .S RMPRDI=$E($P(RMDAT,U,7),1,12)
93 .W !,RDDT,?10,RMPAT,?21,RMITEM,?40,RMTYRE,?50,RMSURE,?68,RMINI
94 .S RMPRFLG=1
95 .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
96 .I $Y>(IOSL-6) W @IOF D HEAD,HEAD1 K RMPRFLG Q
97 W !,RMPR("L")
98 W !,"Totals:",?10,"Routine Prosthetics = ",$J(RMPR("ROUTINE"),5)
99 W ?40,"Eyeglass = ",$J(RMPR("EYEGLASS"),5)
100 W ?59,"Contact Lens = ",$J(RMPR("CONTACT"),5)
101 W !,?17," Oxygen = ",$J(RMPR("OXYGEN"),5)
102 W ?42,"Manual = ",$J(RMPR("MANUAL"),5)
103 W !,"<End of Report>"
104 Q
105 ;
106HEAD W !,"PROSTHETICS PATIENT RECORDS LINKED TO SUSPENSE Run Date: ",RMDATE,?70,"PAGE: ",RMPAGE
107 W !,"Start Date: ",RMSDAT,?26,"End Date: ",RMEDAT,?51,"station: ",$E($P($G(^DIC(4,RS,0)),U,1),1,19)
108 S RMPAGE=RMPAGE+1
109 Q
110 ;
111HEAD1 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
112 I $E(IOST)'["C"&($Y>(IOSL-6)) W @IOF D HEAD
113 W !,RMPR("L")
114 W !?40,"TYPE OF",?52,"CPRS"
115 W !,"DATE",?10,"PATIENT",?21,"ITEM",?40,"REQUEST",?50,"REQUESTOR",?68,"INITIATOR"
116 W !,"----",?10,"-------",?21,"----",?40,"-------",?50,"---------",?68,"---------"
117 S RMPRFLG=1
118 Q
119 ;
120EXIT I $E(IOST)["C",'RMPREND K DIR S DIR(0)="E" D ^DIR
121EXIT1 D ^%ZISC
122 K ^TMP($J)
123 N RMPR,RMPRSITE D KILL^XUSCLEAN
124 Q
125 ;
126SUMTYP ;get total of each type of request
127 S:RMTYRE["ROUTINE" RMPR("ROUTINE")=RMPR("ROUTINE")+1
128 S:RMTYRE["EYEGLASS" RMPR("EYEGLASS")=RMPR("EYEGLASS")+1
129 S:RMTYRE["CONTACT" RMPR("CONTACT")=RMPR("CONTACT")+1
130 S:RMTYRE["OXYGEN" RMPR("OXYGEN")=RMPR("OXYGEN")+1
131 S:RMTYRE["MANUAL" RMPR("MANUAL")=RMPR("MANUAL")+1
132 Q
133 ;
134NONE W !!,"NO DATA TO PRINT !!!!!"
135 Q
Note: See TracBrowser for help on using the repository browser.