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

ACRFPAY8.m

Go to the documentation of this file.
ACRFPAY8 ;IHS/OIRM/DSD/THL,AEF - CERTIFY AND EXPORT PAYMENT BATCH;  [ 11/01/2001   9:44 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;;NOV 05, 2001
 ;;
VENDOR ;EP;SELECT VENDOR
 S DIC="^AUTTVNDR("
 S DIC(0)="AEMQZ"
 S DIC("A")="VENDOR NAME OR EIN..: "
 S DIC("S")="I $P($G(^(11)),U)]"""",$P($G(^(13)),U)]""""&($P($G(^(13)),U,4)]"""")!($P($G(^(14)),U)]""""&($P($G(^(14)),U,4)]""""))"
 I $G(ACRACH)]"","AB"[ACRACH S DIC("S")=DIC("S")_",$P($G(^(19)),U)]"""""
 S:$P($G(^AUTTVNDR(+$G(ACRVDA),0)),U) DIC("B")=$P(^(0),U)
 I $G(ACRREF)=618,$G(ACRVDAT),$P($G(^AUTTVNDR(ACRVDAT,0)),U)]"" S DIC("B")=$P(^(0),U)
 K ACRVDAT
 D DIC^ACRFDIC
 I X["^" S ACROUT="" Q
 I $D(DTOUT)!($D(DUOUT)) S ACROUT="" Q
 I +Y<1 W !!,"VENDOR'S NAME REQUIRED",! G VENDOR
 S (ACRVDA,ACRVDAX)=+Y
 S:$G(ACRREF)=618 ACRVDAT=+Y
 Q
LCOD ;EP;SELECT LOCATION CODE
 S DIC="^AUTTLCOD("
 S DIC(0)="AEMQZ"
 S DIC("A")="LOCATION CODE.......: "
 D DIC^ACRFDIC
 I X["^" S ACROUT="" Q
 I $D(DTOUT)!($D(DUOUT)) S ACROUT="" Q
 I +Y<1 W !!,"LOCATION CODE REQUIRED",! G LCOD
 S $P(ACRLBDT,U,11)=+Y
 Q
TRAVELER ;EP;SELECT TRAVERER
 S DIC="^ACRAU("
 S DIC(0)="AEMQZ"
 S DIC("A")="TRAVELER............: "
 D DIC^ACRFDIC
 I X["^" S ACROUT="" Q
 I $D(DTOUT)!($D(DUOUT)) S ACROUT="" Q
 I +Y<1 W !!,"TRAVELER'S NAME REQUIRED",! G TRAVELER
 S ACRDUZ=+Y
 Q
CCOMPLET ;EP;COMPLETE THE COMBINATION/TRANSFER OF BATCHES
 S DIR(0)="YO"
 S DIR("A",1)="Are you ABSOLUTELY CERTAIN you want to combine"
 S DIR("A")="the(se) SOURCE batches into the DESTINATION Batch."
 S DIR("B")="NO"
 W !
 D DIR^ACRFDIC
 Q:+Y'=1
 S ACRS=0
 F  S ACRS=$O(ACR("SOURCE",ACRS)) Q:'ACRS  D
 .S X=ACR("SOURCE",ACRS)
 .S ACRSBAT=+X
 .S ACRSFY=$P(X,U,2)
 .Q:'ACRSBAT
 .S ACRSS=0
 .F  S ACRSS=$O(^AFSLAFP(ACRSFY,1,ACRSBAT,1,ACRSS)) Q:'ACRSS  D TRANSFER^ACRFPAY2
 Q
CSELECT K ACRDEST,ACRACH,ACRX
 Q
BSTATUS ;EP;TO PRINT BATCH STATUS
 Q:$G(ACRXALL)="ALL"
 F  D BS Q:$D(ACRQUIT)!$D(ACROUT)
 K ACRQUIT
 Q
BS K ACRFYDA,ACRBATDA
 W @IOF
 W !!,"Select Fiscal Year and Batch number for the"
 W !,"Batch STATUS Report"
 D FYBAT^ACRFPAY2
 I '$G(ACRFYDA)!'$G(ACRBATDA) S ACRQUIT="" Q
 N ACR0,ACR1,ACR2
 D BS1
 Q
BS1 ;EP;
 Q:$G(ACRXALL)="ALL"
 Q:'$G(ACRFYDA)!'$D(ACRBATDA)
 S ACR0=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0))
 S ACR1=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1))
 S ACR2=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2))
 W @IOF
 W !?20,"Batch STATUS Report"
 W !?20,"Report Date: "
 S Y=DT
 X ^DD("DD")
 W Y
 W !!,"Fiscal Year.......: ",ACRFY
 W !,"Batch Number......: ",ACRBATNO
 W !,"Treasury Schedule.: ",$P(ACR2,U,6)
 W:$P(ACR2,U,8)]"" !,"Schedule Format...: ",$P($P($P($G(^DD(9002325.01,22,0)),U,3),$P(ACR2,U,8)_":",2),";")
 I '$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,0)) W " (This batch has no payments)"
 W !,"Payment Due.......: "
 I $P(ACR2,U,2) D  I 1
 .S Y=$P(ACR2,U,2)
 .X ^DD("DD")
 .W Y
 W !,"Payment Open/Clsd.: "
 W $S($P(ACR2,U,3)="O":"OPEN",$P(ACR2,U,3)="C":"CLOSED",1:"NOT SPECIFIED")
 W !,"Payment Certified.: "
 I $P(ACR0,U,5) D  I 1
 .S Y=$P(ACR0,U,5)
 .X ^DD("DD")
 .W Y
 E  W "Not yet certified"
 W !,"Payment Exported..: "
 I $P(ACR2,U) D  I 1
 .S Y=$P(ACR2,U)
 .X ^DD("DD")
 .W Y
 E  W "Not yet exported"
 I $P(ACR2,U,11)]"" W !,"ECS FileName......: ",$P(ACR2,U,11)
 K ACRAPPN
 N ACRSEQDA,ACRTOT,ACRTOTC,J,K
 S (ACRSEQDA,J,K,ACRTOT,ACRTOTC)=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 .S ACRTCODE=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)),U,18)
 .S ACRAMT=+$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)),U,11)
 . S ACRBTYP=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0)),U,4)
 . S ACRAMT=$S(ACRBTYP="T":$$NET^ACRFSSU(ACRFYDA,ACRBATDA,ACRSEQDA),1:ACRAMT)
 .I ACRTCODE'=23717 D
 ..S J=J+1
 ..S ACRTOT=ACRTOT+ACRAMT
 .I ACRTCODE=23717 D
 ..S K=K+1
 ..S ACRTOTC=ACRTOTC+ACRAMT
 W !,"Number of Paymts..: ",J
 W !,"Tot amt of Paymts.: ",$J($FN(ACRTOT,"P,",2),12)
 I K D
 .W !,"Number of Credits.: ",K
 .W !,"Tot amt of Credits: ",$J($FN(ACRTOTC,"P,",2),12)
 .W !?21,"------------"
 .W !,"Actual Payment....: ",$J($FN(ACRTOT-ACRTOTC,"P,",2),12)
 W !
 D PAUSE^ACRFWARN:$G(ACRXALL)'="ALL"
 D APPSUM
 Q
