PSOPOST5 ;BIR/RTR-Find Pending Orders for Patch 98 ;03/25/02
;;7.0;OUTPATIENT PHARMACY;**98**;DEC 1997
;External reference to PS(50.606 supported by DBIA 2174
;External reference to PS(50.7 supported by DBIA 2223
;External reference to PSDRUG supported by DBIA 221
K ZTDTH
N PSOBACKG S PSOBACKG=0
I $D(ZTQUEUED) S ZTDTH=$H,PSOBACKG=1
I $G(ZTDTH)="" D
.W !!,"This background job will find all Outpatient Pending orders that may not",!,"show up in the Complete Orders from OERR option. The mail message will be",!,"sent to all PSNMGR key holders. Please forward to any other appropriate"
W !,"pharmacy personnel for review."
W ! S ZTRTN="START^PSOPOST5",ZTIO="",ZTDESC="Patch PSO*7*98 background job" D ^%ZTLOAD I '$D(ZTSK) D S XPDABORT=2
.W !!,"The status of this install will remain 'Start of Install'. Please reinstall",!,"this patch and queue this background job at that time.",!
.I '$G(PSOBACKG) K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR
Q
START ;
N PSOPOR,PSOPOC,PSOTMP,PSOPNM,PSOPTR,PSODNAME,PSOISPD,PSOKEYN
K ^TMP("PSOXORD",$J),^TMP("PSOPHOLD",$J),^TMP("PSOXPAT",$J)
S PSOPOC=0,PSOTMP=6
F PSOPOR=0:0 S PSOPOR=$O(^PS(52.41,PSOPOR)) Q:'PSOPOR I $P($G(^PS(52.41,PSOPOR,0)),"^",3)="XO" D
.S PSOPNODE=$G(^PS(52.41,PSOPOR,0))
.S PSOPTR=$P(PSOPNODE,"^",2) I 'PSOPTR Q
.S PSOPNM=$P($G(^DPT(PSOPTR,0)),"^")
.S PSOPOC=PSOPOC+1
.K PSODNAME
.I $P(PSOPNODE,"^",9) S PSODNAME=$P($G(^PSDRUG($P(PSOPNODE,"^",9),0)),"^")
.I $G(PSODNAME)="",$P(PSOPNODE,"^",8) D
..I $P($G(^PS(50.7,$P(PSOPNODE,"^",8),0)),"^")'="" S PSODNAME=$P($G(^PS(50.7,$P(PSOPNODE,"^",8),0)),"^")_" "_$P($G(^PS(50.606,+$P($G(^PS(50.7,$P(PSOPNODE,"^",8),0)),"^",2),0)),"^")
.S PSOISPD=$S($P(PSOPNODE,"^",12)="":"Unknown",1:$E($P(PSOPNODE,"^",12),4,5)_"/"_$E($P(PSOPNODE,"^",12),6,7)_"/"_$E($P(PSOPNODE,"^",12),2,3))
.I '$D(^TMP("PSOXPAT",$J,PSOPTR)) S ^TMP("PSOPHOLD",$J,PSOPTR,PSOTMP)=" ",PSOTMP=PSOTMP+1 S ^TMP("PSOPHOLD",$J,PSOPTR,PSOTMP)=" Patient: "_$G(PSOPNM) S PSOTMP=PSOTMP+1,^TMP("PSOXPAT",$J,PSOPTR)=""
.S ^TMP("PSOPHOLD",$J,PSOPTR,PSOTMP)=$S($G(PSODNAME)="":"DRUG NAME MISSING",1:$G(PSODNAME))_" Issd: "_$G(PSOISPD) S PSOTMP=PSOTMP+1
MAIL ;Send mail message
S XMDUZ="PSO*7*98 NON-DISPLAYED PENDING ORDERS SEARCH",XMSUB="NON-DISPLAYED OUTPATIENT PENDING ORDERS"
S XMY(DUZ)=""
F PSOKEYN=0:0 S PSOKEYN=$O(^XUSEC("PSNMGR",PSOKEYN)) Q:'PSOKEYN S XMY(PSOKEYN)=""
S ^TMP("PSOXORD",$J,1)="The following Outpatient Pending orders should be reviewed using",^TMP("PSOXORD",$J,2)="the Patient Prescription Processing option. These are orders"
S ^TMP("PSOXORD",$J,3)="that were entered as 'change' orders through CPRS, but may",^TMP("PSOXORD",$J,4)="not have displayed when using the 'Complete Orders from OERR' option."
S ^TMP("PSOXORD",$J,5)=" "
S ^TMP("PSOXORD",$J,6)="Total number of orders found = "_+$G(PSOPOC)_$S(+$G(PSOPOC)=0:" (Nothing to review)",1:"")
S ^TMP("PSOXORD",$J,7)=" "
S (PSOTMP,PSOTMPX)=0,PSOCRV=8
F PSOTMP=0:0 S PSOTMP=$O(^TMP("PSOPHOLD",$J,PSOTMP)) Q:'PSOTMP F PSOTMPX=0:0 S PSOTMPX=$O(^TMP("PSOPHOLD",$J,PSOTMP,PSOTMPX)) Q:'PSOTMPX S ^TMP("PSOXORD",$J,PSOCRV)=$G(^TMP("PSOPHOLD",$J,PSOTMP,PSOTMPX)),PSOCRV=PSOCRV+1
S XMTEXT="^TMP(""PSOXORD"",$J," N DIFROM D ^XMD K XMSUB,XMTEXT,XMY,XMDUZ
K ^TMP("PSOXORD",$J),^TMP("PSOPHOLD",$J),^TMP("PSOXPAT",$J)
S:$D(ZTQUEUED) ZTREQ="@"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOPOST5 3381 printed Dec 13, 2024@02:32:55 Page 2
PSOPOST5 ;BIR/RTR-Find Pending Orders for Patch 98 ;03/25/02
+1 ;;7.0;OUTPATIENT PHARMACY;**98**;DEC 1997
+2 ;External reference to PS(50.606 supported by DBIA 2174
+3 ;External reference to PS(50.7 supported by DBIA 2223
+4 ;External reference to PSDRUG supported by DBIA 221
+5 KILL ZTDTH
+6 NEW PSOBACKG
SET PSOBACKG=0
+7 IF $DATA(ZTQUEUED)
SET ZTDTH=$HOROLOG
SET PSOBACKG=1
+8 IF $GET(ZTDTH)=""
Begin DoDot:1
+9 WRITE !!,"This background job will find all Outpatient Pending orders that may not",!,"show up in the Complete Orders from OERR option. The mail message will be",!,"sent to all PSNMGR key holders. Please forward to any other appropriate
"
End DoDot:1
+10 WRITE !,"pharmacy personnel for review."
+11 WRITE !
SET ZTRTN="START^PSOPOST5"
SET ZTIO=""
SET ZTDESC="Patch PSO*7*98 background job"
DO ^%ZTLOAD
IF '$DATA(ZTSK)
Begin DoDot:1
+12 WRITE !!,"The status of this install will remain 'Start of Install'. Please reinstall",!,"this patch and queue this background job at that time.",!
+13 IF '$GET(PSOBACKG)
KILL DIR
SET DIR(0)="E"
SET DIR("A")="Press Return to Continue"
DO ^DIR
KILL DIR
End DoDot:1
SET XPDABORT=2
+14 QUIT
START ;
+1 NEW PSOPOR,PSOPOC,PSOTMP,PSOPNM,PSOPTR,PSODNAME,PSOISPD,PSOKEYN
+2 KILL ^TMP("PSOXORD",$JOB),^TMP("PSOPHOLD",$JOB),^TMP("PSOXPAT",$JOB)
+3 SET PSOPOC=0
SET PSOTMP=6
+4 FOR PSOPOR=0:0
SET PSOPOR=$ORDER(^PS(52.41,PSOPOR))
if 'PSOPOR
QUIT
IF $PIECE($GET(^PS(52.41,PSOPOR,0)),"^",3)="XO"
Begin DoDot:1
+5 SET PSOPNODE=$GET(^PS(52.41,PSOPOR,0))
+6 SET PSOPTR=$PIECE(PSOPNODE,"^",2)
IF 'PSOPTR
QUIT
+7 SET PSOPNM=$PIECE($GET(^DPT(PSOPTR,0)),"^")
+8 SET PSOPOC=PSOPOC+1
+9 KILL PSODNAME
+10 IF $PIECE(PSOPNODE,"^",9)
SET PSODNAME=$PIECE($GET(^PSDRUG($PIECE(PSOPNODE,"^",9),0)),"^")
+11 IF $GET(PSODNAME)=""
IF $PIECE(PSOPNODE,"^",8)
Begin DoDot:2
+12 IF $PIECE($GET(^PS(50.7,$PIECE(PSOPNODE,"^",8),0)),"^")'=""
SET PSODNAME=$PIECE($GET(^PS(50.7,$PIECE(PSOPNODE,"^",8),0)),"^")_" "_$PIECE($GET(^PS(50.606,+$PIECE($GET(^PS(50.7,$PIECE(PSOPNODE,"^",8),0)),"^",2),0)),"^")
End DoDot:2
+13 SET PSOISPD=$SELECT($PIECE(PSOPNODE,"^",12)="":"Unknown",1:$EXTRACT($PIECE(PSOPNODE,"^",12),4,5)_"/"_$EXTRACT($PIECE(PSOPNODE,"^",12),6,7)_"/"_$EXTRACT($PIECE(PSOPNODE,"^",12),2,3))
+14 IF '$DATA(^TMP("PSOXPAT",$JOB,PSOPTR))
SET ^TMP("PSOPHOLD",$JOB,PSOPTR,PSOTMP)=" "
SET PSOTMP=PSOTMP+1
SET ^TMP("PSOPHOLD",$JOB,PSOPTR,PSOTMP)=" Patient: "_$GET(PSOPNM)
SET PSOTMP=PSOTMP+1
SET ^TMP("PSOXPAT",$JOB,PSOPTR)=""
+15 SET ^TMP("PSOPHOLD",$JOB,PSOPTR,PSOTMP)=$SELECT($GET(PSODNAME)="":"DRUG NAME MISSING",1:$GET(PSODNAME))_" Issd: "_$GET(PSOISPD)
SET PSOTMP=PSOTMP+1
End DoDot:1
MAIL ;Send mail message
+1 SET XMDUZ="PSO*7*98 NON-DISPLAYED PENDING ORDERS SEARCH"
SET XMSUB="NON-DISPLAYED OUTPATIENT PENDING ORDERS"
+2 SET XMY(DUZ)=""
+3 FOR PSOKEYN=0:0
SET PSOKEYN=$ORDER(^XUSEC("PSNMGR",PSOKEYN))
if 'PSOKEYN
QUIT
SET XMY(PSOKEYN)=""
+4 SET ^TMP("PSOXORD",$JOB,1)="The following Outpatient Pending orders should be reviewed using"
SET ^TMP("PSOXORD",$JOB,2)="the Patient Prescription Processing option. These are orders"
+5 SET ^TMP("PSOXORD",$JOB,3)="that were entered as 'change' orders through CPRS, but may"
SET ^TMP("PSOXORD",$JOB,4)="not have displayed when using the 'Complete Orders from OERR' option."
+6 SET ^TMP("PSOXORD",$JOB,5)=" "
+7 SET ^TMP("PSOXORD",$JOB,6)="Total number of orders found = "_+$GET(PSOPOC)_$SELECT(+$GET(PSOPOC)=0:" (Nothing to review)",1:"")
+8 SET ^TMP("PSOXORD",$JOB,7)=" "
+9 SET (PSOTMP,PSOTMPX)=0
SET PSOCRV=8
+10 FOR PSOTMP=0:0
SET PSOTMP=$ORDER(^TMP("PSOPHOLD",$JOB,PSOTMP))
if 'PSOTMP
QUIT
FOR PSOTMPX=0:0
SET PSOTMPX=$ORDER(^TMP("PSOPHOLD",$JOB,PSOTMP,PSOTMPX))
if 'PSOTMPX
QUIT
SET ^TMP("PSOXORD",$JOB,PSOCRV)=$GET(^TMP("PSOPHOLD",$JOB,PSOTMP,PSOTMPX))
SET PSOCRV=PSOCRV+1
+11 SET XMTEXT="^TMP(""PSOXORD"",$J,"
NEW DIFROM
DO ^XMD
KILL XMSUB,XMTEXT,XMY,XMDUZ
+12 KILL ^TMP("PSOXORD",$JOB),^TMP("PSOPHOLD",$JOB),^TMP("PSOXPAT",$JOB)
+13 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+14 QUIT