PSGWCAD2 ;BHAM ISC/CML-Send 'Update AMIS Stats' MailMan message for invalid Inpatient Site assignment ; 08/29/90 9:54
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
MAIL ;Send message for AOUs with invalid INPATIENT SITE Data
Q:'$O(ERR2(0)) S NUM=6,CNT=0
K XMY,^TMP("PSGWMSG",$J) D NOW^%DTC S Y=X X ^DD("DD") S RDT=Y
F PSGWDUZ=0:0 S PSGWDUZ=$O(^XUSEC("PSGWMGR",PSGWDUZ)) Q:'PSGWDUZ S XMY(PSGWDUZ)=""
I '$D(XMY) F PSGWDUZ=0:0 S PSGWDUZ=$O(^XUSEC("PSGW PARAM",PSGWDUZ)) Q:'PSGWDUZ S XMY(PSGWDUZ)=""
S:'$D(XMY) XMY(.5)="" S ^TMP("PSGWMSG",$J,1,0)=" ********** INVALID DATA NOTIFICATION **********"
S ^TMP("PSGWMSG",$J,2,0)="",^TMP("PSGWMSG",$J,3,0)="On "_RDT_", the nightly job to update the AR/WS AMIS Stats file (#58.5)"
F AOU=0:0 S AOU=$O(ERR2(AOU)) Q:'AOU S NUM=NUM+1,CNT=CNT+1,^TMP("PSGWMSG",$J,NUM,0)=CNT_". "_$P(^PSI(58.1,AOU,0),"^") D CURSITE
S PRT1=$S(CNT>1:"AOUs",1:"AOU"),^TMP("PSGWMSG",$J,4,0)="identified INVALID Inpatient Site data in the PHARMACY AOU STOCK file (#58.1)",^TMP("PSGWMSG",$J,5,0)="for the following "_PRT1_":"
S ^TMP("PSGWMSG",$J,6,0)="",^TMP("PSGWMSG",$J,NUM+1,0)="",^TMP("PSGWMSG",$J,NUM+2,0)="Until a VALID Inpatient Site selection (i.e. an Inpatient Site that has been"
S ^TMP("PSGWMSG",$J,NUM+3,0)="flagged as 'Selectable for AR/WS' in the INPATIENT SITE file (#59.4)) is made"
S ^TMP("PSGWMSG",$J,NUM+4,0)="for the above "_PRT1_", NO AMIS data can be stored. The Inpatient Site field",^TMP("PSGWMSG",$J,NUM+5,0)="can be edited through the Supervisor option 'Create the Area of Use'."
S ^TMP("PSGWMSG",$J,NUM+6,0)=""
S ^TMP("PSGWMSG",$J,NUM+7,0)="*** Please note that the AMIS data for the listed "_PRT1_" has NOT been lost.",^TMP("PSGWMSG",$J,NUM+8,0)="It will be picked up the next time the nightly job runs AFTER a VALID"
S ^TMP("PSGWMSG",$J,NUM+9,0)="Inpatient Site assignment has been made!!",XMSUB="UPDATE AR/WS AMIS STATS/INVALID DATA",XMDUZ="INPATIENT PHARMACY AR/WS",XMTEXT="^TMP(""PSGWMSG"",$J," D ^XMD
K AOU,CNT,NUM,PSGWDUZ,PRT1,RDT,SITE,SITENM,XMDUZ,XMZ,XMY,^TMP("PSGWMSG",$J) Q
CURSITE ;
S SITE=^PSI(58.1,AOU,"SITE"),SITENM="" S:$D(^PS(59.4,SITE,0)) SITENM=$P(^PS(59.4,SITE,0),"^") S:SITENM="" SITENM="INVALID DATA VALUE"
S NUM=NUM+1,^TMP("PSGWMSG",$J,NUM,0)=" =>currently has an Inpatient Site assignment of "_SITENM Q
PSGWCAD2 ;BHAM ISC/CML-Send 'Update AMIS Stats' MailMan message for invalid Inpatient Site assignment ; 08/29/90 9:54
+1 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
MAIL ;Send message for AOUs with invalid INPATIENT SITE Data
+1 IF '$ORDER(ERR2(0))
QUIT
SET NUM=6
SET CNT=0
+2 KILL XMY,^TMP("PSGWMSG",$JOB)
DO NOW^%DTC
SET Y=X
XECUTE ^DD("DD")
SET RDT=Y
+3 FOR PSGWDUZ=0:0
SET PSGWDUZ=$ORDER(^XUSEC("PSGWMGR",PSGWDUZ))
IF 'PSGWDUZ
QUIT
SET XMY(PSGWDUZ)=""
+4 IF '$DATA(XMY)
FOR PSGWDUZ=0:0
SET PSGWDUZ=$ORDER(^XUSEC("PSGW PARAM",PSGWDUZ))
IF 'PSGWDUZ
QUIT
SET XMY(PSGWDUZ)=""
+5 IF '$DATA(XMY)
SET XMY(.5)=""
SET ^TMP("PSGWMSG",$JOB,1,0)=" ********** INVALID DATA NOTIFICATION **********"
+6 SET ^TMP("PSGWMSG",$JOB,2,0)=""
SET ^TMP("PSGWMSG",$JOB,3,0)="On "_RDT_", the nightly job to update the AR/WS AMIS Stats file (#58.5)"
+7 FOR AOU=0:0
SET AOU=$ORDER(ERR2(AOU))
IF 'AOU
QUIT
SET NUM=NUM+1
SET CNT=CNT+1
SET ^TMP("PSGWMSG",$JOB,NUM,0)=CNT_". "_$PIECE(^PSI(58.1,AOU,0),"^")
DO CURSITE
+8 SET PRT1=$SELECT(CNT>1:"AOUs",1:"AOU")
SET ^TMP("PSGWMSG",$JOB,4,0)="identified INVALID Inpatient Site data in the PHARMACY AOU STOCK file (#58.1)"
SET ^TMP("PSGWMSG",$JOB,5,0)="for the following "_PRT1_":"
+9 SET ^TMP("PSGWMSG",$JOB,6,0)=""
SET ^TMP("PSGWMSG",$JOB,NUM+1,0)=""
SET ^TMP("PSGWMSG",$JOB,NUM+2,0)="Until a VALID Inpatient Site selection (i.e. an Inpatient Site that has been"
+10 SET ^TMP("PSGWMSG",$JOB,NUM+3,0)="flagged as 'Selectable for AR/WS' in the INPATIENT SITE file (#59.4)) is made"
+11 SET ^TMP("PSGWMSG",$JOB,NUM+4,0)="for the above "_PRT1_", NO AMIS data can be stored. The Inpatient Site field"
SET ^TMP("PSGWMSG",$JOB,NUM+5,0)="can be edited through the Supervisor option 'Create the Area of Use'."
+12 SET ^TMP("PSGWMSG",$JOB,NUM+6,0)=""
+13 SET ^TMP("PSGWMSG",$JOB,NUM+7,0)="*** Please note that the AMIS data for the listed "_PRT1_" has NOT been lost."
SET ^TMP("PSGWMSG",$JOB,NUM+8,0)="It will be picked up the next time the nightly job runs AFTER a VALID"
+14 SET ^TMP("PSGWMSG",$JOB,NUM+9,0)="Inpatient Site assignment has been made!!"
SET XMSUB="UPDATE AR/WS AMIS STATS/INVALID DATA"
SET XMDUZ="INPATIENT PHARMACY AR/WS"
SET XMTEXT="^TMP(""PSGWMSG"",$J,"
DO ^XMD
+15 KILL AOU,CNT,NUM,PSGWDUZ,PRT1,RDT,SITE,SITENM,XMDUZ,XMZ,XMY,^TMP("PSGWMSG",$JOB)
QUIT
CURSITE ;
+1 SET SITE=^PSI(58.1,AOU,"SITE")
SET SITENM=""
IF $DATA(^PS(59.4,SITE,0))
SET SITENM=$PIECE(^PS(59.4,SITE,0),"^")
IF SITENM=""
SET SITENM="INVALID DATA VALUE"
+2 SET NUM=NUM+1
SET ^TMP("PSGWMSG",$JOB,NUM,0)=" =>currently has an Inpatient Site assignment of "_SITENM
QUIT