BANK ;UPDATE BANK ROUTINE INFORMATION
 N X,Y,ACRCHK,ACRRTN,ACRDAN
 S X=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0),U,10)
 I X D  Q:$P(Y,U)=""
 .S Y=$G(^AUTTVNDR(X,19))
 I 'X S X=$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0),U,24) D:X  Q:$P(Y,U)=""
 .S Y=$G(^ACRAU(X,19))
 Q:$P(Y,U)=""
 S ACRCHK=$P(Y,U)
 S ACRRTN=$P(Y,U,2)
 S ACRDAN=$P(Y,U,3)
 S DA(2)=ACRFYDA
 S DA(1)=ACRBATDA
 S DA=ACRSEQDA
 S DIE="^AFSLAFP("_DA(2)_",1,"_DA(1)_",1,"
 S DR="1901////"_ACRCHK_";1902////"_ACRRTN_";1903////"_ACRDAN
 D DIE^ACRFDIC
 Q
SSCHUP ;EP;
 Q:$E($P(^AFSLAFP(ACRFYDA,1,ACRBATDA,0),U))="G"
 N ACRSEQDA,ACRJ,ACR1
 S (ACRSEQDA,ACRJ)=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA!$D(ACRQUIT)  D
 .Q:'$D(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0))  S ACR1=$G(^(1))
 .S ACRJ=ACRJ+1
 .I $G(ACRBSCH)]"",$P(ACR1,U,11)'=ACRBSCH D SSCH
 .D BANK:"AB"[$P(^AFSLAFP(ACRFYDA,1,ACRBATDA,2),U,8)
 Q
SSCH ;UPDATE SEQUENCE ENTRY SCHEDULE NUMBER
 S DA(2)=ACRFYDA
 S DA(1)=ACRBATDA
 S DA=ACRSEQDA
 S DIE="^AFSLAFP("_DA(2)_",1,"_DA(1)_",1,"
 S DR="40////"_ACRBSCH
 D DIE^ACRFDIC
 I $P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,1)),U,11)="" S $P(^(1),U,11)=ACRBSCH
 Q
