ASUCORUN ; IHS/ITSC/LMH -UPDATE UTILITY FUNCTIONS ;
;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
;This routine is the primary control routine for assuring that
;closeouts are run in logical sequence. Based on flags set in the
;Site file, daily closeouts may run only if the previous monthly
;closeout was completed within a selected time frame. A yearly
;closeout is allowed only if the previous closeout was for the month
;of September.
;The status of the previous closeout is also checked to assure
;that it was correctly completed before a new closeout is allowed.
;All of these functions are controlled by flags in the Site file.
I ASUP("STS")="N"!(ASUP("CKP")>0) D Q:'ASUP("OK")
.I ASUP("TYP")'=ASUP("LSTY") D Q
..D EN2^ASUCOSTS
..W *7,!!,"You have selected a '",$S(ASUP("TYP")=1:"monthly closeout",ASUP("TYP")=2:"yearly closeout",1:"daily closeout"),"'. The earlier run must first be completed."
..W !!,"Contact your Supervisor or select a '",ASUP("LSTN"),"' to resolve the problem.",*7,!
..K DIR S DIR(0)="E" D ^DIR
..S ASUP("HLT")=1,ASUP("OK")=0
.S ASUP("RE*")=1
.D EN2^ASUCOSTS
.S DIR("?")="Enter 'Y' to restart or 'N' to cancel this closeout run."
.S DIR("A")="This will 'RESTART' that run, OK"
.S DIR("B")="Y"
.S DIR(0)="Y"
.D ^DIR
.I $D(DUOUT)!($D(DTOUT)) S ASUP("HLT")=1,ASUP("RE*")=0,ASUP("OK")=0 Q
.S ASUP("OK")=Y
.I ASUP("OK") D
..S ASUP("HLT")=0,ASUP("RE*")=1
..S:ASUP("TYP")=1 ASUP("MO")=$E(ASUP("LSMO"),1,2),ASUP("MOYR")=ASUP("LSMO"),ASUP("YR")=$E(ASUP("MOYR"),3,4)
.E D
..S ASUP("HLT")=1,ASUP("RE*")=0
S ASUP("RE*")=+$G(ASUP("RE*"))
I ASUP("RE*") Q
I ASUP("STR")="N"!(ASUP("CKS")>0) D
.W !,"Standard Reports from Previous Closeout not Sucessfully Printed I will now print them",!,"You will then need to run this Closeout again after they have printed"
.S ASUP("OK")=1,ASUP("RE*")=1
I ASUP("IVR")="N"!(ASUP("CKI")>0) D
.W !,"Invoice Reports from Previous Closeout not Sucessfully Printed",!,"Print them and run this Closeout after they are printed"
.S ASUP("OK")=1,ASUP("RE*")=1
I ASUP("HLT") S ASUP("OK")=0
S ASUP("OK")=$G(ASUP("OK")) S:ASUP("OK")="" ASUP("OK")=1
Q
ASK ;EP ;GET RUN DATE
K DIR S DIR(0)="P^9002039.98",DIR("A")="Enter Run Date" D ^DIR
I $D(DUOUT)!($D(DTOUT)) S ASUP("HLT")=1 Q
S ASUP("MO")=$E($P(Y,U,2),4,5),ASUP("YR")=$E($P(Y,U,2),2,3),ASUP("MOYR")=ASUP("MO")_ASUP("YR")
Q
SETRUN ;EP ; -SET RUN DATE EQUAL DATE
I '$D(ASUP("NXMO")) D SETCTRL^ASUCOSTS
S X=(ASUP("NXMO")*.01)+.01,ASUP("MO")=$P(X,".",2)
S:ASUP("MO")="13" ASUP("MO")=12
I ASUP("MO")="09",9'=+ASUK("DT","MO") D
.S ASUP("YR")=ASUK("DT","PFY")
E D
.S ASUP("YR")=ASUK("DT","CFY")
S ASUP("MOYR")=ASUP("MO")_ASUP("YR")
Q
KILL ;EP; COMMON TRANSACTION PROCESSING ROUTINE VARIABLE KILL
K ASU,ASUM,ASUS,ASUT,ASUV,ASUSV
K DA,DIC,DIE,DR,X,Y
Q
ASUCORUN ; IHS/ITSC/LMH -UPDATE UTILITY FUNCTIONS ;
+1 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
+2 ;This routine is the primary control routine for assuring that
+3 ;closeouts are run in logical sequence. Based on flags set in the
+4 ;Site file, daily closeouts may run only if the previous monthly
+5 ;closeout was completed within a selected time frame. A yearly
+6 ;closeout is allowed only if the previous closeout was for the month
+7 ;of September.
+8 ;The status of the previous closeout is also checked to assure
+9 ;that it was correctly completed before a new closeout is allowed.
+10 ;All of these functions are controlled by flags in the Site file.
+11 IF ASUP("STS")="N"!(ASUP("CKP")>0)
Begin DoDot:1
+12 IF ASUP("TYP")'=ASUP("LSTY")
Begin DoDot:2
+13 DO EN2^ASUCOSTS
+14 WRITE *7,!!,"You have selected a '",$SELECT(ASUP("TYP")=1:"monthly closeout",ASUP("TYP")=2:"yearly closeout",1:"daily closeout"),"'. The earlier run must first be completed."
+15 WRITE !!,"Contact your Supervisor or select a '",ASUP("LSTN"),"' to resolve the problem.",*7,!
+16 KILL DIR
SET DIR(0)="E"
DO ^DIR
+17 SET ASUP("HLT")=1
SET ASUP("OK")=0
End DoDot:2
QUIT
+18 SET ASUP("RE*")=1
+19 DO EN2^ASUCOSTS
+20 SET DIR("?")="Enter 'Y' to restart or 'N' to cancel this closeout run."
+21 SET DIR("A")="This will 'RESTART' that run, OK"
+22 SET DIR("B")="Y"
+23 SET DIR(0)="Y"
+24 DO ^DIR
+25 IF $DATA(DUOUT)!($DATA(DTOUT))
SET ASUP("HLT")=1
SET ASUP("RE*")=0
SET ASUP("OK")=0
QUIT
+26 SET ASUP("OK")=Y
+27 IF ASUP("OK")
Begin DoDot:2
+28 SET ASUP("HLT")=0
SET ASUP("RE*")=1
+29 IF ASUP("TYP")=1
SET ASUP("MO")=$EXTRACT(ASUP("LSMO"),1,2)
SET ASUP("MOYR")=ASUP("LSMO")
SET ASUP("YR")=$EXTRACT(ASUP("MOYR"),3,4)
End DoDot:2
+30 IF '$TEST
Begin DoDot:2
+31 SET ASUP("HLT")=1
SET ASUP("RE*")=0
End DoDot:2
End DoDot:1
IF 'ASUP("OK")
QUIT
+32 SET ASUP("RE*")=+$GET(ASUP("RE*"))
+33 IF ASUP("RE*")
QUIT
+34 IF ASUP("STR")="N"!(ASUP("CKS")>0)
Begin DoDot:1
+35 WRITE !,"Standard Reports from Previous Closeout not Sucessfully Printed I will now print them",!,"You will then need to run this Closeout again after they have printed"
+36 SET ASUP("OK")=1
SET ASUP("RE*")=1
End DoDot:1
+37 IF ASUP("IVR")="N"!(ASUP("CKI")>0)
Begin DoDot:1
+38 WRITE !,"Invoice Reports from Previous Closeout not Sucessfully Printed",!,"Print them and run this Closeout after they are printed"
+39 SET ASUP("OK")=1
SET ASUP("RE*")=1
End DoDot:1
+40 IF ASUP("HLT")
SET ASUP("OK")=0
+41 SET ASUP("OK")=$GET(ASUP("OK"))
IF ASUP("OK")=""
SET ASUP("OK")=1
+42 QUIT
ASK ;EP ;GET RUN DATE
+1 KILL DIR
SET DIR(0)="P^9002039.98"
SET DIR("A")="Enter Run Date"
DO ^DIR
+2 IF $DATA(DUOUT)!($DATA(DTOUT))
SET ASUP("HLT")=1
QUIT
+3 SET ASUP("MO")=$EXTRACT($PIECE(Y,U,2),4,5)
SET ASUP("YR")=$EXTRACT($PIECE(Y,U,2),2,3)
SET ASUP("MOYR")=ASUP("MO")_ASUP("YR")
+4 QUIT
SETRUN ;EP ; -SET RUN DATE EQUAL DATE
+1 IF '$DATA(ASUP("NXMO"))
DO SETCTRL^ASUCOSTS
+2 SET X=(ASUP("NXMO")*.01)+.01
SET ASUP("MO")=$PIECE(X,".",2)
+3 IF ASUP("MO")="13"
SET ASUP("MO")=12
+4 IF ASUP("MO")="09"
IF 9'=+ASUK("DT","MO")
Begin DoDot:1
+5 SET ASUP("YR")=ASUK("DT","PFY")
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 SET ASUP("YR")=ASUK("DT","CFY")
End DoDot:1
+8 SET ASUP("MOYR")=ASUP("MO")_ASUP("YR")
+9 QUIT
KILL ;EP; COMMON TRANSACTION PROCESSING ROUTINE VARIABLE KILL
+1 KILL ASU,ASUM,ASUS,ASUT,ASUV,ASUSV
+2 KILL DA,DIC,DIE,DR,X,Y
+3 QUIT