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

ACRFEXP4.m

Go to the documentation of this file.
ACRFEXP4 ;IHS/OIRM/DSD/AEF - EXPORT TO ECS FILE [ 03/18/2005  8:43 AM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**2,16**;NOV 05, 2001
 ;
 ;ACR*2.1*2.1;THIS ROUTINE IS REWRITTEN TO RESTORE THE ACH-GROUPED
 ;PAYMENTS
 ;
 ;
 ;This routine processes payments from the 1166 Approvals
 ;for Payment file, formats, and places them into the UNIX
 ;ECS file for transmission to Treasury.
 ;
 ;It is expected that the global ^TMP("ACR",$J,"ECS") would
 ;have been built by routine ACRFEXP2 and will contain the
 ;payments to be placed into the ECS file.
 ;
ECS(ACRD0,ACRD1,ACRFIN,ACRALC,ACRRFC,ACRECS)     ;EP
 ;----- MAIN ENTRY POINT
 ;
 ;      INPUT:
 ;      ACRD0  = FY IEN IN 1166 APROVALS FOR PAYMENT FILE
 ;      ACRD1  = BATCH IEN IN 1166 APPROVALS FOR PAYMENT FILE
 ;      ACRFIN = FINANCE LOCATION IEN
 ;      ACRALC = AGENCY LOCATION CODE
 ;      ACRRFC = REGIONAL FINANCE CENTER CODE
 ;
 ;      RETURNS:
 ;      ACRECS = TREASURY ECS FILE NAME
 ;
 N %FILE,ACRACH,ACRAADD1,ACRAADD2,ACRAADD3,ACRAMT,ACRAPHON,ACRAPPN,ACRBTYP,ACRCNT,ACROUT,ACRPCNT,ACRSCH
 ;
 Q:'$D(^TMP("ACR",$J,"ECS"))
 ;
 S ACRECS=$$NEXTECS^ACRFEXPU(ACRD0,ACRD1)
 Q:ACRECS=""
 ;
 D HFS^ACRFEXPU(ACRECS,1,.%FILE,.ACROUT)
 Q:ACROUT
 ;
 D SET1(ACRD0,ACRD1,ACRFIN,.ACRBTYP,.ACRSCH,.ACRACH,.ACRAADD1,.ACRAADD2,.ACRAADD3,.ACRAPHON)
 ;
 D APPN(.ACRAPPN)
 ;
 U %FILE
 D REC01^ACRFEXP5(ACRSCH,ACRRFC,ACRALC,ACRECS,ACRACH,ACRBTYP)
 ;Require records 02,03,09,99 until moved off of old ECS machine  ;ACR*2.1*16.06 IM15505
 D REC02^ACRFEXP5(ACRSCH,ACRALC)
 D REC03^ACRFEXP5(ACRSCH,ACRAADD1,ACRAADD2,ACRAADD3,ACRAPHON)
 ;
 S ACRPCNT=0
 D LOOP(ACRSCH,ACRBTYP,ACRACH,.ACRPCNT,.ACRTAMT)
 ;
 D REC09^ACRFEXP5(ACRPCNT,ACRSCH,ACRTAMT,.ACRAPPN,.ACRCNT)
 D REC99^ACRFEXP5(.ACRCNT,ACRSCH)
 ;
 D ^%ZISC
 ;
 Q
LOOP(ACRSCH,ACRBTYP,ACRACH,ACRPCNT,ACRTAMT)      ;
 ;----- LOOP THROUGH PAYMENTS IN ^TMP("ACR",$J) GLOBAL
 ;THE ACH-GROUPED PAYMENTS
 ;
 N ACRADD,ACRADD1,ACRADD2,ACRAMT,ACRAPPN,ACRATTN,ACRATYP,ACRCITY,ACRD0,ACRD1,ACRD2,ACRDAN,ACRDATA,ACRID,ACRNAME,ACRNID,ACRPDFOR,ACRPMT,ACRRTN,ACRSSN,ACRSTATE,ACRVEND,ACRZIP
 S (ACRPCNT,ACRTAMT)=0
 S ACRVEND=""
 F  S ACRVEND=$O(^TMP("ACR",$J,"ECS",ACRACH,ACRVEND)) Q:ACRVEND']""  D
 . S ACRPMT=0
 . F  S ACRPMT=$O(^TMP("ACR",$J,"ECS",ACRACH,ACRVEND,ACRPMT)) Q:'ACRPMT  D
 . . S ACRPCNT=ACRPCNT+1
 . . S ACRDATA=^TMP("ACR",$J,"ECS",ACRACH,ACRVEND,ACRPMT,0)
 . . S ACRAMT=$P(ACRDATA,U,2)
 . . S ACRTAMT=ACRTAMT+ACRAMT
 . . S ACRD0=$P(ACRDATA,U,3)
 . . S ACRD1=$P(ACRDATA,U,4)
 . . S ACRD2=$P(ACRDATA,U,5)
 . . S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,0))
 . . S ACRSSN=""
 . . I ACRBTYP="V" D
 . . .S ACRSSN=$P(ACRDATA,U,10)
 . . . S ACRSSN=$E($P($G(^AUTTVNDR(ACRSSN,11)),U),2,10)
 . . I ACRBTYP="T" D
 . . . S ACRSSN=$P(ACRDATA,U,24)
 . . . S ACRSSN=$P($G(^VA(200,ACRSSN,1)),U,9)
 . . S ACRATTN=$P(ACRDATA,U,25)
 . . S ACRADD1=$P(ACRDATA,U,28)
 . . S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,1))
 . . S ACRCITY=$E($P(ACRDATA,U),1,19)
 . . S ACRSTATE=$P(ACRDATA,U,2)
 . . S ACRZIP=$P(ACRDATA,U,3)
 . . S ACRNAME=$P(ACRDATA,U,4)
 . . S ACRAPPN=$P(ACRDATA,U,21)
 . . S ACRDATA=$G(^TMP("ACR",$J,"ECS",ACRACH,ACRVEND,ACRPMT,0))
 . . S ACRPDFOR=$P(ACRDATA,U,6)
 . . ;I ACRACH="A" D                                                ;ACR*2.1*16.06 IM15505
 . . . ;Q:"REF*^RMT*^RMR*"[$E(ACRPDFOR,1,4)                         ;ACR*2.1*16.06 IM15505
 . . . ;S ACRPDFOR=$E(ACRPDFOR,1,30)                                ;ACR*2.1*16.06 IM15505
 . . . ;S ACRPDFOR="RMT*"_$S(ACRBTYP="T":"VV",1:"IV")_"*"_ACRPDFOR  ;ACR*2.1*16.06 IM15505
 . . . ;S ACRPDFOR=ACRPDFOR_"*"_$P(ACRDATA,U,2)                     ;ACR*2.1*16.06 IM15505
 . . . ;S ACRPDFOR=$TR(ACRPDFOR,"\","")_"\"                         ;ACR*2.1*16.06 IM15505
 . . K ACRID,ACRNID
 . . S ACRID(1)=ACRPDFOR
 . . S ACRNID=1
 . . I ACRACH="C" D
 . . . S ACRNID=0
 . . . F I=1:1:14 I $D(^TMP("ACR",$J,"ECS",ACRACH,ACRVEND,ACRPMT,I,0)) D
 . . . . S ACRNID=ACRNID+1
 . . . . S ACRID(ACRNID)=$P(^TMP("ACR",$J,"ECS",ACRACH,ACRVEND,ACRPMT,I,0),U,6)
 . . S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,2))
 . . S ACRADD2=$P(ACRDATA,U,7)
 . . S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,1,ACRD2,19))
 . . S ACRATYP=$P(ACRDATA,U)
 . . S ACRRTN=$P(ACRDATA,U,2)
 . . S ACRDAN=$P(ACRDATA,U,3)
 . . K ACRADD
 . . S ACRADD=0
 . . I ACRATTN]"" D
 . . .S ACRADD=1
 . . . S ACRADD(ACRADD)="ATTN: "_ACRATTN
 . . I ACRADD1]"" D
 . . . S ACRADD=ACRADD+1
 . . . S ACRADD(ACRADD)=ACRADD1
 . . I ACRADD2]"" D
 . . .S ACRADD=ACRADD+1
 . . .S ACRADD(ACRADD)=ACRADD2
 . . S ACRADD=ACRADD+1
 . . S ACRADD(ACRADD)=ACRCITY_", "_ACRSTATE_"  "_ACRZIP
 . . I ACRACH="C"!(ACRACH="N") D
 . . . D RECC04^ACRFEXP5(.ACRPCNT,ACRSCH,ACRAMT,ACRNAME,.ACRADD,ACRAPPN,ACRSSN,ACRNID,.ACRID)
 . . . D RECC05^ACRFEXP5(ACRPCNT,ACRSCH,.ACRID)
 . . . D RECC06^ACRFEXP5(ACRPCNT,ACRSCH,.ACRID)
 . . I ACRACH="A"!(ACRACH="B") D
 . . .D RECA04^ACRFEXP5(.ACRPCNT,ACRSCH,ACRATYP,ACRSSN,ACRAMT,ACRNAME,ACRRTN,ACRDAN,ACRAPPN,ACRPDFOR,ACRBTYP)
 Q