APPSUM ;EP;APPROPRIATION SUMMARY
 Q:$G(ACRXALL)="ALL"
 K ACRQUIT
 D APPSUMH
 N ACRSEQDA,Y,Z
 S ACRSEQDA=0
 F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 .S X=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0))
 .S Y=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,1))
 .S:$P(Y,U,21)="" $P(Y,U,21)="NOT STATED"
 .S Z=$P(X,U,18)
 .S:'$D(ACRAPPN($P(Y,U,21))) ACRAPPN($P(Y,U,21))=""
 . S ACRBTYP=$P($G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0)),U,4)
 . I Z'=23717 S ACRAPPN($P(Y,U,21))=ACRAPPN($P(Y,U,21))+$S(ACRBTYP="V":+$P(X,U,11),ACRBTYP="T":$$NET^ACRFSSU(ACRFYDA,ACRBATDA,ACRSEQDA),1:0)
 .E  S ACRAPPN($P(Y,U,21))=ACRAPPN($P(Y,U,21))-$P(X,U,11)
 S Z=0
 S X=""
 F  S X=$O(ACRAPPN(X)) Q:X=""!$D(ACRQUIT)  S Z=Z+ACRAPPN(X)
 S X=""
 F  S X=$O(ACRAPPN(X)) Q:X=""!$D(ACRQUIT)  D
 .W !?10,X,?25,$J($FN(+ACRAPPN(X),"P,",2),15)
 .I IOSL-4<$Y D  Q:$D(ACRQUIT)
 ..N X,Y,Z
 ..D PAUSE^ACRFWARN
 ..Q:$D(ACRQUIT)
 ..D APPSUMH
 D AH1
 W !?25,$J($FN(Z,"P,",2),15)
 K ACRAPPN
 D PAUSE^ACRFWARN
 Q
APPSUMH ;APPROPRIATION SUMMARY HEADER
 W @IOF
 W !!,"Appropriation Summary "
 W:$G(ACRBATNO)]"" "Batch NO. ",ACRBATNO
 W:$G(ACRSCHNO)]"" " Schedule NO. ",ACRSCHNO
 W !!?10,"APPROPRIATION",?25,"AMOUNT"
AH1 W !?10,"-------------",?25,"---------------"
 Q
EXPLIST ;EP;TO PRINT LIST OF EXPORT FILES FOR SPECIFIED DATE
 D EXPEXIT
 F  D EXP1 Q:$D(ACRQUIT)!$D(ACROUT)
EXPEXIT K ACRQUIT,ACRDC
 K ^TMP("ACREXP",$J)
 Q
EXP1 ;
 D EXPEXIT
 W @IOF
 W !?17,"Enter the EXPORT DATE(S)",!
 D DATES^ACRFDATE
 I '$G(ACRBEGIN) S ACRQUIT="" Q
 S (ACRRTN,ZTRTN)="EXP2^ACRFPAY8"
 S ZTDESC="LIST OF BATCHES EXPORTED ON SPECIFIC DATE"
 D ^ACRFZIS
 Q
