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