[613] | 1 | PSDBAL ;BIR/JPW-Display/Print Current Drug Balance ; 29 Aug 94
|
---|
| 2 | ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
|
---|
| 3 | I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
|
---|
| 4 | I '$D(^XUSEC("PSJ RPHARM",DUZ))&('$D(^XUSEC("PSD TECH",DUZ))) W !!,"Contact your Pharmacy Coordinator for access to display current CS drug",!,"balances.",!!,"PSJ RPHARM or PSD TECH security key required.",! Q
|
---|
| 5 | ASKD ;ask disp location
|
---|
| 6 | S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
|
---|
| 7 | G:$P(PSDSITE,U,5) CHKD
|
---|
| 8 | K DIC,DA S DIC=58.8,DIC(0)="QEAZ",DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S($P(^(0),""^"",2)[""M"":1,$P(^(0),""^"",2)[""S"":1,1:0)"
|
---|
| 9 | S DIC("A")="Select Primary Dispensing Site: "
|
---|
| 10 | S DIC("B")=PSDSN
|
---|
| 11 | D ^DIC K DIC G:Y<0 END
|
---|
| 12 | S PSDS=+Y,PSDSN=$P(Y,"^",2),$P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
|
---|
| 13 | CHKD I '$O(^PSD(58.8,PSDS,1,0)) W !!,"There are no CS stocked drugs for your dispensing vault.",!! G END
|
---|
| 14 | W !!,?5,"You may select a single drug, several drugs,",!,?5,"or enter ^ALL to select all drugs.",!!
|
---|
| 15 | DRUG ;ask drug
|
---|
| 16 | W ! K DA,DIC
|
---|
| 17 | F S DIC("W")="W:$P(^PSDRUG(Y,0),""^"",9) "" N/F"" I $P(^PSD(58.8,PSDS,1,Y,0),""^"",14)]"""",$P(^(0),""^"",14)'>DT W $C(7),"" *** INACTIVE ***""",DA(1)=+PSDS,DIC(0)="QEAM",DIC="^PSD(58.8,"_PSDS_",1," D ^DIC K DIC Q:Y<0 D
|
---|
| 18 | .S PSDR(+Y)=""
|
---|
| 19 | I '$D(PSDR)&(X'="^ALL") G END
|
---|
| 20 | I X="^ALL" S ALL=1
|
---|
| 21 | DEV ;sel device
|
---|
| 22 | S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
|
---|
| 23 | W ! K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")=PSDEV D ^%ZIS I POP W !!,"NO DEVICE SELECTED OR REPORT PRINTED!!",! G END
|
---|
| 24 | I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDBAL",ZTDESC="CS PHARM List Stock Balances" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
|
---|
| 25 | U IO
|
---|
| 26 | START ;entry for compile
|
---|
| 27 | K ^TMP("PSDBAL",$J)
|
---|
| 28 | I $D(ALL) F PSD=0:0 S PSD=$O(^PSD(58.8,+PSDS,1,PSD)) Q:'PSD I $D(^PSD(58.8,+PSDS,1,PSD,0)) S PSDR(+PSD)=""
|
---|
| 29 | F PSD=0:0 S PSD=$O(PSDR(PSD)) Q:'PSD I $D(^PSD(58.8,+PSDS,1,PSD,0)) S NODE=^(0) D
|
---|
| 30 | .S PSDOK="" I +$P(NODE,"^",14),+$P(NODE,"^",14)'>DT Q:'+$P(NODE,"^",4) S PSDOK="*"
|
---|
| 31 | .S BAL=+$P(NODE,"^",4),PSDRN=$S($P($G(^PSDRUG(+PSD,0)),"^")]"":$P(^(0),"^"),1:"ZZ/"_PSD_" NAME MISSING"),EXP=$S(+$P(NODE,"^",12):+$P(NODE,"^",12),1:"")
|
---|
| 32 | .I EXP S Y=EXP X ^DD("DD") S EXP=Y
|
---|
| 33 | .S ^TMP("PSDBAL",$J,PSDRN,PSD)=BAL_"^"_PSDOK_"^"_EXP
|
---|
| 34 | PRINT ;prints data
|
---|
| 35 | S (PG,PSDOUT)=0 D NOW^%DTC S Y=+$E(%,1,12) X ^DD("DD") S RPDT=Y
|
---|
| 36 | K LN S $P(LN,"-",80)="" D HDR
|
---|
| 37 | I '$D(^TMP("PSDBAL",$J)) W !!,?15,"**** NO STOCK BALANCE DATA AVAILABLE ****",!! G DONE
|
---|
| 38 | S PSDR="" F S PSDR=$O(^TMP("PSDBAL",$J,PSDR)) Q:PSDR=""!(PSDOUT) F PSD=0:0 S PSD=$O(^TMP("PSDBAL",$J,PSDR,PSD)) Q:'PSD D
|
---|
| 39 | .D:$Y+4>IOSL HDR Q:PSDOUT
|
---|
| 40 | .S NODE=^TMP("PSDBAL",$J,PSDR,PSD),BAL=+NODE,PSDOK=$P(NODE,"^",2),EXP=$P(NODE,"^",3)
|
---|
| 41 | .W !,PSDOK,?2,PSDR,?63,$J(BAL,6),! W:EXP]"" ?5,"Expiration Date: ",EXP,!
|
---|
| 42 | DONE I $E(IOST)'="C" W @IOF
|
---|
| 43 | I $E(IOST,1,2)="C-",'PSDOUT W ! K DIR,DIRUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR K DIR
|
---|
| 44 | END ;
|
---|
| 45 | K %,%H,%I,%ZIS,ALL,BAL,C,DA,DIC,DTOUT,DUOUT,EXP,LN,NODE,PG,POP,PSD,PSDEV,PSDOK,PSDOUT,PSDR,PSDRN,PSDS,PSDSN,RPDT,X,Y
|
---|
| 46 | K ^TMP("PSDBAL",$J),ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
|
---|
| 47 | D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
|
---|
| 48 | Q
|
---|
| 49 | SAVE S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDSITE"))=""
|
---|
| 50 | S:$D(ALL) ZTSAVE("ALL")="" S:$D(PSDR) ZTSAVE("PSDR(")=""
|
---|
| 51 | Q
|
---|
| 52 | HDR ;header
|
---|
| 53 | I $E(IOST,1,2)="C-",PG K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
|
---|
| 54 | S PG=PG+1 W:$Y @IOF W !,?12,"Current Stock Balances for ",PSDSN,?72,"Page: ",PG,!,?20,RPDT,!!
|
---|
| 55 | W ?5,"DRUG",?60,"CURRENT BALANCE",!,LN,!!
|
---|
| 56 | Q
|
---|