Documentation >
MAC-PAC Technical Library >
Financial >
Accounts Receivable >
Programs >
Batch Payment Entry and Application - Purpose >
Batch Payment Entry and Application - Calculations
Batch Payment Entry and Application - Calculations
AR125E
A. Housekeeping
1. Key lists, parameters, and program variables are defined.
2. The following information is retrieved from the Reference file:
a. Date Format is retrieved from category 049. If this record is not found, a message is sent to the system operator, the format defaults to MMDDYY, and processing continues.
b. The global book code option and currency flag are retrieved from the System Options record (category 133). If this record is not found, the program terminates abnormally.
c. The book code defaults for this conversation are retrieved from category 135. If this record is not found, the book code defaults to AR and processing continues.
d. The processing defaults are retrieved from category 300. If this record is not found, all defaults are set to NO and processing continues.
e. The grace period is retrieved from the Discount Information record (category 331). If this record is not found, the grace period defaults to zero.
f. The maximum write off amount is retrieved from category 332. If this record is not found, the amount defaults to zero.
g. The payment codes (for detail, gross, and net payment methods) are retrieved from category 337. If this record is not found, the program terminates abnormally.
h. The value-added tax class is retrieved from the Accounting Classes record (category 340). If this record is not found, the program terminates abnormally.
i. The aging periods are retrieved from category P44. If this record is not found, the program terminates abnormally.
j. The file access status codes are retrieved from Reference File category 015.
3. The Data Entry file (AR125AP1) is read to obtain the first customer payment record. Mainline processing is performed for each record in this file.
B. Mainline
1. The first record from the Payment Application Data Entry file is validated. The following validation is performed:
a. Payment header specified exists on the Payment file (ARPMNTL1).
b. Book code exists on Reference File (category 136).
c. Payment method was specified (apply to specific invoice or apply to oldest).
d. Customer exists on Customer Master (ARCUSTL1) and is active.
e· Bank code exists on the Bank file (CFBAMP).
f. Accounts required for the transaction exist on the Reference File (category 302). (An allowance for doubtful accounts must exist for write-off transactions, a cash account must exist for payments by check, and a debit/credit memo clearing account must exist for clearing transactions).
g. The company/location is valid for the bank (Reference File category 132).
h. Payment is a write-off transaction, a clearing transaction, or the payment type exists on the Payment Type Master file
i. Payment date is valid (between the first and last accounting dates specified on Reference File category 336).
j. Payment amount equals zero for clearing transactions and is greater than zero for all other transactions.
k. Payment type exists on Reference File category 344. If Payment Time VAT Review processing is invoked, the payment type cannot equal a draft or a write-off.
l. If the payment type requires a remittance procedure, a valid bank remittance procedure must be defined on Reference File category F45.
m. For an existing draft, the status of the draft must be S (submitted).
n. If the remittance procedure is not determined at payment time, the remittance type must be blank on the remittance file.
o. If the remittance type is not blank, it must be valid for payment type on Reference File category F49.
p. The due date must be blank for payments other than draft and it must not be blank for draft payments.
q. If the bank name/address needed flag in Reference File category F45 is set to N (no) or if the record was not found in F45, the bank name and address fields must be blank.
r. If the bank number/account number is needed and the fields are blank, the program defaults the values from the Draft Master file or from the Customer Master file.
s. If the bank number/account number are not blank, they must be validated on Reference File category F50.
t. If the remittance type is not blank and remittance procedure is determined at payment entry time, it must be validated on Reference File category F48.
2. If the environment is a multi-currency environment, the base currency for the company/location is retrieved from the Reference File (category 002) and the currency code is validated. If the payment is not in the base currency, the conversion rate is retrieved from the Currency Master (CF240ML2), and the payment amount is converted to the base currency.
3. The Bank file (CFBAMP) is read to create an array of account/centers used at this company/location.
4. If the payment should be applied to the oldest open item:
a. The Open Item file (AROPENL2) is read to create a list of open items sequenced by date.
b. In a multi-currency environment, the payment amount is converted from the base currency to the currency used on the first open item.
c. If the payment amount is greater than the open item amount, the receivables account is credited for the entire open amount (gross payment method). A transaction is written to the work file (AR125AP) for the necessary accounting transactions.
The next open item is then retrieved, the amount is converted if necessary, and the payment is applied. Open items are retrieved until the payment amount is no longer greater than the open item amount.
d. If the payment amount equals the open item amount, the receivables account is credited for the entire open amount (gross payment method). A transaction is written to the work file (AR125AP) for the necessary accounting transactions.
e. If the payment amount is less than the open item amount, the program checks to see if a valid discount has been taken. If a discount is appropriate:
(i) The receivables account is credited for the full open amount
(ii) The discounts account is debited for the difference between the full open amount and the payment amount.
A transaction is written to the work file (AR125AP) for the necessary accounting transactions.
f. If the payment amount is less than the open item amount but the difference cannot be covered by a discount:
(i) The payment is treated as a partial payment. The amount to be applied is converted to the base currency and used to decrease the open amount.
(ii) Any amount to be written off is also converted to the base currency and credited to the open amount. The allowance for doubtful accounts account is debited for this amount. In VAT environments, the VAT amount is recalculated based on the write-off amount as follows:
VAT adjustment = VAT rate * write-off amount / open item amount
(iii) Chargeback processing is allowed. Processing will close the invoice and create a debit memo for the remaining amount (if underpaid).
(iv) The program calculates discounts available and discounts lost.
(v) A transaction is written to the work file (AR125AP) for the necessary accounting transactions.
g. When no payment amount remains to be applied, this data entry record is deleted and the next one is read. Mainline processing continues until all Data Entry file records have been processed.
5. If the payment should be made to a specific invoice:
a. The Detail Data file (AR125AP2) is read for the first open item to be paid.
b. The following fields are validated:
(i) Company/location
(ii) Document number
(iii) Document type
(iv) Pay code (gross, net, or detail)
(v) Write-off, chargeback, discount, and open amounts
c. If the transaction is a write-off or a clearing transaction, the appropriate accounting transactions are written and files are updated as specified in Step 6.
d. In a multi-currency environment, the payment amount is converted to the currency used on the particular open item.
e. Depending on the pay code, the program applies the payment to the entire invoice (gross method), to the invoice after a discount is taken (net method), or as a partial payment against the item (detail method). A transaction is written to the work file (AR125AP) for the necessary accounting transactions.
f. The next record in the Detail Data file is read and processing continues until all invoices specified on the Data Entry File record are processed.
6. The following steps occur for each open item to which a payment is applied:
a. If necessary, value-added tax is recalculated or reversed. VAT totals are updated on the Open Item Distributions file (ARDISTL1).
b. Accounting transactions are written to the Accounting Transactions file (AR510AP) from the work file (AR125AP). The following transactions may be written, depending on how each payment was applied:
(i) Debit cash if the payment was made by check. If the transaction was made across companies, debit inter-company payables account.
(ii) Credit accounts receivable. If the transaction was made across companies, credit inter-company receivables account.
(iii) Debit discounts, if a discount was taken
(iv) Debit allowance for doubtful accounts, if the transaction was for a write-off or chargeback.
(v) Debit exchange gain/loss and credit accounts receivable gain/loss, as appropriate. The exchange gain/loss = amount posted in base currency minus amount posted at current rates.
(vi) Debit the debit/credit memo clearing account if the transaction was a clearing transaction.
c. Payment header and payment application records are written to the Payment file (ARPMNTL1). The total amount posted to the customer account = applied amount + discount + write-off + chargeback (positive).
d. The Open Item Header file (AROPENL1) is updated with the new open amount, the discount available, the write-off amount, and any positive chargeback amounts.
e. The aging buckets, accounts receivable balance, and on-account amount are updated on the Customer file (ARCUSTL1).
f. A record is written to the Activity Log (ARLOGP) for each data base update transaction.
g. After all master files have been updated, the corresponding work file records are deleted.
h. The Draft Master file is updated with the draft status A (accepted).
i. The Bank Remittance record is written if the bank remittance flag is set to 'Y' (yes) on Reference File category 344.
7. After a payment has been completely processed, the current Data Entry File record is deleted and the next record is read. Mainline processing continues until all data entry file records have been processed.
Batch Payment Header (AR125AP1)
Relative Position
|
|
Field Label
|
|
Field Description
|
|
POS
|
|
DEC
|
|
Bytes
|
|
Field Form
|
|
A/N
|
1-11
|
SCCUST
|
Customer Identification Number
|
11
|
|
11
|
C
|
A
|
12-14
|
SCCCO
|
Company Code
|
3
|
|
3
|
C
|
A
|
15-17
|
SCCLOC
|
Location Code
|
3
|
|
3
|
C
|
A
|
18-19
|
SCPTC
|
Payment type code
|
2
|
|
2
|
C
|
A
|
20-27
|
SCPNO
|
Payment Number
|
8
|
|
8
|
C
|
A
|
28-30
|
SCCOB
|
Company Code
|
3
|
|
3
|
C
|
A
|
31-33
|
SCLOCB
|
Location Code
|
3
|
|
3
|
C
|
A
|
34-35
|
SCBKCD
|
Bank Code
|
2
|
|
2
|
C
|
A
|
36-39
|
SCBNO
|
Batch Number
|
4
|
|
4
|
C
|
A
|
40-42
|
SCCUCD
|
Currency Code
|
3
|
|
3
|
C
|
A
|
43-47
|
SCEXCH
|
Exchange rate
|
9
|
5
|
5
|
P
|
N
|
48-52
|
SCEXAR
|
Exchange rate
|
9
|
5
|
5
|
P
|
N
|
53-59
|
SCPAMT
|
Payment Amount
|
13
|
2
|
7
|
P
|
N
|
60-61
|
SCBOOK
|
Book Code
|
2
|
|
2
|
C
|
A
|
62-63
|
SCPDT1
|
Payment date 1
|
2
|
|
2
|
C
|
N
|
64-65
|
SCPDT2
|
Payment date 2
|
2
|
|
2
|
C
|
N
|
66-67
|
SCPDT3
|
Payment date 3
|
2
|
|
2
|
C
|
N
|
68-69
|
SCADT1
|
Accounting date 1
|
2
|
|
2
|
C
|
N
|
70-71
|
SCADT2
|
Accounting date 2
|
2
|
|
2
|
C
|
N
|
72-73
|
SCADT3
|
Accounting date 3
|
2
|
|
2
|
C
|
N
|
74-75
|
SCDTD1
|
Due Date - Day
|
2
|
|
2
|
C
|
N
|
75-76
|
SCDTD2
|
Due Date - Month
|
2
|
|
2
|
C
|
N
|
77-78
|
SCDTD3
|
Due Date - Year
|
2
|
|
2
|
C
|
N
|
80-80
|
SCLMCU
|
Limit to Currency
Flag
|
1
|
|
1
|
C
|
A
|
81-83
|
SCDOCU
|
Document Currency
|
3
|
|
3
|
C
|
A
|
84-84
|
SCLMCL
|
Limit to CO/LOC
Flag
|
1
|
|
1
|
C
|
A
|
85-87
|
SCLMCO
|
Limit to Company
|
3
|
|
3
|
C
|
A
|
88-90
|
SCLMLO
|
Limit to Location
|
3
|
|
3
|
C
|
A
|
91-98
|
SCCSTN
|
Limit to Statement Number
|
8
|
|
8
|
C
|
A
|
99-123
|
SCCSRF
|
Customer Reference
|
25
|
|
25
|
C
|
A
|
124-124
|
SCRMTP
|
Remittance Type
|
1
|
|
1
|
C
|
A
|
125-148
|
SCBKNM
|
Bank Name
|
24
|
|
24
|
C
|
A
|
149-172
|
SCBKDM
|
Bank Domiciliation
|
24
|
|
24
|
C
|
A
|
173-187
|
SCBKNO
|
Bank Number
|
15
|
|
15
|
C
|
A
|
188-202
|
SCBANO
|
Bank Account
Number
|
15
|
|
15
|
C
|
A
|
203-203
|
SCAPLS
|
Apply to Specific
Flag
|
1
|
|
1
|
C
|
A
|
204-204
|
SCPLOA
|
Place On-Account
Flag
|
1
|
|
1
|
C
|
A
|
205-205
|
SCAPLO
|
Apply to Oldest Flag
|
1
|
|
1
|
C
|
A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Batch Payment Detail (AR125AP2)
Relative Position
|
|
Field Label
|
|
Field Description
|
|
POS
|
|
DEC
|
|
Bytes
|
|
Field Form
|
|
A/N
|
|
1-11
|
SCCUST
|
Customer Identification Number
|
11
|
|
11
|
C
|
A
|
|
12-14
|
SCCCO
|
Customer Company
|
3
|
|
3
|
C
|
A
|
|
15-17
|
SCCLOC
|
Customer Location
|
3
|
|
3
|
C
|
A
|
|
18-19
|
SCPTC
|
Payment type code
|
2
|
|
2
|
C
|
A
|
|
20-27
|
SCPNO
|
Payment Number
|
8
|
|
8
|
C
|
A
|
|
28-30
|
SCCOB
|
Company Code
|
3
|
|
3
|
C
|
A
|
|
31-33
|
SCLOCB
|
Location Code
|
3
|
|
3
|
C
|
A
|
|
34-36
|
SCCO
|
Company Code
|
3
|
|
3
|
C
|
A
|
|
37-39
|
SCLOC
|
Location Code
|
3
|
|
3
|
C
|
A
|
|
40-41
|
SCDTC
|
Document Type Code
|
2
|
|
2
|
C
|
A
|
|
42-49
|
SCDNO
|
Document Number - Alpha
|
8
|
|
8
|
C
|
A
|
|
50-52
|
SCINST
|
Installment Number
|
3
|
0
|
3
|
S
|
N
|
|
53-53
|
SCPCD
|
Selection code
|
1
|
|
1
|
C
|
A
|
|
54-60
|
SCAPPL
|
Payment amount applied
|
13
|
2
|
7
|
P
|
N
|
|
61-67
|
SCAPPY
|
Payment amount applied
|
13
|
2
|
7
|
P
|
N
|
|
68-73
|
SCDISC
|
Available discount amount
|
11
|
2
|
6
|
P
|
N
|
|
74-79
|
SCWOAM
|
Discount amount
|
11
|
2
|
6
|
P
|
N
|
|
80-80
|
SCWOR
|
Selection code
|
1
|
|
1
|
C
|
A
|
|
81-82
|
SCWORS
|
Reason code
|
2
|
|
2
|
C
|
A
|
|
83-83
|
SCCBR
|
Selection code
|
1
|
|
1
|
C
|
A
|
|
84-85
|
SCCBRS
|
Reason code
|
2
|
|
2
|
C
|
A
|
|
86-91
|
SCCBAM
|
Discount Amount
|
11
|
2
|
6
|
P
|
N
|
|
92-102
|
SCACST
|
Alternate Customer
|
11
|
|
11
|
C
|
A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|