Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACRFPAY3

ACRFPAY3.m

Go to the documentation of this file.
ACRFPAY3 ;IHS/OIRM/DSD/THL,AEF - CERTIFY AND EXPORT PAYMENT BATCH;  [ 07/20/2006   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**20**;NOV 05, 2001
 ;;
DBATCH ;EP;TO SELECT BATCH TO DELETE
 I '$D(^ACRAPL("AC",DUZ,38))&'$D(^ACRAPL("AC",DUZ,39)) D  Q
 .W !!,"You do not have the authority to DELETE PAYMENTS."
 .D PAUSE^ACRFWARN
 S DIC="^AFSLAFP("
 S DIC(0)="AEMQZ"
 S DIC("A")="Fiscal Year.............: "
 S DIC("B")=$S($E(DT,4,5)>9:($E(DT,1,3)+1)+1700,1:$E(DT,1,3)+1700)
 S DIC("S")="I $P(^(0),U)=X"
 W !
 D DIC^ACRFDIC
 Q:+Y<1
 S ACRFYDA=+Y
 F  D DB1 Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRQUIT
 Q
DB1 S DIC="^AFSLAFP("_ACRFYDA_",1,"
 S DIC(0)="AEMQZ"
 S DIC("A")="Batch/Schedule to DELETE: "
 S DIC("S")="I '$O(^AFSLAFP(ACRFYDA,1,+Y,1,0))"
 W !
 D DIC^ACRFDIC
 I +Y<1 S ACRQUIT="" Q
 S ACRBATDA=+Y
 S DIR(0)="YO"
 S DIR("A",1)="Are you ABSOLUTELY CERTAIN"
 S DIR("A")="you want to DELETE Batch NO. "_$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0)),U)
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 I Y'=1 K ACRQUIT Q
 S DA(1)=ACRFYDA
 S DA=ACRBATDA
 S DIK="^AFSLAFP("_DA(1)_",1,"
 D DIK^ACRFDIC
 K ACRQUIT
 Q
BATCHL ;EP;LIST OPEN BATCHS DUE TODAY OR EARLIER
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
 Q:'$D(ACR(ACRFY,ACRJ+10))
 S X=ACR(ACRFY,ACRJ+10)
 Q:$D(ACRQUIT)
 W ?39,"|",ACRJ+10,?44,$P(X,U),?52
 S Y=$P(X,"&&",6)
 X ^DD("DD")
 W Y,?65
 S Y=$P(X,"&&",4)
 I Y?7N X ^DD("DD") W Y
 W:$P(X,"&&",5)=1 " *"
 S:ACRJ+10>ACRJX ACRJX=ACRJ+10
 Q
PAY ;EP;SET LOCAL ACRPAY ARRAY
 S X=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0))
 Q:$P(X,U)=""!'$P(X,U,2)!($P($P(X,U,2),".")>DT)!('$D(ACREXP)&$P(X,U,5))!+$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2))
 Q:$D(ACRCERT)&'$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,0))
 D CONFLICT:$D(ACRCERT)
 I $D(ACRQUIT) K ACRQUIT Q
 S J=$G(J)+1
 S ACR(ACRFY,$P(X,U))=X_"&&"_ACRBATDA_"&&"_ACRFYDA_"&&"_$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,2)_"&&"_'$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,0))_"&&"_$P($P(X,U,2),".")
 Q
PAY1 ;EP
 N ACRFY
 S J=0
 S ACRFY=""
 F  S ACRFY=$O(ACR(ACRFY)) Q:ACRFY=""  D
 .S ACRBATNO=""
 .F  S ACRBATNO=$O(ACR(ACRFY,ACRBATNO)) Q:ACRBATNO=""  D
 ..S J=$G(J)+1
 ..S ACR(ACRFY,J)=ACR(ACRFY,ACRBATNO)
 ..S ^TMP("ACRBAT",$J,ACRBATNO)=J
 ..K ACR(ACRFY,ACRBATNO)
 S ACRMAX=J
 D LIST:J
 Q
FYHEAD ;EP;
 W !!,"FISCAL YEAR: ",ACRFY
 W !!,"NO.",?4,"BATCH",?12,"CREATED",?25,"DUE",?39,"|","NO.",?44,"BATCH",?52,"CREATED",?65,"DUE"
 W !,"---",?4,"------",?12,"-----------",?25,"-----------",?39,"|","---",?44,"------",?52,"-----------",?65,"-----------"
 Q
