PSJUTL6 ;B'ham/LDT - Re-index "AUDS" x-ref on file 55 ; 18 Aug 98 / 2:48 PM
;;5.0; INPATIENT MEDICATIONS ;**13**;16 DEC 97
;
Q
ENNV ; Begin
K ZTSAVE,ZTSK S ZTRTN="ENQN^PSJUTL6",ZTDESC="Re-index of ""AUDS"" x-ref",ZTIO="",ZTDTH=$$CON(XPDQUES("POS ONE")) D ^%ZTLOAD
I $D(ZTSK) D MES^XPDUTL("The Re-index of the ""AUDS"" is queued to run at "_XPDQUES("POS ONE"))
I $D(ZTSK) D MES^XPDUTL("YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED.")
Q
ENQN ; Loop thru Pharmacy Patient file.
D NOW^%DTC N DFN S PSJSTART=$E(%,1,12)
S DFN=0 F S DFN=$O(^PS(55,DFN)) Q:'DFN S DA(1)=DFN,DIK="^PS(55,"_DA(1)_",5,",DIK(1)="10^AUDS" D ENALL^DIK
D SENDMSG
Q
SENDMSG ;Send mail message when check is complete.
K PSG,XMY S XMDUZ="MEDICATIONS,INPATIENT",XMSUB="INPATIENT MEDS ORDER CHECK COMPLETED",XMTEXT="PSG(",XMY(DUZ)="" D NOW^%DTC S Y=% X ^DD("DD")
S PSG(1,0)=" The Re-index of the ""AUDS"" x-ref completed as of "_Y_"."
S X=$$FMDIFF^XLFDT(%,PSJSTART,3) S:$L(X," ")>1 DAYS=+$P(X," "),X=$P(X," ",2) S HOURS=+$P(X,":"),MINS=+$P(X,":",2)
S PSG(2,0)=" ",PSG(3,0)="This process took "_$S($G(DAYS):DAYS_" day"_$E("s",DAYS'=1)_", ",1:"")_HOURS_" hour"_$E("s",HOURS'=1)_" and "_MINS_" minute"_$E("s",MINS'=1)_"."
D ^XMD
;
DONE ;
K DA,DIK,PSJSTART,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK S ZTREQ="@"
Q
;
GETDT ; check date/time for job to run
N %DT,Y S %DT="NRS"
D ^%DT I Y=-1 K X
E S X=Y
Q
CON(X) ;
N %DT S %DT="NRS" D ^%DT
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSJUTL6 1513 printed Dec 13, 2024@02:09:15 Page 2
PSJUTL6 ;B'ham/LDT - Re-index "AUDS" x-ref on file 55 ; 18 Aug 98 / 2:48 PM
+1 ;;5.0; INPATIENT MEDICATIONS ;**13**;16 DEC 97
+2 ;
+3 QUIT
ENNV ; Begin
+1 KILL ZTSAVE,ZTSK
SET ZTRTN="ENQN^PSJUTL6"
SET ZTDESC="Re-index of ""AUDS"" x-ref"
SET ZTIO=""
SET ZTDTH=$$CON(XPDQUES("POS ONE"))
DO ^%ZTLOAD
+2 IF $DATA(ZTSK)
DO MES^XPDUTL("The Re-index of the ""AUDS"" is queued to run at "_XPDQUES("POS ONE"))
+3 IF $DATA(ZTSK)
DO MES^XPDUTL("YOU WILL RECEIVE A MAILMAN MESSAGE WHEN TASK #"_ZTSK_" HAS COMPLETED.")
+4 QUIT
ENQN ; Loop thru Pharmacy Patient file.
+1 DO NOW^%DTC
NEW DFN
SET PSJSTART=$EXTRACT(%,1,12)
+2 SET DFN=0
FOR
SET DFN=$ORDER(^PS(55,DFN))
if 'DFN
QUIT
SET DA(1)=DFN
SET DIK="^PS(55,"_DA(1)_",5,"
SET DIK(1)="10^AUDS"
DO ENALL^DIK
+3 DO SENDMSG
+4 QUIT
SENDMSG ;Send mail message when check is complete.
+1 KILL PSG,XMY
SET XMDUZ="MEDICATIONS,INPATIENT"
SET XMSUB="INPATIENT MEDS ORDER CHECK COMPLETED"
SET XMTEXT="PSG("
SET XMY(DUZ)=""
DO NOW^%DTC
SET Y=%
XECUTE ^DD("DD")
+2 SET PSG(1,0)=" The Re-index of the ""AUDS"" x-ref completed as of "_Y_"."
+3 SET X=$$FMDIFF^XLFDT(%,PSJSTART,3)
if $LENGTH(X," ")>1
SET DAYS=+$PIECE(X," ")
SET X=$PIECE(X," ",2)
SET HOURS=+$PIECE(X,":")
SET MINS=+$PIECE(X,":",2)
+4 SET PSG(2,0)=" "
SET PSG(3,0)="This process took "_$SELECT($GET(DAYS):DAYS_" day"_$EXTRACT("s",DAYS'=1)_", ",1:"")_HOURS_" hour"_$EXTRACT("s",HOURS'=1)_" and "_MINS_" minute"_$EXTRACT("s",MINS'=1)_"."
+5 DO ^XMD
+6 ;
DONE ;
+1 KILL DA,DIK,PSJSTART,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,ZTDESC,ZTDTH,ZTIO,ZTREQ,ZTRTN,ZTSAVE,ZTSK
SET ZTREQ="@"
+2 QUIT
+3 ;
GETDT ; check date/time for job to run
+1 NEW %DT,Y
SET %DT="NRS"
+2 DO ^%DT
IF Y=-1
KILL X
+3 IF '$TEST
SET X=Y
+4 QUIT
CON(X) ;
+1 NEW %DT
SET %DT="NRS"
DO ^%DT
+2 QUIT Y