SET1(ACRD0,ACRD1,ACRFIN,ACRBTYP,ACRSCH,ACRACH,ACRAADD1,ACRAADD2,ACRAADD3,ACRAPHON)       ;
 ;----- SETUP REQUIRED HEADER/TRAILER RECORD VARIABLES
 ;
 N ACRDATA,ACRSTATE
 S ACRBTYP=$P($G(^AFSLAFP(ACRD0,1,ACRD1,0)),U,4)
 S ACRDATA=$G(^AFSLAFP(ACRD0,1,ACRD1,2))
 S ACRSCH=$P(ACRDATA,U,6)
 S ACRACH=$P(ACRDATA,U,8)
 ;
 S ACRDATA=$G(^AUTTPRG(ACRFIN,"DT"))
 S ACRAADD1=$P(ACRDATA,U)
 S ACRAADD2=$P(ACRDATA,U,2)
 S ACRAADD3=$P(ACRDATA,U,3)
 S ACRSTATE=$P(ACRDATA,U,4)
 I ACRSTATE S ACRSTATE=$P($G(^DIC(5,ACRSTATE,0)),U,2)
 S ACRAADD3=ACRAADD3_", "_ACRSTATE_"  "_$P(ACRDATA,U,5)
 S ACRAPHON=$TR($P(ACRDATA,U,6),"-","")
 Q
APPN(ACRAPPN)      ;
 ;----- SETS APPROPRIATION NUMBER ARRAY USED FOR 09 RECORDS
 ;
 N ACRCNT
 S ACRCNT=0
 F  S ACRCNT=$O(^TMP("ACR",$J,"ECSAPPN",ACRCNT)) Q:'ACRCNT  D
 . S ACRAPPN(ACRCNT)=^TMP("ACR",$J,"ECSAPPN",ACRCNT,0)
 Q