GBATCH ;ENTER SCHEDULE NUMBER FOR EACH PAYMENT ON G BATCHES
 W !
 S ACRSEQDA=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 .S DA=ACRSEQDA
 .S DA(1)=ACRBATDA
 .S DA(2)=ACRFYDA
 .S DIE="^AFSLAFP("_DA(2)_",1,"_DA(1)_",1,"
 .S DR="40T"
 .N X
 .S X=^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)
 .W !,"Schedule Number for Sequence # ",$P(X,U)," ORDER # ",$P(X,U,20)
 .D DIE^ACRFDIC
 .S (ACRSNO(1),ACRBSCH)=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,1),U,11)
 Q
EXPORT ;EP;TO EXPORT BATCH
 F  D EX1 Q:$D(ACRQUIT)!$D(ACROUT)
 Q
EX1 N J,X,Y,ACREXP
 K ACRMAX,ACR,ACRPAY,ACRQUIT
 S ACREXP=""
 S ACRFYDA=0
 F  S ACRFYDA=$O(^AFSLAFP("EXPORT",ACRFYDA)) Q:'ACRFYDA  D
 .S ACRFY=$P(^AFSLAFP(ACRFYDA,0),U)
 .S ACRBATDA=0
 .F  S ACRBATDA=$O(^AFSLAFP("EXPORT",ACRFYDA,ACRBATDA)) Q:'ACRBATDA  D PAY
 D PAY1
 I '$G(ACRMAX) D  Q
 .W !!,"NO Batches pending for EXPORT"
 .D PAUSE^ACRFWARN
 .S ACRQUIT=""
 D BATCHS^ACRFPAY
 I $D(ACRQUIT)!$D(ACROUT) Q
 I $G(ACRXALL)="ALL" D EXALL Q
 S ACRFY=$P(^AFSLAFP(ACRFYDA,0),U)
 S ACRBATNO=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U)
 K ACRQUIT
 D TSCH
 I $G(ACRBSCH)="" D  Q
 .W !!,"The Treasury Schedule must be completed before export."
 .D PAUSE^ACRFWARN
ALL K ACRQUIT
 D VALCHK^ACRFPAY5
 I $D(ACRQUIT) K ACRQUIT Q
 S ACRSEQDA=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D DHR^ACRFPAY2(ACRFYDA,ACRBATDA,ACRSEQDA)
 K ACROUT
 I '$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U,5)!($P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,3)'="C") D  Q
 .W !!,"Batch NO ",$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U)," is not properly marked as CLOSED and/or CERTIFIED."
 .W !,"Please CLOSE and CERTIFY this batch then attempt to export it again."
 .S DA(1)=ACRFYDA
 .S DA=ACRBATDA
 .S DIE="^AFSLAFP("_DA(1)_",1,"
 .S DR="4///@;5///@;6///O"
 .D DIE^ACRFDIC
 .K ^AFSLAFP("EXPORT",ACRFYDA,ACRBATDA)
 .I $G(ACRXALL)'="ALL" D PAUSE^ACRFWARN
 D DHRPYN^ACRFPAY2:$G(ACRXALL)'="ALL"
 Q:$D(ACROUT)
 W !!,"Export of "
 W "Batch NO ",$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U)
 W " in progress.  Please stand by...."
 D EN^ACRFEXP2(ACRFYDA,ACRBATDA)
 ;THE SECTION BELOW WILL PRINT OUT PAYMENT NOTIFICATION LETTERS TO
 ;VENDORS FOR ACH BATCHES
 I $P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,8)="A"!($P($G(^(2)),U,8)="B") D
 .;Begin new code ACR*2.1*20.06  IM17145
 .N ACRAO
 .S ACRAO=$P(^AUTTSITE(1,0),U,14)
 .I ACRAO="albaao" Q
 .I ACRAO["bij" S X=138  ;LOCAL MOD BEMIDJI:MRS:6/05/2003
 .;End new code ACR*2.1*20.06  IM17145
 .N X
 .S X=$P(^ACRPO(1,0),U,8)
 .Q:'X
 .S X=$P($G(^AUTTPRG(X,"DT")),U,10)
 .Q:'X
 .S X=$P($G(^%ZIS(1,X,0)),U)
 .Q:X=""
 .S ION=X
 .S (ACRRTN,ZTRTN)="EN^ACRFPAYL"
 .S ZTDESC="PRINT VENDOR PAYMENT LETTERS"
 .S ZTDTH=$H
 .D ZTLOAD^ACRFZIS
 Q
EXALL ;EXPORT ALL BATCHES
 I '$O(^AFSLAFP("EXPORT",0)) D  Q
 .W !!,"No batches found to export"
 S ACRFYDA=0
 F  S ACRFYDA=$O(^AFSLAFP("EXPORT",ACRFYDA)) Q:'ACRFYDA  D
 .S ACRBATDA=0
 .F  S ACRBATDA=$O(^AFSLAFP("EXPORT",ACRFYDA,ACRBATDA)) Q:'ACRBATDA!$D(ACRQUIT)  D
 ..I '$D(^AFSLAFP(ACRFYDA,1,ACRBATDA,0)) K ^AFSLAFP("EXPORT",ACRFYDA,ACRBATDA) Q
 ..D TSCH
 Q:$D(ACRQUIT)
 W !!,"All batches for which a TREASURY SCHEDULE number was entered"
 W !,"will now be exported.  You can find the DHR, TREASURY and ECS"
 W !,"names by referring to function 14 Review Batch STatus."
 W !!,"To continue with the export press <ENTER>."
 W !,"To abort the export enter '^' then press <ENTER>."
 D PAUSE^ACRFWARN
 I $D(ACROUT) W !!,"Export aborted..." H 3 Q
 N ACRFYDAX,ACRBATDX
 S ACRFYDAX=0
 F  S ACRFYDAX=$O(^AFSLAFP("EXPORT",ACRFYDAX)) Q:'ACRFYDAX  D
 .S ACRBATDX=0
 .F  S ACRBATDX=$O(^AFSLAFP("EXPORT",ACRFYDAX,ACRBATDX)) Q:'ACRBATDX  I $P($G(^AFSLAFP(ACRFYDAX,1,ACRBATDX,2)),U,6)]"" D
 ..S ACRFY=$P(^AFSLAFP(ACRFYDAX,0),U)
 ..S ACRBATNO=$P(^AFSLAFP(ACRFYDAX,1,ACRBATDX,0),U)
 ..I '$P(^AFSLAFP(ACRFYDAX,1,ACRBATDX,0),U,5)!($P(^AFSLAFP(ACRFYDAX,1,ACRBATDX,2),U,3)'="C") D  Q
 ...K ^AFSLAFP("EXPORT",ACRFYDAX,ACRBATDX)
 ...W !!,"Batch Number ",ACRBATNO," seems to have either"
 ...W !,"missing Certification Date or is not marked as CLOSED."
 ...H 5
 ..S ACRFYDA=ACRFYDAX
 ..S ACRBATDA=ACRBATDX
 ..D ALL
 Q
