PSDGSPU ;BIR/JPW-Pickup Green Sheet ; 6 July 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 PHARM TECH",DUZ)):2,1:0)
I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to return",!,?12,"Green Sheets. PSJ RPHARM or PSJ PHARM TECH security key required.",! K OK Q
W ?10,!!,"Return a Green Sheet to Pharmacy",! S PSDUZ=DUZ,PSDUZN=$P($G(^VA(200,PSDUZ,0)),"^")
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 ! K DA,DIC S DIC("A")="Select the Green Sheet #: ",DIC=58.81,DIC(0)="QEASZ",D="D"
S:OK=1 DIC("S")="I $P(^(0),""^"",3)=+PSDS,$S($P(^(0),""^"",11)=4:1,$P(^(0),""^"",11)=5:1,1:0)"
S:OK=2 DIC("S")="I $P(^(0),""^"",3)=+PSDS,$P(^(0),""^"",11)=5" D IX^DIC K DIC G:Y<0 END S PSDA=+Y
S STAT=+$P(Y(0),"^",11),PSDPN=$P(Y(0),"^",17),STATN="" I STAT S STATN=$P($G(^PSD(58.82,STAT,0)),"^")
S ORD=+$P(Y(0),"^",20),NAOU=+$P(Y(0),"^",18),NAOUN=$P($G(^PSD(58.8,NAOU,0)),"^"),PSDR=+$P(Y(0),"^",5),PSDRN=$P($G(^PSDRUG(PSDR,0)),"^")
I '$D(^PSD(58.8,NAOU,1,PSDR,3,ORD,0)) W $C(7),!!,"There's no data on ",NAOUN," for Green Sheet # ",PSDPN,".",!,"Contact your Pharmacy Coordinator for assistance.",! G END
I OK=2,STAT'=5 W !!,"This order has a status of "_$S(STATN]"":STATN,1:"UNKNOWN")_".",!,"Please contact your Pharmacy Coordinator for assistance.",! G END
D NOW^%DTC S Y=+$E(%,1,12) X ^DD("DD") S RECDT=Y
RET ;return gs
W !!,"Accessing ",PSDRN," information...",!
;update transaction file (58.81)
S NURSE=+$P($G(^PSD(58.81,PSDA,1)),"^",10)
K DA,DIE,DR S DA=PSDA,DIE=58.81,DR="31//^S X=RECDT;32//^S X=PSDUZN;I NURSE S Y=10;29;10////6" D ^DIE K DA,DIE,DR
I $D(Y)!$D(DTOUT) W $C(7),!!,"** THIS GREEN SHEET HAS NOT BEEN PICKED UP **",!!,"The status remains "_STATN,! G END
;update order info in 58.8
W !!,"Updating your records now..."
K DA,DIE,DR S DA=ORD,DA(1)=PSDR,DA(2)=NAOU,DIE="^PSD(58.8,"_DA(2)_",1,"_DA(1)_",3,",DR="10////6" D ^DIE K DA,DIE,DR
W "done.",!!
S STAT=$P($G(^PSD(58.81,PSDA,0)),"^",11) W ?2,"*** Your Green Sheet #"_PSDPN_" is now "_$S($P($G(^PSD(58.82,STAT,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")_" ***",!
G GS
END K %,%DT,%H,%I,D,DA,DIC,DIE,DR,DTOUT,DUOUT
K NAOU,NAOUN,NURSE,OK,ORD,PSDA,PSDPN,PSDR,PSDRN,PSDS,PSDSN,PSDUZ,PSDUZN,RECDT,STAT,STATN,X,Y
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSDGSPU 2691 printed Dec 13, 2024@01:46:15 Page 2
PSDGSPU ;BIR/JPW-Pickup Green Sheet ; 6 July 94
+1 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
+2 IF '$DATA(PSDSITE)
DO ^PSDSET
if '$DATA(PSDSITE)
QUIT
+3 SET OK=$SELECT($DATA(^XUSEC("PSJ RPHARM",DUZ)):1,$DATA(^XUSEC("PSJ PHARM TECH",DUZ)):2,1:0)
+4 IF 'OK
WRITE $CHAR(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to return",!,?12,"Green Sheets. PSJ RPHARM or PSJ PHARM TECH security key required.",!
KILL OK
QUIT
+5 WRITE ?10,!!,"Return a Green Sheet to Pharmacy",!
SET PSDUZ=DUZ
SET PSDUZN=$PIECE($GET(^VA(200,PSDUZ,0)),"^")
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 !
KILL DA,DIC
SET DIC("A")="Select the Green Sheet #: "
SET DIC=58.81
SET DIC(0)="QEASZ"
SET D="D"
+2 if OK=1
SET DIC("S")="I $P(^(0),""^"",3)=+PSDS,$S($P(^(0),""^"",11)=4:1,$P(^(0),""^"",11)=5:1,1:0)"
+3 if OK=2
SET DIC("S")="I $P(^(0),""^"",3)=+PSDS,$P(^(0),""^"",11)=5"
DO IX^DIC
KILL DIC
if Y<0
GOTO END
SET PSDA=+Y
+4 SET STAT=+$PIECE(Y(0),"^",11)
SET PSDPN=$PIECE(Y(0),"^",17)
SET STATN=""
IF STAT
SET STATN=$PIECE($GET(^PSD(58.82,STAT,0)),"^")
+5 SET ORD=+$PIECE(Y(0),"^",20)
SET NAOU=+$PIECE(Y(0),"^",18)
SET NAOUN=$PIECE($GET(^PSD(58.8,NAOU,0)),"^")
SET PSDR=+$PIECE(Y(0),"^",5)
SET PSDRN=$PIECE($GET(^PSDRUG(PSDR,0)),"^")
+6 IF '$DATA(^PSD(58.8,NAOU,1,PSDR,3,ORD,0))
WRITE $CHAR(7),!!,"There's no data on ",NAOUN," for Green Sheet # ",PSDPN,".",!,"Contact your Pharmacy Coordinator for assistance.",!
GOTO END
+7 IF OK=2
IF STAT'=5
WRITE !!,"This order has a status of "_$SELECT(STATN]"":STATN,1:"UNKNOWN")_".",!,"Please contact your Pharmacy Coordinator for assistance.",!
GOTO END
+8 DO NOW^%DTC
SET Y=+$EXTRACT(%,1,12)
XECUTE ^DD("DD")
SET RECDT=Y
RET ;return gs
+1 WRITE !!,"Accessing ",PSDRN," information...",!
+2 ;update transaction file (58.81)
+3 SET NURSE=+$PIECE($GET(^PSD(58.81,PSDA,1)),"^",10)
+4 KILL DA,DIE,DR
SET DA=PSDA
SET DIE=58.81
SET DR="31//^S X=RECDT;32//^S X=PSDUZN;I NURSE S Y=10;29;10////6"
DO ^DIE
KILL DA,DIE,DR
+5 IF $DATA(Y)!$DATA(DTOUT)
WRITE $CHAR(7),!!,"** THIS GREEN SHEET HAS NOT BEEN PICKED UP **",!!,"The status remains "_STATN,!
GOTO END
+6 ;update order info in 58.8
+7 WRITE !!,"Updating your records now..."
+8 KILL DA,DIE,DR
SET DA=ORD
SET DA(1)=PSDR
SET DA(2)=NAOU
SET DIE="^PSD(58.8,"_DA(2)_",1,"_DA(1)_",3,"
SET DR="10////6"
DO ^DIE
KILL DA,DIE,DR
+9 WRITE "done.",!!
+10 SET STAT=$PIECE($GET(^PSD(58.81,PSDA,0)),"^",11)
WRITE ?2,"*** Your Green Sheet #"_PSDPN_" is now "_$SELECT($PIECE($GET(^PSD(58.82,STAT,0)),"^")]"":$PIECE(^(0),"^"),1:"UNKNOWN")_" ***",!
+11 GOTO GS
END KILL %,%DT,%H,%I,D,DA,DIC,DIE,DR,DTOUT,DUOUT
+1 KILL NAOU,NAOUN,NURSE,OK,ORD,PSDA,PSDPN,PSDR,PSDRN,PSDS,PSDSN,PSDUZ,PSDUZN,RECDT,STAT,STATN,X,Y
+2 QUIT