Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSGSCT0

PSGSCT0.m

Go to the documentation of this file.
PSGSCT0 ;BIR/CML3-PRINT COST PER SERVICE REPORT ;14 JUL 94 / 9:36 AM
 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
START ;
 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
 U IO D HDR I '$D(^UTILITY("PSG",$J)) W !!?23,"*** NO SERVICE COST DATA FOUND ***" G DONE
 ;
RUN ;
 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
 ;
 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) ***",!
 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
 ;
TOTLS ;
 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)
 ;
DONE ;
 W:CML&($Y) @IOF,@IOF K %,CML,CNT,CPU,CST,LN1,LN2,NP,PSGID,PSGOD,PSGPDT,SN,TCNT,TCPU,TCST Q
 ;
WRITE ;
 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
 ;
NP ;
 I 'CML W $C(7) R !,"'^' TO STOP ",NP:DTIME W:'$T $C(7) S:'$T NP="^" Q:NP["^"
 ;
HDR ;
 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