PSDGSH ;BIR/JPW-Review Green Sheet History ; 29 Aug 94
;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
;S OK=$S($D(^XUSEC("PSJ RPHARM",DUZ)):1,$D(^XUSEC("PSJ RNURSE",DUZ)):1,$D(^XUSEC("PSD NURSE",DUZ)):1,1:0)
;I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to view",!,?12,"Green Sheets.",! K OK Q
ASKD ;ask disp location
S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
G:$P(PSDSITE,U,5) GS
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)"
S DIC("A")="Select Primary Dispensing Site: ",DIC("B")=PSDSN
D ^DIC K DIC G:Y<0 END
S PSDS=+Y,PSDSN=$P(Y,"^",2),$P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
GS ;select green sheet #
W @IOF,! K DA,DIC S DIC("A")="Select the Green Sheet #: ",DIC("S")="I $P(^(0),""^"",3)=PSDS,$P(^(0),""^"",2)'=5",DIC=58.81,DIC(0)="QEASZ",D="D"
D IX^DIC K DIC G:Y<0 END S PSDA=+Y,NODE=Y(0)
DEV ;asks device and queueing information
S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
W ! K %ZIS,IOP,IO("Q"),POP S %ZIS="QM" S:$D(^XUSEC("PSJ RPHARM",DUZ)) %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^PSDGSH1",ZTDESC="CS PHARM GREEN SHEET HISTORY" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G GS
U IO D START^PSDGSH1 G GS
END K %ZIS,C,D,DA,DIC,DTOUT,DUOUT,NODE,OK,OTR,POP,PSD,PSDA,PSDEV,PSDS,PSDSN,X,Y
K ZTDESC,ZTRTN,ZTSAVE,ZTSK D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
Q
SAVE ;sets variables for queueing
S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDA"),ZTSAVE("NODE"))=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSDGSH 1687 printed Nov 22, 2024@16:56:20 Page 2
PSDGSH ;BIR/JPW-Review Green Sheet History ; 29 Aug 94
+1 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
+2 IF '$DATA(PSDSITE)
DO ^PSDSET
if '$DATA(PSDSITE)
QUIT
+3 ;S OK=$S($D(^XUSEC("PSJ RPHARM",DUZ)):1,$D(^XUSEC("PSJ RNURSE",DUZ)):1,$D(^XUSEC("PSD NURSE",DUZ)):1,1:0)
+4 ;I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to view",!,?12,"Green Sheets.",! K OK Q
ASKD ;ask disp location
+1 SET PSDS=$PIECE(PSDSITE,U,3)
SET PSDSN=$PIECE(PSDSITE,U,4)
+2 if $PIECE(PSDSITE,U,5)
GOTO GS
+3 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)"
+4 SET DIC("A")="Select Primary Dispensing Site: "
SET DIC("B")=PSDSN
+5 DO ^DIC
KILL DIC
if Y<0
GOTO END
+6 SET PSDS=+Y
SET PSDSN=$PIECE(Y,"^",2)
SET $PIECE(PSDSITE,U,3)=+Y
SET $PIECE(PSDSITE,U,4)=PSDSN
GS ;select green sheet #
+1 WRITE @IOF,!
KILL DA,DIC
SET DIC("A")="Select the Green Sheet #: "
SET DIC("S")="I $P(^(0),""^"",3)=PSDS,$P(^(0),""^"",2)'=5"
SET DIC=58.81
SET DIC(0)="QEASZ"
SET D="D"
+2 DO IX^DIC
KILL DIC
if Y<0
GOTO END
SET PSDA=+Y
SET NODE=Y(0)
DEV ;asks device and queueing information
+1 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
+2 WRITE !
KILL %ZIS,IOP,IO("Q"),POP
SET %ZIS="QM"
if $DATA(^XUSEC("PSJ RPHARM",DUZ))
SET %ZIS("B")=PSDEV
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO END
+3 IF $DATA(IO("Q"))
KILL IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="START^PSDGSH1"
SET ZTDESC="CS PHARM GREEN SHEET HISTORY"
DO SAVE
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO GS
+4 USE IO
DO START^PSDGSH1
GOTO GS
END KILL %ZIS,C,D,DA,DIC,DTOUT,DUOUT,NODE,OK,OTR,POP,PSD,PSDA,PSDEV,PSDS,PSDSN,X,Y
+1 KILL ZTDESC,ZTRTN,ZTSAVE,ZTSK
DO ^%ZISC
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 QUIT
SAVE ;sets variables for queueing
+1 SET (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDA"),ZTSAVE("NODE"))=""
+2 QUIT