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

ACRFIV13.m

Go to the documentation of this file.
ACRFIV13 ;IHS/OIRM/DSD/THL,AEF - CREATE PAYMENT RECORDS IN 1166 PACKAGE;  [ 05/27/2005  3:18 PM ]
 ;;2.1;ADMIN RESOURCE MGT SYSTEM;**16,17**;JUL 31, 2001
 ;ACR*2.1*16.06 IM15505    ;NEW ROUTINE
 ;
 ;CREATE NEW 1166 BATCHES AND SEQUENCE NO. ENTRIES, CONTINUED FROM IV11
 ;
EN(ACRA,ACRB,ACRC,ACRD,ACRE) ;EP; CALLED BY ACRFIV11
 ;----- SET VARIABLES FOR PAYMENT
 ;NOTE: VARIABLES ARE RESET BECAUSE TRAVEL ENTRY DOES NOT BRING IN THEM IN
 ;
 N ACRTMP,ACRTMP2,ACRADDN,ACRTADD
 S ACRDOC=$G(ACRDOC)
 S ACRDOC2=$G(ACRDOC2)
 S ACRDOCDA=$G(ACRDOCDA)
 S ACRTADD=""
 S ACRLBDA=$G(ACRLBDA)
 S ACRLBDT=$G(ACRLBDT)
 S ACRFYFUN=$G(ACRFYFUN)
 S ACRINV=$G(ACRINV)
 S ACRIVDC=$G(ACRIVDC)
 S ACRIVTF=$G(ACRIVTF)
 S ACRTERMS=$G(ACRTERMS)
 S ACRTCODE=$G(ACRTCODE)
 S ACRFINAL=$G(ACRFINAL)
 S ACRREF2=$G(ACRREF2)
 S ACRP=$G(ACRP)
 I '$D(ACRREF) S ACRREF=ACRREF1
 ;I $P(ACRTERMS,U,14)>-1 S ACRTADD=ACRTERMS ;CAPTURE DISCOUNT INFO ;ACR*2.1*17.01 IM17097
 I $P(ACRTERMS,U,14)]"",$P(ACRTERMS,U,14)>-1 S ACRTADD=ACRTERMS ;CAPTURE DISCOUNT INFO ACR*2.1*17.01 IM17097
 D TERMS(.ACRTADD,.ACRIVTF,.ACRINV)        ;SET STRING FOR ACH ADDENDUM CALL
 D GET
 S ACRADDN=$$EN^ACRFACH($G(ACRDOCDA),ACRDOC,.ACRTADD,ACRTCODE,ACRREF)
 D SET
 Q
