PSXCSDC2 ;BIR/JMB-Drug Cost by Drug Report-CONTINUED ;[ 04/08/97 2:06 PM ]
;;2.0;CMOP;;11 Apr 97
SUBDV ;Division total line
W !,PSXSLN,!,"DIVISION TOTAL",?PSXT1,$J($P(PSXSUB(PSXDV),"^"),6),?PSXT2,$J($P(PSXSUB(PSXDV),"^",2),6),?PSXT3,$J($P(PSXSUB(PSXDV),"^",3),6),?PSXT4,$J($P(PSXSUB(PSXDV),"^",4),10,2),?PSXT5
S PSXAVG=$S($P(PSXSUB(PSXDV),"^",3)=0:0,1:$P(PSXSUB(PSXDV),"^",4)/$P(PSXSUB(PSXDV),"^",3)) W $J(PSXAVG,10,2)
S PSXAVCST=$P(PSXSUB(PSXDV),"^",4)/$P(PSXSUB(PSXDV),"^",5) W ?PSXT6,$J(PSXAVCST,8,3)
Q
SUB ;Facility total line
Q:+$G(PSXSPDV) S PSXTOT=1 D:'$D(PSXID) HD^PSXCSDC1 S PSXTOT="0^0^0^0^0^",PSXX="" F S PSXX=$O(PSXSUB(PSXX)) Q:PSXX="" D
.S $P(PSXTOT,"^")=$P(PSXTOT,"^")+$P(PSXSUB(PSXX),"^"),$P(PSXTOT,"^",2)=$P(PSXTOT,"^",2)+$P(PSXSUB(PSXX),"^",2),$P(PSXTOT,"^",3)=$P(PSXTOT,"^",3)+$P(PSXSUB(PSXX),"^",3),$P(PSXTOT,"^",4)=$P(PSXTOT,"^",4)+$P(PSXSUB(PSXX),"^",4)
.S $P(PSXTOT,"^",5)=$P(PSXTOT,"^",5)+$P(PSXSUB(PSXX),"^",5)
.W:'$D(PSXID) !,PSXX,?PSXT1,$J($P(PSXSUB(PSXX),"^"),6),?PSXT2,$J($P(PSXSUB(PSXX),"^",2),6),?PSXT3,$J($P(PSXSUB(PSXX),"^",3),6),?PSXT4,$J($P(PSXSUB(PSXX),"^",4),10,2),?PSXT5
.I '$D(PSXID) S PSXAVG=$S($P(PSXSUB(PSXX),"^",3)=0:0,1:$P(PSXSUB(PSXX),"^",4)/$P(PSXSUB(PSXX),"^",3)) W $J(PSXAVG,10,2)
.I '$D(PSXID) S PSXAVCST=$P(PSXSUB(PSXX),"^",4)/$P(PSXSUB(PSXX),"^",5) W ?PSXT6,$J(PSXAVCST,8,3) K PSXAVCST
W !,PSXSLN,!,"FACILITY TOTAL",?PSXT1,$J($P(PSXTOT,"^"),6),?PSXT2,$J($P(PSXTOT,"^",2),6)
W ?PSXT3,$J($P(PSXTOT,"^",3),6),?PSXT4,$J($P(PSXTOT,"^",4),10,2),?PSXT5 S PSXAVG=$S($P(PSXTOT,"^",3)=0:0,1:$P(PSXTOT,"^",4)/$P(PSXTOT,"^",3)) W $J(PSXAVG,10,2)
S PSXAVCST=$P(PSXTOT,"^",4)/$P(PSXTOT,"^",5) W ?PSXT6,$J(PSXAVCST,8,3)
Q
PSXCSDC2 ;BIR/JMB-Drug Cost by Drug Report-CONTINUED ;[ 04/08/97 2:06 PM ]
+1 ;;2.0;CMOP;;11 Apr 97
SUBDV ;Division total line
+1 WRITE !,PSXSLN,!,"DIVISION TOTAL",?PSXT1,$JUSTIFY($PIECE(PSXSUB(PSXDV),"^"),6),?PSXT2,$JUSTIFY($PIECE(PSXSUB(PSXDV),"^",2),6),?PSXT3,$JUSTIFY($PIECE(PSXSUB(PSXDV),"^",3),6),?PSXT4,$JUSTIFY($PIECE(PSXSUB(PSXDV),"^",4),10,2),?PSXT5
+2 SET PSXAVG=$SELECT($PIECE(PSXSUB(PSXDV),"^",3)=0:0,1:$PIECE(PSXSUB(PSXDV),"^",4)/$PIECE(PSXSUB(PSXDV),"^",3))
WRITE $JUSTIFY(PSXAVG,10,2)
+3 SET PSXAVCST=$PIECE(PSXSUB(PSXDV),"^",4)/$PIECE(PSXSUB(PSXDV),"^",5)
WRITE ?PSXT6,$JUSTIFY(PSXAVCST,8,3)
+4 QUIT
SUB ;Facility total line
+1 IF +$GET(PSXSPDV)
QUIT
SET PSXTOT=1
IF '$DATA(PSXID)
DO HD^PSXCSDC1
SET PSXTOT="0^0^0^0^0^"
SET PSXX=""
FOR
SET PSXX=$ORDER(PSXSUB(PSXX))
IF PSXX=""
QUIT
Begin DoDot:1
+2 SET $PIECE(PSXTOT,"^")=$PIECE(PSXTOT,"^")+$PIECE(PSXSUB(PSXX),"^")
SET $PIECE(PSXTOT,"^",2)=$PIECE(PSXTOT,"^",2)+$PIECE(PSXSUB(PSXX),"^",2)
SET $PIECE(PSXTOT,"^",3)=$PIECE(PSXTOT,"^",3)+$PIECE(PSXSUB(PSXX),"^",3)
SET $PIECE(PSXTOT,"^",4)=$PIECE(PSXTOT,"^",4)+$PIECE(PSXSUB(PSXX),"^",4)
+3 SET $PIECE(PSXTOT,"^",5)=$PIECE(PSXTOT,"^",5)+$PIECE(PSXSUB(PSXX),"^",5)
+4 IF '$DATA(PSXID)
WRITE !,PSXX,?PSXT1,$JUSTIFY($PIECE(PSXSUB(PSXX),"^"),6),?PSXT2,$JUSTIFY($PIECE(PSXSUB(PSXX),"^",2),6),?PSXT3,$JUSTIFY($PIECE(PSXSUB(PSXX),"^",3),6),?PSXT4,$JUSTIFY($PIECE(PSXSUB(PSXX),"^",4),10,2),?PSXT5
+5 IF '$DATA(PSXID)
SET PSXAVG=$SELECT($PIECE(PSXSUB(PSXX),"^",3)=0:0,1:$PIECE(PSXSUB(PSXX),"^",4)/$PIECE(PSXSUB(PSXX),"^",3))
WRITE $JUSTIFY(PSXAVG,10,2)
+6 IF '$DATA(PSXID)
SET PSXAVCST=$PIECE(PSXSUB(PSXX),"^",4)/$PIECE(PSXSUB(PSXX),"^",5)
WRITE ?PSXT6,$JUSTIFY(PSXAVCST,8,3)
KILL PSXAVCST
End DoDot:1
+7 WRITE !,PSXSLN,!,"FACILITY TOTAL",?PSXT1,$JUSTIFY($PIECE(PSXTOT,"^"),6),?PSXT2,$JUSTIFY($PIECE(PSXTOT,"^",2),6)
+8 WRITE ?PSXT3,$JUSTIFY($PIECE(PSXTOT,"^",3),6),?PSXT4,$JUSTIFY($PIECE(PSXTOT,"^",4),10,2),?PSXT5
SET PSXAVG=$SELECT($PIECE(PSXTOT,"^",3)=0:0,1:$PIECE(PSXTOT,"^",4)/$PIECE(PSXTOT,"^",3))
WRITE $JUSTIFY(PSXAVG,10,2)
+9 SET PSXAVCST=$PIECE(PSXTOT,"^",4)/$PIECE(PSXTOT,"^",5)
WRITE ?PSXT6,$JUSTIFY(PSXAVCST,8,3)
+10 QUIT