source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGSCT0.m@ 1261

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

initial load of WorldVistAEHR

File size: 1.5 KB
Line 
1PSGSCT0 ;BIR/CML3-PRINT COST PER SERVICE REPORT ;14 JUL 94 / 9:36 AM
2 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
3START ;
4 D NOW^%DTC S PSGDT=%,PSGPDT=$$ENDTC^PSGMI(PSGDT),CML=IO'=IO(0)!(IOST'["C-"),(NP,LN1,LN2)="",$P(LN1,"-",81)="",$P(LN2,"=",81)="",(TCNT,TCST)=0
5 U IO D HDR I '$D(^UTILITY("PSG",$J)) W !!?23,"*** NO SERVICE COST DATA FOUND ***" G DONE
6 ;
7RUN ;
8 S SN="" F S SN=$O(^UTILITY("PSG",$J,"S",SN)) Q:SN="" S CST=^(SN) D:$Y+3>IOSL NP G:NP["^" DONE D WRITE
9 ;
10 G:'$D(^UTILITY("PSG",$J,"W")) TOTLS D:$Y+3>IOSL NP G:NP["^" DONE W !?9,"*** A SERVICE COULD NOT BE FOUND FOR THE FOLLOWING WARD(S) ***",!
11 S SN="" F S SN=$O(^UTILITY("PSG",$J,"W",SN)) Q:SN="" S CST=^(SN) D:$Y+3>IOSL NP G:NP["^" DONE D WRITE
12 ;
13TOTLS ;
14 D:$Y+5>IOSL NP I NP'["^" S TCPU=$S(TCNT:TCST/TCNT,1:"****") S:TCST<0&(TCPU>0) TCPU=-TCPU W !!,LN2,!!?15,"TOTALS =>",?35,$J(TCNT,9,0),?52,$J(TCST,12,2),?72,$J(TCPU,6,2)
15 ;
16DONE ;
17 W:CML&($Y) @IOF,@IOF K %,CML,CNT,CPU,CST,LN1,LN2,NP,PSGID,PSGOD,PSGPDT,SN,TCNT,TCPU,TCST Q
18 ;
19WRITE ;
20 S CNT=+CST,CST=$P(CST,"^",2),TCNT=TCNT+CNT,TCST=TCST+CST,CPU=$S(CNT:CST/CNT,1:0) S:CST<0&(CPU>0) CPU=-CPU W !?2,SN,?35,$J(CNT,9,0),?52,$J(CST,12,2),?72,$J(CPU,6,2),! Q
21 ;
22NP ;
23 I 'CML W $C(7) R !,"'^' TO STOP ",NP:DTIME W:'$T $C(7) S:'$T NP="^" Q:NP["^"
24 ;
25HDR ;
26 W:$Y @IOF W !!?24,"UNIT DOSE COST PER SERVICE REPORT",?63,PSGPDT,!?25,"FROM ",STRT," THROUGH ",STOP,!!?35,"TOTAL UNITS",?56,"TOTAL",?68,"AVERAGE COST",!?10,"SERVICE",?36,"DISPENSED",?56,"COST",?70,"PER UNIT",!,LN1,! Q
Note: See TracBrowser for help on using the repository browser.