EXP2 ;EP;TO PRINT LIST OF BATCHES EXPORTED ON SPECIFIC DATE
 K ACRQUIT
 N ACRX,ACRY,ACRZ,ACRDC,ACRXX,ACRXY,Z
 S ACRDATE=ACRBEGIN-.0001
 F  S ACRDATE=$O(^AFSLAFP("EXP",ACRDATE)) Q:'ACRDATE!(ACRDATE>(ACREND+.9999))  D
 .S ACRFYDA=0
 .F  S ACRFYDA=$O(^AFSLAFP("EXP",ACRDATE,ACRFYDA)) Q:'ACRFYDA  D
 ..S ACRBATDA=0
 ..F  S ACRBATDA=$O(^AFSLAFP("EXP",ACRDATE,ACRFYDA,ACRBATDA)) Q:'ACRBATDA  D
 ...N X,Y,Z,T1,T2,N1,N2
 ...S (ACRSEQDA,N1,T1,N2,T2)=0
 ...F  S ACRSEQDA=$O(^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA)) Q:'ACRSEQDA  D
 ....S X=^AFSLAFP(ACRFYDA,1,ACRBATDA,1,ACRSEQDA,0)
 ....S Y=$P(X,U,18)
 ....I Y'=23717 S N1=N1+1,T1=T1+$P(X,U,11)
 ....I Y=23717 S N2=N2+1,T2=T2+$P(X,U,11)
 ...S ACRY=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,0))
 ...S ACRZ=$G(^AFSLAFP(ACRFYDA,1,ACRBATDA,2))
 ...S ^TMP("ACREXP",$J,ACRDATE,$S($P(ACRZ,U,11)]"":$P(ACRZ,U,11),1:"NOT STATED"),ACRBATDA)=$P(ACRY,U)_U_$P(ACRZ,U,6)_U_$P(ACRZ,U,11)_U_$P(ACRZ,U,8)_U_N1_U_T1_U_N2_U_T2
 I '$D(^TMP("ACREXP",$J)) D
 .W !,"No EXPORTS recorded on "
 .S Y=ACRBEGIN
 .X ^DD("DD")
 .W Y
 S ACRDATE=""
 F  S ACRDATE=$O(^TMP("ACREXP",$J,ACRDATE)) Q:ACRDATE=""!$D(ACROUT)  D
 .D EXPH
 .S ACRXX=""
 .F  S ACRXX=$O(^TMP("ACREXP",$J,ACRDATE,ACRXX)) Q:ACRXX=""!$D(ACROUT)  D
 ..S ACRXY=0
 ..F  S ACRXY=$O(^TMP("ACREXP",$J,ACRDATE,ACRXX,ACRXY)) Q:'ACRXY!$D(^ACROUT)  D
 ...S Z=^TMP("ACREXP",$J,ACRDATE,ACRXX,ACRXY)
 ...W !,$P(Z,U),?8,$P(Z,U,2),?20,$P(Z,U,3),?30
 ...W $S($E($P(Z,U,4))="C":"CHECKS",$E($P(Z,U,4))="A":"GROUPD",$E($P(Z,U,4))="B":"NOTGPD",$E($P(Z,U,4))="G":"DHRONL",1:"")
 ...W ?38,$J($P(Z,U,5),3),?42,$J($FN($P(Z,U,6),"P,",2),15)
 ...W ?59,$J($P(Z,U,7),3),?63,$J($FN($P(Z,U,8),"P,",2),15)
 ...I IOSL-4<$Y D PAUSE^ACRFWARN Q:$D(ACROUT)  D EXPH
 ...K ACRQUIT
 .D PAUSE^ACRFWARN
 Q
EXPH ;EXPORT LIST HEADER
 W @IOF
 W !?10,"List of files exported on "
 S Y=ACRDATE
 X ^DD("DD")
 W Y
 W !?10,"Report Date: "
 S Y=DT
 X ^DD("DD")
 W Y
 S ACRDC=$G(ACRDC)+1
 W ?55,"PAGE: ",ACRDC
 W !?40,"PAYMENTS",?62,"CREDITS"
 W !,"BATCH",?8,"SCHD",?20,"ECS FILE",?30,"FORMAT",?38,"NO.",?44,"AMOUNT",?59,"NO.",?66,"AMOUNT"
 W !,"------",?8,"------",?20,"--------",?30,"------",?38,"---",?42,"---------------",?59,"---",?63,"---------------"
 Q