source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSIVPCR.m@ 642

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1PSIVPCR ;BIR/PR,MV-BUILD PROVIDER COST REPORT ;20 JUN 94 / 2:33 PM
2 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
3SUB ;Set sub routine variable
4 S S=$S(I1&(I2):1,'I1&('I2):2,I1&('I2):3,1:4) S:I2["NON" S=$S(I1:5,1:6) S:I2["." S=$S(I1:8,1:7) K ^UTILITY($J),VA
5 ;
6RM1 ;Run report for one IV room
7 I I4 S V=I4 I $D(^PS(50.8,V,2)) F DAT=I7-1:0 S DAT=$O(^PS(50.8,V,2,DAT)) Q:'DAT!(DAT>I8) I $D(^(DAT,2)) S NA="" D @S
8 ;
9RMALL ;Run report for all IV rooms
10 I 'I4 F V=0:0 S V=$O(^PS(50.8,V)) Q:'V I $D(^(V,2)) F DAT=I7-1:0 S DAT=$O(^PS(50.8,V,2,DAT)) Q:'DAT!(DAT>I8) I $D(^(DAT,2)) S NA="" D @S
11 ;
12QUEUE ;Queue
13 I $D(I6) S ZTIO=I6,ZTDESC="IV PROVIDER DRUG COST REPORT (PRINT)",ZTRTN="W^PSIVPCR",ZTDTH=$H F G="^UTILITY($J,","I7","I8","I1","I2","I6","I9","I10","I4","I15","BRIEF" S ZTSAVE(G)=""
14 I S %ZIS="QN",IOP=I6 D ^%ZIS,^%ZTLOAD G K^PSIVPCR1
15 ;
16W ;Enter to print report
17 U IO S PG=0,Y=I7 X ^DD("DD") S H=Y,Y=I8 X ^DD("DD") S H=H_" THROUGH "_Y D H I '$D(^UTILITY($J)) W !,"NO DATA." W:$D(I6)&($Y) @IOF D ^%ZISC G K^PSIVPCR1
18 D P^PSIVPCR1 S:$D(ZTQUEUED) ZTREQ="@"
19 Q
20 ;
211 ;1 p 1 d
22 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" S DA=$O(^(NA,I2,0)) I DA,$D(^PS(50.8,V,2,DAT,2,DA,0)),$D(^(2,I1,0)) S P=I1 D B
23 Q
242 ;Al p al d
25 F DA=0:0 S DA=$O(^PS(50.8,V,2,DAT,2,DA)) Q:'DA I $D(^(DA,0)) F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P I $D(^(P,0)) D B
26 Q
273 ;1 p al d
28 F DA=0:0 S DA=$O(^PS(50.8,V,2,DAT,2,DA)) Q:'DA I $D(^(DA,0)),$D(^(2,I1,0)) S P=I1 D B
29 Q
304 ;Al p 1 d
31 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" S DA=$O(^(NA,I2,0)) I DA F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P D B
32 Q
335 ;1 p n d
34 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" S DA=$O(^(+$O(^(NA,0)),0)) I DA,^(DA)=1,$D(^PS(50.8,V,2,DAT,2,DA,2,I1,0)) S P=I1 D B
35 Q
366 ;Al p n d
37 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" S DA=$O(^(+$O(^(NA,0)),0)) I DA,^(DA)=1,$D(^PS(50.8,V,2,DAT,2,DA,0)) F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P D B
38 Q
397 ;C al p
40 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" F D5=0:0 S D5=$O(^PS(50.8,V,2,DAT,2,"B",NA,D5)) Q:'D5 S DA=$O(^(D5,0)) Q:'DA D:I2["V." 71 I '$D(VA),$D(^PS(50.2,"AD",$P(I2,".",2),D5)) F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P D B
41 Q
4271 ;VA C al p
43 S VA=1
44 I I2["000" S MT=$E(I2,3,4) I $E($P(^PSDRUG(D5,0),U,2),1,2)=MT F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P D B
45 Q:I2["000"
46 I $P(^PSDRUG(D5,0),U,2)=$P(I2,".",2) F P=0:0 S P=$O(^PS(50.8,V,2,DAT,2,DA,2,P)) Q:'P D B
47 Q
488 ;C 1 p
49 F J=0:0 S NA=$O(^PS(50.8,V,2,DAT,2,"B",NA)) Q:NA="" F D5=0:0 S D5=$O(^PS(50.8,V,2,DAT,2,"B",NA,D5)) Q:'D5 S DA=$O(^(D5,0)) Q:'DA D:I2["V." 81 I '$D(VA),$D(^PS(50.2,"AD",$P(I2,".",2),D5)),$D(^PS(50.8,V,2,DAT,2,DA,2,I1,0)) S P=I1 D B
50 Q
5181 ;VA C 1 p
52 S VA=1
53 I I2["000" S MT=$E(I2,3,4) I $E($P(^PSDRUG(D5,0),U,2),1,2)=MT,$D(^PS(50.8,V,2,DAT,2,DA,2,I1,0)) S P=I1 D B
54 Q:I2["000"
55 I $P(^PSDRUG(D5,0),U,2)=$P(I2,".",2),$D(^PS(50.8,V,2,DAT,2,DA,2,I1,0)) S P=I1 D B
56 Q
57B ;
58 S P1=$S('$D(^VA(200,+P,0)):"?",$P(^(0),"^")]"":$P(^(0),"^"),1:"?")
59 S G=^PS(50.8,V,2,DAT,2,DA,0),G2=^PS(50.8,V,2,DAT,2,DA,2,P,0),DG=$P(G,U),CO=$P(G,U,5),UM=$P(G,U,6),UD=$P(G2,U,2),UR=$P(G2,U,3),DES=$P(G2,U,4),UC=$P(G2,U,5)
60 S J=$S($D(^UTILITY($J,V,P1,DG)):^(DG),1:CO_U_UM),^(DG)=$P(J,U,1,2)_U_($P(J,U,3)+UD)_U_(UD-UR-UC*CO+$P(J,U,4))_U_($P(J,U,5)+UR)_U_($P(J,U,6)+DES)_U_($P(J,U,7)+UC)
61 Q
62H ;
63 S PG=PG+1 W:$Y @IOF
64 I $D(BRIEF) D HBRIEF Q
65 W !?56,"PROVIDER DRUG COST REPORT (REGULAR):",?120,"PAGE:",PG,!?56,H
66 W !?56,I9,!?56,I10,!?56,I15
67 W !!!?1,"PROVIDER",?36,"DISPENSED",?56,"DESTROYED",?73,"RECYCLED",?97,"CANCELLED",?128,"COST",! F I=1:1:132 W "=" I I=132 W !
68 Q
69HBRIEF ;
70 W !?20,"PROVIDER DRUG COST REPORT (CONDENSED):",?70,"PAGE:",PG,!?20,H
71 W !?20,I9,!?20,I10,!?20,I15
72 W !!!?1,"PROVIDER",?53,"TOTAL COST",! F I=1:1:80 W "="
73 Q
Note: See TracBrowser for help on using the repository browser.