GET ;----- GATHER ALL DATA FOR THE PAYMENT ENTRY
 ;
 I ACRDOCDA]"" D
 .S:ACRLBDA="" ACRLBDA=$P(^ACRDOC(ACRDOCDA,0),U,6)
 .S:ACRLBDT="" ACRLBDT=$G(^ACRLOCB(ACRLBDA,"DT"))        ;FMS DEPT
 .S:ACRFYFUN="" ACRFYFUN=$$FYFUN^ACRFUTL1(ACRLBDA)       ;FY OF FUNDS
 S ACRFY=$S($L(+ACRLBDT)=4:$E(+ACRLBDT,3,4),1:+ACRLBDT)  ;CURRENT FY
 S ACRDFYDA=$O(^AFSLODOC("B",ACRFYFUN,0))
 I "^130^600^602^"'[(U_ACRREF_U)!(ACRBTYP="V"&$G(ACRVDA)) D
 .D VENDOR^ACRFIV12
 ;I ACRBTYP="T","^130^600^602^618^"[(U_ACRREF_U) D      ;ACR*2.1*3.33
 I ACRBTYP="T","^130^148^600^602^618^"[(U_ACRREF_U) D   ;ACR*2.1*3.33
 .D TRAVELER^ACRFIV12
 S:ACRDOC["-" ACRDOC=$$DOC^ACRFUTL(ACRDOC)
 S:ACRDOC2="" ACRDOC2=ACRDOC
 S:ACRDOC2["-" ACRDOC2=$$DOC^ACRFUTL(ACRDOC2)
 S:ACRREF=618 ACRGTA=$P($G(^ACRSYS(1,"DT1")),U,14)
 I "^21^22^23^"[(U_$E($P($G(^AUTTOBJC(+$G(ACROBJDA),0)),U),1,2)_U) D
 .I $E(ACRTCODE,1,3)=181!($E(ACRTCODE,1,3)=191) D
 ..S $E(ACRTCODE,3)=2
 .Q
 I "^21^22^23^"'[(U_$E($P($G(^AUTTOBJC(+$G(ACROBJDA),0)),U),1,2)_U) D
 .I $E(ACRTCODE,1,3)=182!($E(ACRTCODE,1,3)=192) D
 ..S $E(ACRTCODE,3)=1
 .Q
 I $P($G(^ACRSYS(1,"DT1")),U,5)=1 D
 .I $E(ACRTCODE,1,3)=181!($E(ACRTCODE,1,3)=191) D
 ..S $E(ACRTCODE,3)=2
 .Q
 S $P(ACRTADD,U,6,9)=ACRBTYP_U_ACRACH_U_ACRTCODE_U_ACRFINAL
 I $P(ACRTERMS,U,14)]"" D
 .S $P(ACRTERMS,U,4)=ACRINV                     ;CAPTURE INVOICE
 .S $P(ACRTERMS,U,6,7)=ACRBTYP_U_ACRACH
 .S $P(ACRTERMS,U,9)=ACRFINAL
 Q
 ;
TERMS(ACRTADD,ACRIVTF,ACRINV) ;
 ;----- SET ACRTADD FOR ACH ADDENDUM, ALLOW ENTRY FROM EDIT BATCH
 ;
 ;I $P(ACRTERMS,U,14)>-1 D                       ;ACR*2.1*17.01 IM17097
 I $P(ACRTERMS,U,14)]"",$P(ACRTERMS,U,14)>-1 D   ;ACR*2.1*17.01 IM17097
 .S ACRTADD=ACRTERMS                             ;CAPTURE DISCOUNT INFO
 .S $P(ACRTADD,U,2)=ACRIVDC
 .S $P(ACRTADD,U,8)=ACRTCODE
 S $P(ACRTADD,U,5)=ACRIVTF  ; INVOICE/PAY AMOUNT
 I ACRINV="" D
 .S ACRTMP=$O(^TMP("ACRINV",$J,""))
 .Q:ACRTMP=""
 .S ACRINV=$P(^TMP("ACRINV",$J,ACRTMP),U,2) ;INVOICE NUMBER
 Q:ACRINV=""
 S:$P(ACRTADD,U,4)="" $P(ACRTADD,U,4)=ACRINV       ; CAPTURE INVOICE
 Q
 ;
SET ;----- SETS VARIABLES INTO ACRA,ACRB,ACRC,ACRD,ACRE
 ; RETURNED FOR SET INTO AFSLAFP
 ;
 ;         SEQUENCE NO
 S $P(ACRA,U,1)=ACRSEQNO
 ;
 ;         SEQ FY OF FUNDS (FY OF FUNDS)
 S $P(ACRA,U,2)=$E(ACRFYFUN,4)
 ;
 ;         [2]DATA ENTRY USER ID
 S $P(ACRA,U,3)=DUZ
 ;
 ;         [10]RECORD TYPE; ALWAYS NUMBER 2
 S $P(ACRA,U,4)=2
 ;
 ;         [11]REFERENCE CODE
 ;S $P(ACRA,U,5)=$S(ACRREF=600:130,ACRREF=602:"   ",1:ACRREF) ;ACR*2.1*3.05
 S $P(ACRA,U,5)=$S(ACRREF=600:130,ACRREF=602:130,1:ACRREF)  ;ACR*2.1*3.05
 ;
 ;         [12]OTHER DOCUMENT REF
 S ACRTMP=$S(ACRREF2]"":ACRREF2,ACRREF'=600:617,1:600)
 S:ACRREF=602 ACRTMP=602
 S $P(ACRA,U,6)=ACRTMP
 ;
 ;         [13]CAN
 S $P(ACRA,U,7)=ACRCANDA
 ;
 ;         [14]SUB-OBJECT CLASS
 S $P(ACRA,U,8)=ACROBJDA
 ;
 ;         [15]DOC-TYP
 S $P(ACRA,U,9)=$E($G(ACR15),1,2)
 ;
 ;         [16]VENDOR-EIN
 S $P(ACRA,U,10)=$G(ACR16)
 ;
 ;         [17]DOLLAR AMOUNT
 S ACR17=$$17(ACRIVTF)
 S $P(ACRA,U,11)=ACR17
 ;
 ;         [18]DIS-AMT;ACRFIV12
 S ACRTMP=""
 I '$G(ACR18),$E(ACRTCODE,1,3)="061" S ACR18=+$G(ACRIVTF) ;TA
 S:+$G(ACR18) ACRTMP=$$17(ACR18)
 S:$G(ACRIVDC)]"" ACRTMP=ACRIVDC
 S $P(ACRA,U,12)=ACRTMP
 ;
 ;         [19]AFP-PAY-DATE
 S $P(ACRA,U,13)=$G(ACR19)
 ;
 ;         [21]FED-CD(FED/NON FED SOURCE)
 S $P(ACRA,U,15)=$S(ACRREF'=210:1,1:2)
 ;
 ;         [22]PAY-CD;SET ELSEWHERE
 S $P(ACRA,U,16)=ACRFINAL
 ;
 ;         [23]PIG-WK;SET ELSEWHERE
 S $P(ACRA,U,17)=$G(ACR23)
 ;
 ;         [24]TRN-CD
 S $P(ACRA,U,18)=ACRTCODE
 ;
 ;         [25]OTH-TRN-CD;SET ELSEWHERE
 S $P(ACRA,U,19)=$G(ACR25)
 ;
 ;         [11.5]DOCUMENT NO
 S ACRTMP=$E(ACRDOC,1,10)
 S ACRTMP=$E("0000000000",1,10-$L(ACRTMP))_ACRTMP
 S $P(ACRA,U,20)=ACRTMP
 ;
 ;         [12.5]OTHER DOCUMENT NO
 S ACRTMP2=$E(ACRDOC2,1,10)
 S ACR125=$E("0000000000",1,10-$L(ACRTMP2))_ACRTMP2
 S $P(ACRA,U,21)=$S(ACRTMP2]"":ACRTMP2,1:ACRTMP)
 ;
 ;         [3]PAYMENT TYPE;ACRFIV12
 S $P(ACRA,U,22)=$G(ACR3)
 ;
 ;         [26]PROVIDER-EIN/SSN;SET ?
 S $P(ACRA,U,23)=$G(ACR26)
 ;
 ;         [27]EMPLOYEE-SSN;ACRFIV12
 S $P(ACRA,U,24)=$G(ACR27)
 ;
 ;         [28]PAY ATTENTION;ACRFIV12
 S $P(ACRA,U,25)=$G(ACR28)
 ;
 ;         [50]EXPORTED Y/N
 S $P(ACRA,U,26)=$G(ACR50)
 ;
 ;         [51]DELETE FLAG
 S $P(ACRA,U,27)=$G(ACR51)
 ;
 ;         [29]PAY ADDRESS; ACRFIV12
 S $P(ACRA,U,28)=$G(ACR29)
 ;
ACRB ; Start setting ACRB
 ;
 ;         [30]PAY CITY; ACRFIV12
 S $P(ACRB,U)=$G(ACR30)
 ;
 ;         [31]PAY STATE; ACRFIV12
 S $P(ACRB,U,2)=$G(ACR31)
 ;
 ;         [32]PAY ZIP; ACRFIV12
 S $P(ACRB,U,3)=$G(ACR32)
 ;
 ;         [33]PAY NAME; ACRFIV12
 S $P(ACRB,U,4)=$G(ACR33)
 ;
 ;         [34]INT-SQ       ; NOT SET ANYWHERE
 S $P(ACRB,U,5)=$E($G(ACR34),1,11)
 ;
 ;         [35]INT-AMT  INTEREST AMOUNT
 S ACR35=$G(ACRIVDIS(ACRCANDA,ACROBJDA,"P"))
 S:+ACR35>0 ACR35=$$17(ACR35)
 S $P(ACRB,U,6)=ACR35         ; FIELD ALSO SET IN MORE^ACRFIV11
 ;
 ;         [36]DOC-PMT NODE
 S $P(ACRB,U,7)=1
 ;
 ;         [37]INT-DOC
 S $P(ACRB,U,8)=$E($G(ACR37),1,10)
 ;
 ;         [38]COST CTR
 S $P(ACRB,U,9)=$P(ACRLBDT,U,15)
 ;
 ;         [39]SECONDARY RECIPIENT
 S $P(ACRB,U,10)=$E($G(ACR39),1,15)
 ;
 ;         [40]PMT/COLL DOCUMENT
 S $P(ACRB,U,11)=$E(ACRBATNO,1,6)
 ;
 ;         [41]V-ADR CHNGE
 S $P(ACRB,U,12)=$G(ACR41)
 ;
 ;         [42]E-ADR CHNGE
 S $P(ACRB,U,13)=$G(ACR42)
 ;
 ;         [52]DATE OF SERVICE
 S $P(ACRB,U,14)=$G(ACR52)
 ;
 ;         [43]DOC-YR NODE (FY OF FUNDS)
 S $P(ACRB,U,15)=$E(ACRFYFUN,4)
 ;
 ;         [44]DOC-NODE
 S $P(ACRB,U,16)=$G(ACRODDA)
 ;
 ;         [55]CERTIFIED FLAG
 S $P(ACRB,U,17)=$G(ACR55)
 ;
 ;         [45]LOC CODE
 S $P(ACRB,U,18)=$P($G(ACRLBDT),U,11)
 ;
 ;         [46]PIG-P/F
 S $P(ACRB,U,19)=$G(ACR46)
 ;
 ;         [56]VENDOR-EIN-SFX
 S $P(ACRB,U,20)=$G(ACR56)
 ;
 ;         [57]APPROPRIATION
 S ACRTMP=$E($P($G(^AUTTPRO(+$P(ACRLBDT,U,4),0)),U),1,18)
 S $P(ACRB,U,21)=ACRTMP
 ;
 ;         [58]PAY-ID
 S $P(ACRB,U,22)=$E($G(ACR58),1,12)
 ;
 ;         [59]ORIGINAL OBLIG.AMT
 S $P(ACRB,U,23)=$$DOL^ACRFUTL($P(ACRTADD,U,10))
 ;
 ;         [60]OBLIG.-DATE OF
 S $P(ACRB,U,24)=$P(ACRTADD,U,11)
 ;
 ;         [61]DOC-YEAR
 S $P(ACRB,U,25)=$S(ACRREF'=116:$E(ACRDOC),1:$E(ACRDOC,6))
 ;
ACRC ; Start setting ACRC
 ;
 ;         [62]PMT DUE-DATE
 S $P(ACRC,U,1)=$G(ACRPAYDU)
 ;
 ;         [63]ACH ADDENDUM 
 S $P(ACRC,U,2)=ACRADDN
 ;
 ;         [64]ACHT-POINTER;ACRFIV12
 S $P(ACRC,U,3)=$G(ACR64)
 ;
 ;         [65]ACHV-POINTER;ACRFIV12
 S $P(ACRC,U,4)=$G(ACR65)
 ;
 ;         [66]PARMFILE-POINTER
 S $P(ACRC,U,5)=$G(ACR66)
 ;
 ;         [67]TREASURY#
 S $P(ACRC,U,6)=$G(ACR67)
 ;
 ;         [68]PAY ADDRSS-2;ACRFIV12
 S $P(ACRC,U,7)=$G(ACR68)
 ;
 ;         INVOICE NUMBERS 
 S ACR4=ACRINV
 S:ACRBTYP="T" ACR4=ACRDOC
 ;I ACRACH="C"!(ACRACH="N"),ACRBTYP="V",$D(^TMP("ACRINV",$J)) D  ;ACR*2.1*16.06 IM15505
 ;.S ACR4=$$INVC(ACRINV)                       ;MULTIPLE INVOICE NUMBERS  ;ACR*2.1*16.06 IM15505
 I ACRBTYP="V",$D(^TMP("ACRINV",$J)) D                           ;ACR*2.1*16.06 IM15505
 .I ACRACH="C"!(ACRACH="A") S ACR4=$$INVC(ACRINV) Q  ;MULTIPLE INVOICES  ;ACR*2.1*16.06 IM15505
 I ACR4="" S ACR4=ACRDOC
 S $P(ACRC,U,14)=ACR4
 ;
 ;         [69]1099 REPORTING ELIGIBILITY
 ;S $P(ACRC,U,15)=?
 ;
ACRD ; Start setting ACRD formerly ACRZ3
 ;
 ;         [91]BEGIN DATE
 S ACRD=$E($G(ACRBEG),4,5)
 S ACRD=ACRD_$E($G(ACRBEG),2,3)
 ;
 ;         [92]END DATE
 S ACRD=ACRD_U_$E($G(ACREND),4,5)
 S ACRD=ACRD_$E($G(ACREND),2,3)_U
 ;
 ;         2 DIGIT FY (FY OF FUNDS)
 S ACRD=ACRD_$E(ACRFYFUN,3,4)
 ;
ACRE ; Start setting ACRE formerly ACRZ4
 ;
 ;         PD FLAG
 S ACRTMP="" S:ACRIVDC ACRTMP="D" S:ACRP ACRTMP="P"
 S $P(ACRE,U,1)=ACRTMP
 ;
 ;         DISCOUNT/PENALTY AMOUNT
 S ACRTMP=$P(ACRTADD,U,2)
 S:+ACRTMP>0 ACRTMP=$$DOL^ACRFUTL(ACRTMP)
 S $P(ACRE,U,2)=ACRTMP
 Q
 ;
17(ACRTMP)         ;EP;   EXTRINSIC FUNCTION FOR DOLLAR AMOUNT      
 ;----- EXTRINSIC FUNCTION FOR DOLLAR AMOUNT
 ;
 S ACRTMP=$$DOL^ACRFUTL(ACRTMP)
 S ACRTMP=$$PAD^ACRFUTL(ACRTMP,"L",11,0)
 Q ACRTMP
 ;
INVC(ACRINV) ;GROUP MULTIPLE INVOICE NUMBERS
 N ACRX,ACRY,ACRZ
 S ACRX=0,ACRZ=""
 F  S ACRX=$O(^TMP("ACRINV",$J,ACRX)) Q:'ACRX  D
 .S ACRZ=ACRZ_$P(^TMP("ACRINV",$J,ACRX),U,2)_","
 I $G(ACRZ)]"" D
 .S ACRY=ACRZ
 .S:$E(ACRY,$L(ACRY))="," ACRY=$E(ACRY,1,$L(ACRY)-1)
 .S ACRZ=ACRY
 I ACRZ="" S ACRZ=ACRINV
 Q ACRZ