- PSDCORP ;BIR/BJW-CS Correction Log Report ; 6 Feb 98
- ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
- ;**Y2K compliance**,"P" added to date input string
- I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
- I '$D(^XUSEC("PSDMGR",DUZ)) W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to print",!,?12,"the narcotic corrections log.",!!,"PSDMGR security key required.",! Q
- ASKD ;ask disp site
- S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
- G:$P(PSDSITE,U,5) TYPE
- 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)"
- S DIC("A")="Select Primary Dispensing Site: "
- S 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
- TYPE ;ask correction type
- K DA,DIR,DIRUT S DIR(0)="SO^1:GREEN SHEET READY FOR PICKUP CORRECTION;2:DELETE EXISTING GREEN SHEET CORRECTION;3:ERROR FOUND ON COMPLETED GS;4:RESOLVED ERROR ON GREEN SHEET"
- S DIR("A")="Select Type of Correction Log"
- S DIR("?",1)="Answer '1' to print Green Sheets flagged ready for pickup corrections,"
- S DIR("?",2)="answer '2' to print existing Green Sheets deleted,",DIR("?",3)="answer '3' to print Green Sheets with an error found after initial completion,"
- S DIR("?",4)="answer '4' to print Green Sheets with errors resolved or",DIR("?")="answer '^' to quit without printing the report."
- D ^DIR K DIR G:$D(DIRUT) END S TYPE=Y
- 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 ;asks device and queueing information
- 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=$S(TYPE=1:"^PSDCORP1",TYPE=2:"^PSDCORP2",1:"^PSDCORP3"),ZTDESC="CS PHARM Correction Log" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
- U IO
- G:TYPE=1 ^PSDCORP1 G:TYPE=2 ^PSDCORP2 G:TYPE=3 ^PSDCORP3 G:TYPE=4 ^PSDCORP3
- END K %,%DT,%H,%I,AOU,AOUN,C,D,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,IO("Q"),JJ,NODE,NUM,PG,POP,PSD,PSDATE,PSDED,PSDEV,PSDOUT,PSDS,PSDSD,PSDSN,PSDT,TYPE,X,Y
- K ZTDESC,ZTIO,ZTRTN,ZTSAVE D ^%ZISC
- S:$D(ZTQUEUED) ZTREQ="@"
- Q
- SAVE S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("PSDATE"),ZTSAVE("TYPE"))=""
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSDCORP 2791 printed Feb 18, 2025@23:11:41 Page 2
- PSDCORP ;BIR/BJW-CS Correction Log Report ; 6 Feb 98
- +1 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
- +2 ;**Y2K compliance**,"P" added to date input string
- +3 IF '$DATA(PSDSITE)
- DO ^PSDSET
- if '$DATA(PSDSITE)
- QUIT
- +4 IF '$DATA(^XUSEC("PSDMGR",DUZ))
- WRITE $CHAR(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to print",!,?12,"the narcotic corrections log.",!!,"PSDMGR security key required.",!
- QUIT
- ASKD ;ask disp site
- +1 SET PSDS=$PIECE(PSDSITE,U,3)
- SET PSDSN=$PIECE(PSDSITE,U,4)
- +2 if $PIECE(PSDSITE,U,5)
- GOTO TYPE
- +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)"
- +4 SET DIC("A")="Select Primary Dispensing Site: "
- +5 SET DIC("B")=PSDSN
- +6 DO ^DIC
- KILL DIC
- if Y<0
- GOTO END
- +7 SET PSDS=+Y
- SET PSDSN=$PIECE(Y,"^",2)
- SET $PIECE(PSDSITE,U,3)=+Y
- SET $PIECE(PSDSITE,U,4)=PSDSN
- TYPE ;ask correction type
- +1 KILL DA,DIR,DIRUT
- SET DIR(0)="SO^1:GREEN SHEET READY FOR PICKUP CORRECTION;2:DELETE EXISTING GREEN SHEET CORRECTION;3:ERROR FOUND ON COMPLETED GS;4:RESOLVED ERROR ON GREEN SHEET"
- +2 SET DIR("A")="Select Type of Correction Log"
- +3 SET DIR("?",1)="Answer '1' to print Green Sheets flagged ready for pickup corrections,"
- +4 SET DIR("?",2)="answer '2' to print existing Green Sheets deleted,"
- SET DIR("?",3)="answer '3' to print Green Sheets with an error found after initial completion,"
- +5 SET DIR("?",4)="answer '4' to print Green Sheets with errors resolved or"
- SET DIR("?")="answer '^' to quit without printing the report."
- +6 DO ^DIR
- KILL DIR
- if $DATA(DIRUT)
- GOTO END
- SET TYPE=Y
- 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 ;asks device and queueing information
- +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=$SELECT(TYPE=1:"^PSDCORP1",TYPE=2:"^PSDCORP2",1:"^PSDCORP3")
- SET ZTDESC="CS PHARM Correction Log"
- DO SAVE
- DO ^%ZTLOAD
- DO HOME^%ZIS
- KILL ZTSK
- GOTO END
- +5 USE IO
- +6 if TYPE=1
- GOTO ^PSDCORP1
- if TYPE=2
- GOTO ^PSDCORP2
- if TYPE=3
- GOTO ^PSDCORP3
- if TYPE=4
- GOTO ^PSDCORP3
- END KILL %,%DT,%H,%I,AOU,AOUN,C,D,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,IO("Q"),JJ,NODE,NUM,PG,POP,PSD,PSDATE,PSDED,PSDEV,PSDOUT,PSDS,PSDSD,PSDSN,PSDT,TYPE,X,Y
- +1 KILL ZTDESC,ZTIO,ZTRTN,ZTSAVE
- DO ^%ZISC
- +2 if $DATA(ZTQUEUED)
- SET ZTREQ="@"
- +3 QUIT
- SAVE SET (ZTSAVE("PSDS"),ZTSAVE("PSDSN"),ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("PSDATE"),ZTSAVE("TYPE"))=""
- +1 QUIT