PSGWAR ;BHAM ISC/PTD,CML-Print AMIS Report ; 14 Feb 1989 1:36 PM
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
I $O(^PSI(58.5,"B",0)) S Y=$O(^(0)) X ^DD("DD") W !,"Earliest date for which you have AMIS data is: ",Y,!!
I $D(^PS(59.7,1,50)),^(50)]"" S Y=^(50),UPDT=$P(Y,".") X ^DD("DD") W $P(Y,"@")," at ",$P(Y,"@",2)," is the last date that AMIS Statistics",!,"were updated by the nightly TaskMan routine.",!!
S X1=DT,X2=$S($D(UPDT):UPDT,1:"") D ^%DTC I X>2 W *7,*7,!?24,"** WARNING **",!,"Please contact ADP and request that Taskmanager option",!,"""PSGW UPDATE AMIS STATS"" be RESCHEDULED to run nightly.",!!
BDT S %DT="AEX",%DT("A")="BEGINNING date for AMIS report: " D ^%DT K %DT G:Y<0 END^PSGWAR1 S BDT=Y
EDT S %DT="AEX",%DT(0)=BDT,%DT("A")="ENDING date for AMIS report: " D ^%DT K %DT G:Y<0 END^PSGWAR1 S EDT=Y
I '$O(^PSI(58.5,"B",BDT-1)) W !!,"There is NO data in the AMIS Stats file for selected dates." G END^PSGWAR1
I $O(^PSI(58.5,"AEX",BDT-1)),$O(^PSI(58.5,"AEX",BDT-1))'>EDT W !!,"There are AMIS exceptions for the dates you selected.",!,"You MUST use the Incomplete AMIS Data option",!,"to supply missing data before AMIS will run!",!! G END^PSGWAR1
I $O(^PSI(58.5,"AMISERR",0)) D ERRCHK I $O(AOU(0)) G END^PSGWAR1
W !!,"The right margin for this report is 132.",!,"You may queue the report to print at a later time.",!!
DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END^PSGWAR1
I $D(IO("Q")) K IO("Q") S ZTRTN="ENQ^PSGWAR1",ZTDESC="Print AMIS Report" F G="BDT","EDT" S:$D(@G) ZTSAVE(G)=""
I D ^%ZTLOAD,HOME^%ZIS K ZTSK G DONE^PSGWAR1
U IO G ENQ^PSGWAR1
;
ERRCHK ;
F AOU=0:0 S AOU=$O(^PSI(58.5,"AMISERR",AOU)) Q:'AOU S CURDT="" F LL=0:0 S CURDT=$O(^PSI(58.5,"AMISERR",AOU,CURDT)) Q:CURDT="" F ADT=0:0 S ADT=$O(^PSI(58.5,"AMISERR",AOU,CURDT,ADT)) Q:'ADT I ADT>BDT&(ADT'>EDT) S AOU(AOU)=""
I '$O(AOU(0)) K AOU,CURDT,LL,ADT Q
W !!,"The following AOU(s) have AMIS activity for the date range you have selected,",!,"but do NOT have a valid INPATIENT SITE designation:",! F AOU=0:0 S AOU=$O(AOU(AOU)) Q:'AOU W !?5,$P(^PSI(58.1,AOU,0),"^")
W !!,"The AMIS Report cannot be printed until the INPATIENT SITE field is edited",!,"for the listed AOU(s) and the TASKMAN job to update the AMIS Stats file,",!,"""PSGW UPDATE AMIS STATS"" is run."
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSGWAR 2351 printed Nov 22, 2024@16:49:01 Page 2
PSGWAR ;BHAM ISC/PTD,CML-Print AMIS Report ; 14 Feb 1989 1:36 PM
+1 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
+2 IF $ORDER(^PSI(58.5,"B",0))
SET Y=$ORDER(^(0))
XECUTE ^DD("DD")
WRITE !,"Earliest date for which you have AMIS data is: ",Y,!!
+3 IF $DATA(^PS(59.7,1,50))
IF ^(50)]""
SET Y=^(50)
SET UPDT=$PIECE(Y,".")
XECUTE ^DD("DD")
WRITE $PIECE(Y,"@")," at ",$PIECE(Y,"@",2)," is the last date that AMIS Statistics",!,"were updated by the nightly TaskMan routine.",!!
+4 SET X1=DT
SET X2=$SELECT($DATA(UPDT):UPDT,1:"")
DO ^%DTC
IF X>2
WRITE *7,*7,!?24,"** WARNING **",!,"Please contact ADP and request that Taskmanager option",!,"""PSGW UPDATE AMIS STATS"" be RESCHEDULED to run nightly.",!!
BDT SET %DT="AEX"
SET %DT("A")="BEGINNING date for AMIS report: "
DO ^%DT
KILL %DT
if Y<0
GOTO END^PSGWAR1
SET BDT=Y
EDT SET %DT="AEX"
SET %DT(0)=BDT
SET %DT("A")="ENDING date for AMIS report: "
DO ^%DT
KILL %DT
if Y<0
GOTO END^PSGWAR1
SET EDT=Y
+1 IF '$ORDER(^PSI(58.5,"B",BDT-1))
WRITE !!,"There is NO data in the AMIS Stats file for selected dates."
GOTO END^PSGWAR1
+2 IF $ORDER(^PSI(58.5,"AEX",BDT-1))
IF $ORDER(^PSI(58.5,"AEX",BDT-1))'>EDT
WRITE !!,"There are AMIS exceptions for the dates you selected.",!,"You MUST use the Incomplete AMIS Data option",!,"to supply missing data before AMIS will run!",!!
GOTO END^PSGWAR1
+3 IF $ORDER(^PSI(58.5,"AMISERR",0))
DO ERRCHK
IF $ORDER(AOU(0))
GOTO END^PSGWAR1
+4 WRITE !!,"The right margin for this report is 132.",!,"You may queue the report to print at a later time.",!!
DEV KILL %ZIS,IOP
SET %ZIS="QM"
SET %ZIS("B")=""
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO END^PSGWAR1
+1 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTRTN="ENQ^PSGWAR1"
SET ZTDESC="Print AMIS Report"
FOR G="BDT","EDT"
if $DATA(@G)
SET ZTSAVE(G)=""
+2 IF $TEST
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
GOTO DONE^PSGWAR1
+3 USE IO
GOTO ENQ^PSGWAR1
+4 ;
ERRCHK ;
+1 FOR AOU=0:0
SET AOU=$ORDER(^PSI(58.5,"AMISERR",AOU))
if 'AOU
QUIT
SET CURDT=""
FOR LL=0:0
SET CURDT=$ORDER(^PSI(58.5,"AMISERR",AOU,CURDT))
if CURDT=""
QUIT
FOR ADT=0:0
SET ADT=$ORDER(^PSI(58.5,"AMISERR",AOU,CURDT,ADT))
if 'ADT
QUIT
IF ADT>BDT&(ADT'>EDT)
SET AOU(AOU)=""
+2 IF '$ORDER(AOU(0))
KILL AOU,CURDT,LL,ADT
QUIT
+3 WRITE !!,"The following AOU(s) have AMIS activity for the date range you have selected,",!,"but do NOT have a valid INPATIENT SITE designation:",!
FOR AOU=0:0
SET AOU=$ORDER(AOU(AOU))
if 'AOU
QUIT
WRITE !?5,$PIECE(^PSI(58.1,AOU,0),"^")
+4 WRITE !!,"The AMIS Report cannot be printed until the INPATIENT SITE field is edited",!,"for the listed AOU(s) and the TASKMAN job to update the AMIS Stats file,",!,"""PSGW UPDATE AMIS STATS"" is run."
+5 QUIT