PSOCST11 ;BHAM ISC/SAB - DRUG COSTS BY CLINIC ; 12/22/92 15:58
;;7.0;OUTPATIENT PHARMACY;**10,31**;DEC 1997
BEG S RP=11 D HDC^PSOCSTX F D CDT^PSOCSTX Q:$G(CTR) D CLN Q:$G(CTR) S RP=0 D CTP^PSOCSTX Q:$G(CTR) I RP=0 D DEV Q
D EX Q
CLN D CMC^PSOCSTX Q:$G(CTR)
I IFN S DIC(0)="AEQM",DIC="^SC(",DIC("A")="Select Clinic: " D ^DIC K DIC S:Y<0 CTR=1 Q:$G(CTR) S IFN=1,CLA=+Y
Q
DEV D DVC^PSOCSTX Q:$G(CTR)
K PSOION I $D(IO("Q")) S ZTDESC="DRUG COST BY CLINIC",ZTRTN="START^PSOCST11" D PAS^PSOCSTX
I K IO("Q") D ^%ZTLOAD W:$D(ZTSK) !,"REPORT QUEUED TO PRINT !!",! D EX Q
START U IO K ^TMP($J) F PSDT=(BEGDATE-1):0:ENDDATE S PSDT=$O(^PSCST(PSDT)) Q:'PSDT!(PSDT>ENDDATE) D @$S('IFN:"ACL",1:"SCL")
D ZER^PSOCSTX S CLAX="" D HD I $O(^TMP($J,CLAX))']"" D HDN^PSOCSTX Q
F S CLAX=$O(^TMP($J,CLAX)) Q:CLAX="" D HD:($Y+4)>IOSL Q:$G(CTR) S Y=^TMP($J,CLAX),TTX=CLAX D PRT^PSOCSTX
D HD:($Y+2)>IOSL D FTX^PSOCSTX
EX D EX^PSOCSTX Q
ACL F CLA=0:0 S CLA=$O(^PSCST(PSDT,"S",CLA)) Q:'CLA D SCL
Q
SCL I $D(^PSCST(PSDT,"S",CLA,0)) S X=^(0) D STORE
Q
STORE Q:'$D(^SC(CLA,0)) S CLAX=$P(^(0),"^") S:'$D(^TMP($J,CLAX)) ^TMP($J,CLAX)="^0^0^0" S UTL=^(CLAX),^TMP($J,CLAX)="^"_($P(UTL,"^",2)+$P(X,"^",2))_"^"_($P(UTL,"^",3)+$P(X,"^",3))_"^"_($P(UTL,"^",4)+$P(X,"^",4))
Q
HD D HD^PSOCSTX Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOCST11 1298 printed Dec 13, 2024@02:26:10 Page 2
PSOCST11 ;BHAM ISC/SAB - DRUG COSTS BY CLINIC ; 12/22/92 15:58
+1 ;;7.0;OUTPATIENT PHARMACY;**10,31**;DEC 1997
BEG SET RP=11
DO HDC^PSOCSTX
FOR
DO CDT^PSOCSTX
if $GET(CTR)
QUIT
DO CLN
if $GET(CTR)
QUIT
SET RP=0
DO CTP^PSOCSTX
if $GET(CTR)
QUIT
IF RP=0
DO DEV
QUIT
+1 DO EX
QUIT
CLN DO CMC^PSOCSTX
if $GET(CTR)
QUIT
+1 IF IFN
SET DIC(0)="AEQM"
SET DIC="^SC("
SET DIC("A")="Select Clinic: "
DO ^DIC
KILL DIC
if Y<0
SET CTR=1
if $GET(CTR)
QUIT
SET IFN=1
SET CLA=+Y
+2 QUIT
DEV DO DVC^PSOCSTX
if $GET(CTR)
QUIT
+1 KILL PSOION
IF $DATA(IO("Q"))
SET ZTDESC="DRUG COST BY CLINIC"
SET ZTRTN="START^PSOCST11"
DO PAS^PSOCSTX
+2 IF $TEST
KILL IO("Q")
DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !,"REPORT QUEUED TO PRINT !!",!
DO EX
QUIT
START USE IO
KILL ^TMP($JOB)
FOR PSDT=(BEGDATE-1):0:ENDDATE
SET PSDT=$ORDER(^PSCST(PSDT))
if 'PSDT!(PSDT>ENDDATE)
QUIT
DO @$SELECT('IFN:"ACL",1:"SCL")
+1 DO ZER^PSOCSTX
SET CLAX=""
DO HD
IF $ORDER(^TMP($JOB,CLAX))']""
DO HDN^PSOCSTX
QUIT
+2 FOR
SET CLAX=$ORDER(^TMP($JOB,CLAX))
if CLAX=""
QUIT
if ($Y+4)>IOSL
DO HD
if $GET(CTR)
QUIT
SET Y=^TMP($JOB,CLAX)
SET TTX=CLAX
DO PRT^PSOCSTX
+3 if ($Y+2)>IOSL
DO HD
DO FTX^PSOCSTX
EX DO EX^PSOCSTX
QUIT
ACL FOR CLA=0:0
SET CLA=$ORDER(^PSCST(PSDT,"S",CLA))
if 'CLA
QUIT
DO SCL
+1 QUIT
SCL IF $DATA(^PSCST(PSDT,"S",CLA,0))
SET X=^(0)
DO STORE
+1 QUIT
STORE if '$DATA(^SC(CLA,0))
QUIT
SET CLAX=$PIECE(^(0),"^")
if '$DATA(^TMP($JOB,CLAX))
SET ^TMP($JOB,CLAX)="^0^0^0"
SET UTL=^(CLAX)
SET ^TMP($JOB,CLAX)="^"_($PIECE(UTL,"^",2)+$PIECE(X,"^",2))_"^"_($PIECE(UTL,"^",3)+$PIECE(X,"^",3))_"^"_($PIECE(UTL,"^",4)+$PIECE(X,"^",4))
+1 QUIT
HD DO HD^PSOCSTX
QUIT