PSDTRVR ;BIR/BJW-CS Transfer Between Vaults Report ; 12 Feb 98
;;3.0; CONTROLLED SUBSTANCES ;**8,23**;13 Feb 97
;**Y2K compliance**,"P" added to input date string
;Reference to ^PS(59.4 supported by DBIA #1043
I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
I '$D(^XUSEC("PSJ RPHARM",DUZ))&('$D(^XUSEC("PSD TECH",DUZ))) W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"print CS reports.",!!,"PSJ RPHARM or PSD TECH security key required.",! Q
W !!,"CS Transfer Controlled Substances Between Vaults Report",!
ASK K DA,DIR,DTOUT,DUOUT S DIR(0)="YO",DIR("A")="Do you wish to print a Transferred/Received By signature line",DIR("B")="NO"
S DIR("?")="Answer YES to print the signature line, NO or <RET> to omit the signature line."
D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) G END
S ASK=+Y
SITE ;sel one, some or all inp sites
S CNT=0 F JJ=0:0 S JJ=$O(^PS(59.4,JJ)) Q:'JJ I $P($G(^PS(59.4,JJ,0)),"^",31) S SITE(JJ)="",CNT=CNT+1
I 'CNT W !!,"There are no Inpatient Sites defined for Controlled Substances use.",!,"Please contact your Pharmacy Coordinator for assistance.",! G END
G:CNT=1 DATE K SITE
W !!,?2,"You may display Dispensing Sites transfers from a single Inpatient Site, ",!,?2,"several Inpatient Sites, or enter ^ALL to select all Inpatient Sites.",!!
F S DIC=59.4,DIC("A")="Select Inpatient Site: ",DIC(0)="QEA",DIC("S")="I $P(^(0),""^"",31)" D ^DIC K DIC Q:Y<0 S SITE(+Y)=""
G END:$O(SITE(0))'>0 I '$D(SITE)&(X'="^ALL") G END
I X="^ALL" F PSD=0:0 S PSD=$O(^PS(59.4,PSD)) Q:'PSD I $P($G(^PS(59.4,PSD,0)),"^",31) S SITE(PSD)=""
DATE ;ask date range
W ! K %DT S %DT="AEP",%DT("A")="Start with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
S PSDSD=Y D D^DIQ S PSDATE=Y,%DT("A")="End with Date: " D ^%DT I Y<0 S PSDOUT=1 G END
I Y<PSDSD W !!,"The ending date of the range must be later than the starting date." G DATE
S PSDED=Y D D^DIQ S PSDATE=PSDATE_"^"_Y,PSDSD=PSDSD-.0001,PSDED=PSDED+.9999
DEV ;dev & queue info
W !!,"This report is designed for a 80 column format.",!,"You may queue this report to print at a later time.",!!
K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="" 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^PSDTRVR1",ZTDESC="CS Transfer Between Vaults Report" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
U IO G ^PSDTRVR1
END ;
K %,%DT,%H,%I,%ZIS,ASK,CNT,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,JJ,OK
K POP,PSD,PSDATE,PSDED,PSDOUT,PSDSD,SITE,SITEN,X,Y,ZTDESC,ZTDTH,ZTRTN,ZTSAVE,ZTSK
K ^TMP("PSDTRVR",$J) D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
Q
SAVE S (ZTSAVE("SITE("),ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("ASK"),ZTSAVE("PSDATE"))=""
Q
PSDTRVR ;BIR/BJW-CS Transfer Between Vaults Report ; 12 Feb 98
+1 ;;3.0; CONTROLLED SUBSTANCES ;**8,23**;13 Feb 97
+2 ;**Y2K compliance**,"P" added to input date string
+3 ;Reference to ^PS(59.4 supported by DBIA #1043
+4 IF '$DATA(PSDSITE)
DO ^PSDSET
IF '$DATA(PSDSITE)
QUIT
+5 IF '$DATA(^XUSEC("PSJ RPHARM",DUZ))&('$DATA(^XUSEC("PSD TECH",DUZ)))
WRITE $CHAR(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"print CS reports.",!!,"PSJ RPHARM or PSD TECH security key required.",!
QUIT
+6 WRITE !!,"CS Transfer Controlled Substances Between Vaults Report",!
ASK KILL DA,DIR,DTOUT,DUOUT
SET DIR(0)="YO"
SET DIR("A")="Do you wish to print a Transferred/Received By signature line"
SET DIR("B")="NO"
+1 SET DIR("?")="Answer YES to print the signature line, NO or <RET> to omit the signature line."
+2 DO ^DIR
KILL DIR
IF $DATA(DTOUT)!($DATA(DUOUT))
GOTO END
+3 SET ASK=+Y
SITE ;sel one, some or all inp sites
+1 SET CNT=0
FOR JJ=0:0
SET JJ=$ORDER(^PS(59.4,JJ))
IF 'JJ
QUIT
IF $PIECE($GET(^PS(59.4,JJ,0)),"^",31)
SET SITE(JJ)=""
SET CNT=CNT+1
+2 IF 'CNT
WRITE !!,"There are no Inpatient Sites defined for Controlled Substances use.",!,"Please contact your Pharmacy Coordinator for assistance.",!
GOTO END
+3 IF CNT=1
GOTO DATE
KILL SITE
+4 WRITE !!,?2,"You may display Dispensing Sites transfers from a single Inpatient Site, ",!,?2,"several Inpatient Sites, or enter ^ALL to select all Inpatient Sites.",!!
+5 FOR
SET DIC=59.4
SET DIC("A")="Select Inpatient Site: "
SET DIC(0)="QEA"
SET DIC("S")="I $P(^(0),""^"",31)"
DO ^DIC
KILL DIC
IF Y<0
QUIT
SET SITE(+Y)=""
+6 IF $ORDER(SITE(0))'>0
GOTO END
IF '$DATA(SITE)&(X'="^ALL")
GOTO END
+7 IF X="^ALL"
FOR PSD=0:0
SET PSD=$ORDER(^PS(59.4,PSD))
IF 'PSD
QUIT
IF $PIECE($GET(^PS(59.4,PSD,0)),"^",31)
SET SITE(PSD)=""
DATE ;ask date range
+1 WRITE !
KILL %DT
SET %DT="AEP"
SET %DT("A")="Start with Date: "
DO ^%DT
IF Y<0
SET PSDOUT=1
GOTO END
+2 SET PSDSD=Y
DO D^DIQ
SET PSDATE=Y
SET %DT("A")="End with Date: "
DO ^%DT
IF Y<0
SET PSDOUT=1
GOTO END
+3 IF Y<PSDSD
WRITE !!,"The ending date of the range must be later than the starting date."
GOTO DATE
+4 SET PSDED=Y
DO D^DIQ
SET PSDATE=PSDATE_"^"_Y
SET PSDSD=PSDSD-.0001
SET PSDED=PSDED+.9999
DEV ;dev & queue info
+1 WRITE !!,"This report is designed for a 80 column format.",!,"You may queue this report to print at a later time.",!!
+2 KILL %ZIS,IOP,IO("Q"),POP
SET %ZIS="QM"
SET %ZIS("B")=""
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^PSDTRVR1"
SET ZTDESC="CS Transfer Between Vaults Report"
DO SAVE
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO END
+4 USE IO
GOTO ^PSDTRVR1
END ;
+1 KILL %,%DT,%H,%I,%ZIS,ASK,CNT,DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,JJ,OK
+2 KILL POP,PSD,PSDATE,PSDED,PSDOUT,PSDSD,SITE,SITEN,X,Y,ZTDESC,ZTDTH,ZTRTN,ZTSAVE,ZTSK
+3 KILL ^TMP("PSDTRVR",$JOB)
DO ^%ZISC
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+4 QUIT
SAVE SET (ZTSAVE("SITE("),ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("ASK"),ZTSAVE("PSDATE"))=""
+1 QUIT