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

PSOMGMN1.m

Go to the documentation of this file.
PSOMGMN1 ;BHAM ISC/JMB - MONTHLY MANAGEMENT PRESCRIPTION COUNTS REPORT ; 1/30/93
 ;;7.0;OUTPATIENT PHARMACY;**14,444**;DEC 1997;Build 34
EN S (CNT,PG)=0 D:ANS="A" PRI D:ANS="S" DV W:ANS="S" @IOF Q
ENQ S CNT=0 I ANS="A" D PRI,PRI^PSOMGMN2,PRI^PSOMGMN3
 I ANS="S" S PG=0 D DV S (CNT,PG)=0 D EN^PSOMGMN2 S (CNT,PG)=0 D EN^PSOMGMN3
 D ^PSOMGMN4 Q
RPT W:CNT @IOF S PG=PG+1,CNT=CNT+1 U IO W !!?30,"O U T P A T I E N T   P H A R M A C Y   M A N A G E M E N T   R E P O R T",!?56,"PRESCRIPTION COUNTS",?112,"PAGE ",PG
 W !!?45,"FROM "_$E(SDT,4,5)_"/"_$E(SDT,2,3),?60,"TO "_$E(EDT,4,5)_"/"_$E(EDT,2,3)_"      "_$S('PRT:"DIVISION: "_$P(^PS(59,DIV,0),"^"),1:"ALL DIVISIONS")
 W !!?9 F K=1:1:15 W $J($P("^^^TOT^30^60^90^>90^EQ^^TOT^TOT^MED^RX/^EQ FL/","^",K),8)
 W !,"DATE",?9 F K=1:1:15 W $J($P("CAT A^CAT C^OTH^CAT^DAY^DAY^DAY^DAY^FLS^METH^RX^EQ FL^REQ^REQ^REQ","^",K),8)
 W ! F K=1:1:129 W "="
 Q
PRI S T1="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0",CNT=0,PG=0 F DIV=0:0 S DIV=$O(^PS(59,DIV)) Q:'DIV  D DV
 D TOT
 Q
DV S (BEG,PRT)=0 D RPT S S1(DIV)="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0" F PDATE=SDT-1:0 S PDATE=$O(^PS(59.12,PDATE)) D:$Y+6>IOSL RPT D:'PDATE!(PDATE>EDT) SUB Q:'PDATE!(PDATE>EDT)  D
 .S DVMN=DIV_"^"_$E(PDATE,1,5) S:'BEG PRV=DIV_"^"_$E(PDATE,1,5),M1(DVMN)="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0",BEG=1 I DVMN'=PRV D MON S PRV=DIV_"^"_$E(PDATE,1,5),M1(DVMN)="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0"
 .Q:'$G(^PS(59.12,PDATE,1,DIV,0))
 .D:$G(^PS(59.12,PDATE,1,DIV,0))'=DIV_"^0^0^0^0^0^0^0^^0^0^0^0^0^0^0^0^0" LN
 I ANS="S" W !!!?17,"FINISHED PRINTING ON: " D NOW^%DTC S Y=% X ^DD("DD") W Y W:RUN="A"&(ANS="S") @IOF
 Q
LN F K=2:1:16 D
 .S $P(M1(DVMN),"^",K)=$P(M1(DVMN),"^",K)+$P(^PS(59.12,PDATE,1,DIV,0),"^",K)
 .S $P(S1(DIV),"^",K)=$P(S1(DIV),"^",K)+$P(^PS(59.12,PDATE,1,DIV,0),"^",K) S:$D(T1) $P(T1,"^",K)=$P(T1,"^",K)+$P(^PS(59.12,PDATE,1,DIV,0),"^",K)
 Q
MON ;PRINT MONTHLY TOTALS
 W !,$E($P(PRV,"^",2),4,5)_"/"_$E($P(PRV,"^",2),2,3),?9 F K=2:1:14 W $J($P(M1(PRV),"^",K),8)
 W $J($S($P(M1(PRV),"^",12)=0!($P(M1(PRV),"^",14)=0):0,1:$P(M1(PRV),"^",12)/$P(M1(PRV),"^",14)),8,2)
 W $J($S($P(M1(PRV),"^",13)=0!($P(M1(PRV),"^",14)=0):0,1:$P(M1(PRV),"^",13)/$P(M1(PRV),"^",14)),8,2)
 Q
SUB ;PRINT SUB TOTALS
 I 'PRT D MON W !?9 F K=1:1:15 W $J("=======",8)
 W !,$S('PRT:"DIV TOTAL",1:$E($P(^PS(59,DIV,0),"^"),1,8)),?9 F K=2:1:14 W $J($P(S1(DIV),"^",K),8)
 W $J($S($P(S1(DIV),"^",12)=0!($P(S1(DIV),"^",14)=0):0,1:$P(S1(DIV),"^",12)/$P(S1(DIV),"^",14)),8,2)
 W $J($S($P(S1(DIV),"^",13)=0!($P(S1(DIV),"^",14)=0):0,1:$P(S1(DIV),"^",13)/$P(S1(DIV),"^",14)),8,2)
 Q
TOT ;PRINT GRAND TOTALS
 S PRT=1 D RPT F DIV=0:0 S DIV=$O(^PS(59,DIV)) Q:'DIV  D SUB
 W !?9 F K=1:1:15 W $J("=======",8)
 W !,"GR TOTAL",?9 F K=2:1:14 W $J($P(T1,"^",K),8)
 W $J($S($P(T1,"^",12)=0!($P(T1,"^",14)=0):0,1:$P(T1,"^",12)/$P(T1,"^",14)),8,2)
 W $J($S($P(T1,"^",13)=0!($P(T1,"^",14)=0):0,1:$P(T1,"^",13)/$P(T1,"^",14)),8,2)
 W !!!?17,"FINISHED PRINTING ON: " D NOW^%DTC S Y=% X ^DD("DD") W Y W:RUN'="A" @IOF
 Q