TSCH ;TREASURY SCHEDULE NUMBER
 K ACREXP,ACRBSCH
 I '$G(ACRFYDA)!'$G(ACRBATDA) K ACRBSCH Q
 S ACRFY=$P(^AFSLAFP(ACRFYDA,0),U)
 I $E($P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U))="G" D GBATCH Q
 W !!,"BATCH NO................: ",$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0)),U)
 D SCHNO^ACRFPAYS(ACRFYDA,ACRBATDA,.ACRSNO,.ACRQUIT)
 I $G(ACRSNO(1))'?10UN K ACRBSCH Q
 Q:$D(ACROUT)
 S DA(1)=ACRFYDA
 S DA=ACRBATDA
 S DIE="^AFSLAFP("_ACRFYDA_",1,"
 S DR="10////"_ACRSNO(1)
 D DIE^ACRFDIC
 S ACRBSCH=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2)),U,6)
 I ACRBSCH="" D
 .S $P(^AFSLAFP(ACRFYDA,1,ACRBATDA,2),U,6)=ACRSNO(1)
 .S ^AFSLAFP("M",ACRSNO(1),ACRFYDA,ACRBATDA)=""
 .S ^AFSLAFP(ACRFYDA,1,"F",ACRSNO(1),ACRBATDA)=""
 .S ACRBSCH=ACRSNO(1)
 D SSCHUP^ACRFPAY8
 Q
CONFLICT ;CHECK TO ENSURE THAT THERE ARE NO PAYMENTS IN THE BATCH WHICH THE
 ;CERTIFYING OFFICER HAS ENTERED INTO THE BATCH
 N ACRSEQDA,X
 K ACRQUIT
 S ACRSEQDA=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 .I $P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)),U,3)=DUZ S X=^(0) D
 ..I '$D(ACRQUIT) D
 ...W !!,"Batch NO. ",$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U)," contains the following payment(s) which you entered:",!
 ..S ACRQUIT=""
 ..W !,"Payment ",$P(X,U)," to "
 ..W:$P(X,U,10) $P($G(^AUTTVNDR($P(X,U,10),0)),U)
 ..;W:$P(X,U,24) $P($G(^VA(200,$P(X,U,24),0)),U)  ;ACR*2.1*19.02 IM16848
 ..W:$P(X,U,24) $$NAME2^ACRFUTL1($P(X,U,24))  ;ACR*2.1*19.02 IM16848
 Q:'$D(ACRQUIT)
 W !!,"You cannot certify a batch containing payment(s) you entered."
 W !,"Either have someone else certify the batch or"
 W !,"transfer your payments to another batch."
 D PAUSE^ACRFWARN
 S ACRQUIT=""
 Q