PSDRWK ;BIR/JPW-Reprint Pharm Disp. Worksheet ;12/14/99 16:40
;;3.0; CONTROLLED SUBSTANCES ;**20,69**;13 Feb 97;Build 13
;
; Reference to XUSEC( supported by DBIA # 10076
; Reference to DD(58.8 supported by DBIA # 10154
; Reference to DD("DD" supported by DBIA # 10017
; Reference to PSDRUG( supproted by DBIA # 221
; Reference to VA(200 supported by DBIA # 10060
; Reference to PSD(58.8 supported by DBIA # 2711
;
I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
S OK=$S($D(^XUSEC("PSJ RPHARM",DUZ)):1,$D(^XUSEC("PSJ PHARM TECH",DUZ)):1,$D(^XUSEC("PSD TECH ADV",DUZ)):1,1:0)
I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"process/dispense narcotic supplies.",!!,"PSJ RPHARM, PSJ PHARM TECH or PSD TECH ADV security key required.",! K OK Q
W !!,"=> This report reprints a worksheet listing of all pending CS requests for a",!," dispensing site.",!!
I '$O(^PSD(58.85,0)) W $C(7),!!,"There are no pending request orders.",!! K OK Q
ASKD ;ask disp location
S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
I $P(PSDSITE,U,5) S PSDS=PSDS_"^"_+$P(^PSD(58.8,+PSDS,0),"^",5) G CHKD
W ! 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)",DIC("A")="Select Primary Dispensing Site: ",DIC("B")=$P(PSDSITE,U,4)
D ^DIC K DIC G:Y<0 END
S PSDS=+Y,PSDSN=$P(Y,"^",2),PSDS=PSDS_"^"_+$P(Y(0),"^",5)
S $P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
CHKD I '$O(^PSD(58.85,"AE",+PSDS,0)) W !!,"There are no pending CS requests for "_PSDSN_".",!! G END
DEV ;ask device and queue info
W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
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
I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDRWK",ZTDESC="Reprint Worksheet for CS PHARM" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
U IO
START ;entry for reprint
K LN S (CNT,PG,PSDOUT)=0,$P(LN,"-",132)="" D NOW^%DTC S Y=+$E(%,1,12) X ^DD("DD") S RPDT=Y D HDR Q:PSDOUT
F JJ=0:0 S JJ=$O(^PSD(58.85,"AW",+PSDS,JJ)) Q:'JJ!(PSDOUT) F PSD=0:0 S PSD=$O(^PSD(58.85,"AW",+PSDS,JJ,PSD)) Q:'PSD!(PSDOUT) I $D(^PSD(58.85,PSD,0)) S PSDN=+$P(^(0),"^",3) D
.S NODE=^PSD(58.85,PSD,0),CNT=CNT+1,WK=$S($P(NODE,"^",7)>2:"*",1:"")
.S PSDNA=$S($P($G(^PSD(58.8,PSDN,0)),"^")]"":$P(^(0),"^"),1:"ZZ/"_PSDN)
.S DRUG=+$P(NODE,"^",4),DRUGN=$S($P($G(^PSDRUG(DRUG,0)),"^")]"":$P(^(0),"^"),1:"ZZ/"_DRUG)
.S QTY=$P(NODE,"^",6),ORD=+$P(NODE,"^",12),ORDN=$S($P($G(^VA(200,ORD,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
.S COMM=$S($D(^PSD(58.85,PSD,1,0)):1,1:0)
.;prints detail data
.I 'CNT W !!,?45,"**** NO REQUESTS PREVIOUSLY PRINTED FOR THIS DISPENSING LOCATION ****" S PSDOUT=1 Q
.D:$Y+8>IOSL HDR Q:PSDOUT
.W !,PSD_WK,?10,DRUGN,?52,QTY,?60,PSDNA,?100,ORDN
.W:$P($G(^PSD(58.85,PSD,2)),U,2) !,"* PRIORITY *"
.I COMM K ^UTILITY($J,"W") F TEXT=0:0 S TEXT=$O(^PSD(58.85,PSD,1,TEXT)) Q:'TEXT S X=$G(^PSD(58.85,PSD,1,TEXT,0)),DIWL=15,DIWR=125,DIWF="W" D ^DIWP
.I COMM D ^DIWW
.W !!,?10,"Disp # ____________ Manufacturer: __________________ Lot # __________ Exp. Date: __________",!
DONE I $E(IOST)'="C" W @IOF
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
END K %,%H,%I,%ZIS,C,CNT,COMM,DA,DIC,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DTOUT,DRUG,DRUGN,DUOUT,IO("Q"),JJ,LN,NODE,OK,ORD,ORDN
K PG,POP,PSD,PSDEV,PSDN,PSDNA,PSDOUT,PSDS,PSDSN,QTY,RPDT,TEXT,WK,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK D ^%ZISC
S:$D(ZTQUEUED) ZTREQ="@"
Q
SAVE S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDSITE"))=""
Q
HDR ;lists header information
I $E(IOST,1,2)="C-",PG W ! K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
W:$Y @IOF S PG=PG+1 W !,?40,"PHARMACY DISPENSING WORKSHEET (Reprint)",!!,"Dispensing Location: ",PSDSN,?65,RPDT,?105,"PG "_PG,!!
W "WS #",?10,"DRUG",?50,"QUANTITY",?60,"DISPENSE TO",!,?12,"COMMENTS",?50,"ORDERED",?60,"LOCATION",?102,"ORDERED BY",!,LN,!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSDRWK 4205 printed Nov 22, 2024@16:59:08 Page 2
PSDRWK ;BIR/JPW-Reprint Pharm Disp. Worksheet ;12/14/99 16:40
+1 ;;3.0; CONTROLLED SUBSTANCES ;**20,69**;13 Feb 97;Build 13
+2 ;
+3 ; Reference to XUSEC( supported by DBIA # 10076
+4 ; Reference to DD(58.8 supported by DBIA # 10154
+5 ; Reference to DD("DD" supported by DBIA # 10017
+6 ; Reference to PSDRUG( supproted by DBIA # 221
+7 ; Reference to VA(200 supported by DBIA # 10060
+8 ; Reference to PSD(58.8 supported by DBIA # 2711
+9 ;
+10 IF '$DATA(PSDSITE)
DO ^PSDSET
if '$DATA(PSDSITE)
QUIT
+11 SET OK=$SELECT($DATA(^XUSEC("PSJ RPHARM",DUZ)):1,$DATA(^XUSEC("PSJ PHARM TECH",DUZ)):1,$DATA(^XUSEC("PSD TECH ADV",DUZ)):1,1:0)
+12 IF 'OK
WRITE $CHAR(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"process/dispense narcotic supplies.",!!,"PSJ RPHARM, PSJ PHARM TECH or PSD TECH ADV security key required.",!
KILL OK
QUIT
+13 WRITE !!,"=> This report reprints a worksheet listing of all pending CS requests for a",!," dispensing site.",!!
+14 IF '$ORDER(^PSD(58.85,0))
WRITE $CHAR(7),!!,"There are no pending request orders.",!!
KILL OK
QUIT
ASKD ;ask disp location
+1 SET PSDS=$PIECE(PSDSITE,U,3)
SET PSDSN=$PIECE(PSDSITE,U,4)
+2 IF $PIECE(PSDSITE,U,5)
SET PSDS=PSDS_"^"_+$PIECE(^PSD(58.8,+PSDS,0),"^",5)
GOTO CHKD
+3 WRITE !
KILL DIC,DA
SET DIC=58.8
SET DIC(0)="QEAZ"
SET DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S($P(^(0),""^"",2)[""M"":1,$P(^(0),""^"",2)[""S"":1,1:0)"
SET DIC("A")="Select Primary Dispensing Site: "
SET DIC("B")=$PIECE(PSDSITE,U,4)
+4 DO ^DIC
KILL DIC
if Y<0
GOTO END
+5 SET PSDS=+Y
SET PSDSN=$PIECE(Y,"^",2)
SET PSDS=PSDS_"^"_+$PIECE(Y(0),"^",5)
+6 SET $PIECE(PSDSITE,U,3)=+Y
SET $PIECE(PSDSITE,U,4)=PSDSN
CHKD IF '$ORDER(^PSD(58.85,"AE",+PSDS,0))
WRITE !!,"There are no pending CS requests for "_PSDSN_".",!!
GOTO END
DEV ;ask device and queue info
+1 WRITE !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
+2 SET Y=$PIECE($GET(^PSD(58.8,+PSDS,2)),"^",9)
SET C=$PIECE(^DD(58.8,24,0),"^",2)
DO Y^DIQ
SET PSDEV=Y
+3 KILL %ZIS,IOP,IO("Q"),POP
SET %ZIS="QM"
SET %ZIS("B")=PSDEV
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO END
+4 IF $DATA(IO("Q"))
KILL IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSDRWK"
SET ZTDESC="Reprint Worksheet for CS PHARM"
DO SAVE
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO END
+5 USE IO
START ;entry for reprint
+1 KILL LN
SET (CNT,PG,PSDOUT)=0
SET $PIECE(LN,"-",132)=""
DO NOW^%DTC
SET Y=+$EXTRACT(%,1,12)
XECUTE ^DD("DD")
SET RPDT=Y
DO HDR
if PSDOUT
QUIT
+2 FOR JJ=0:0
SET JJ=$ORDER(^PSD(58.85,"AW",+PSDS,JJ))
if 'JJ!(PSDOUT)
QUIT
FOR PSD=0:0
SET PSD=$ORDER(^PSD(58.85,"AW",+PSDS,JJ,PSD))
if 'PSD!(PSDOUT)
QUIT
IF $DATA(^PSD(58.85,PSD,0))
SET PSDN=+$PIECE(^(0),"^",3)
Begin DoDot:1
+3 SET NODE=^PSD(58.85,PSD,0)
SET CNT=CNT+1
SET WK=$SELECT($PIECE(NODE,"^",7)>2:"*",1:"")
+4 SET PSDNA=$SELECT($PIECE($GET(^PSD(58.8,PSDN,0)),"^")]"":$PIECE(^(0),"^"),1:"ZZ/"_PSDN)
+5 SET DRUG=+$PIECE(NODE,"^",4)
SET DRUGN=$SELECT($PIECE($GET(^PSDRUG(DRUG,0)),"^")]"":$PIECE(^(0),"^"),1:"ZZ/"_DRUG)
+6 SET QTY=$PIECE(NODE,"^",6)
SET ORD=+$PIECE(NODE,"^",12)
SET ORDN=$SELECT($PIECE($GET(^VA(200,ORD,0)),"^")]"":$PIECE(^(0),"^"),1:"UNKNOWN")
+7 SET COMM=$SELECT($DATA(^PSD(58.85,PSD,1,0)):1,1:0)
+8 ;prints detail data
+9 IF 'CNT
WRITE !!,?45,"**** NO REQUESTS PREVIOUSLY PRINTED FOR THIS DISPENSING LOCATION ****"
SET PSDOUT=1
QUIT
+10 if $Y+8>IOSL
DO HDR
if PSDOUT
QUIT
+11 WRITE !,PSD_WK,?10,DRUGN,?52,QTY,?60,PSDNA,?100,ORDN
+12 if $PIECE($GET(^PSD(58.85,PSD,2)),U,2)
WRITE !,"* PRIORITY *"
+13 IF COMM
KILL ^UTILITY($JOB,"W")
FOR TEXT=0:0
SET TEXT=$ORDER(^PSD(58.85,PSD,1,TEXT))
if 'TEXT
QUIT
SET X=$GET(^PSD(58.85,PSD,1,TEXT,0))
SET DIWL=15
SET DIWR=125
SET DIWF="W"
DO ^DIWP
+14 IF COMM
DO ^DIWW
+15 WRITE !!,?10,"Disp # ____________ Manufacturer: __________________ Lot # __________ Exp. Date: __________",!
End DoDot:1
DONE IF $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST,1,2)="C-"
IF 'PSDOUT
WRITE !
KILL DIR,DIRUT
SET DIR(0)="EA"
SET DIR("A")="END OF REPORT! Press <RET> to return to the menu"
DO ^DIR
KILL DIR
END KILL %,%H,%I,%ZIS,C,CNT,COMM,DA,DIC,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DTOUT,DRUG,DRUGN,DUOUT,IO("Q"),JJ,LN,NODE,OK,ORD,ORDN
+1 KILL PG,POP,PSD,PSDEV,PSDN,PSDNA,PSDOUT,PSDS,PSDSN,QTY,RPDT,TEXT,WK,X,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
DO ^%ZISC
+2 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 QUIT
SAVE SET (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDSITE"))=""
+1 QUIT
HDR ;lists header information
+1 IF $EXTRACT(IOST,1,2)="C-"
IF PG
WRITE !
KILL DA,DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSDOUT=1
QUIT
+2 if $Y
WRITE @IOF
SET PG=PG+1
WRITE !,?40,"PHARMACY DISPENSING WORKSHEET (Reprint)",!!,"Dispensing Location: ",PSDSN,?65,RPDT,?105,"PG "_PG,!!
+3 WRITE "WS #",?10,"DRUG",?50,"QUANTITY",?60,"DISPENSE TO",!,?12,"COMMENTS",?50,"ORDERED",?60,"LOCATION",?102,"ORDERED BY",!,LN,!
+4 QUIT