Functional Description
Purpose
The purpose of the Combination Invoice Match Using Cache business function is to match a receipt to a 
combination of invoices up to a pre-determined number of invoices and combinations.  In other words, 
the calling program should specify the maximum number (up to ten) of invoices and the maximum number 
of combinations (up to ten) that may be attempted by the function.  If this information is not 
specified, the function will use the number ten for both the number of invoices and combinations of those 
invoices when attempting a match.
Setup Notes and Prerequisites
None
Special Logic
None
Technical Specification
Parameters
ItemDescription    I/OReq?Notes
PYIDmnRcptPaymentID    IYReceipt 
Payment ID
ICUTszRcptBatchType    IYReceipt 
Batch Type
ICUmnRcptBatchNumber    IYReceipt 
Batch Number
DGJjdRcptGLDate    IYReceipt GL 
Date
DICJjdRcptBatchDate    I Y    Receipt Batch Date
AAPmnRcptOpenAmount    I YReceipt Open 
Amount - Domestic:  should pass AAP; Foreign:  should pass FAP
CRDCszRcptBaseCurrency    I  YReceipt Base 
Currency (for foreign receipts)
CRCDszRcptCurrencyCodeFrom    IYReceipt 
Currency Code (for foreign receipts)
CRRMcRcptCurrencyMode    IYReceipt 
Currency Mode
CRRmnRcptExchangeRate    IYReceipt 
Exchange Rate  (for foreign receipts)
AN8mnRcptCustomerNumber    IYReceipt 
Customer Number
PYRmnRcptPayorNumber    IYReceipt 
Payor Number
DOCmnInvoiceNumber    IYInvoice 
Document Number
DCTszDocumentType    IYInvoice 
Document Type
KCOszInvoiceCompanyKey    IYInvoice 
Document Company
PAAPmnInvoiceTotalOpenAmount      I    Y   Required if want to match to total Open Invoice 
Amt
AGmnInvoiceTotalAvailableAmount   I    Y   Required if want to match to total Avail Invoice 
Amt
AAmnInvoiceTotalEarnableAmount   I    Y   Required if want to match to total Earn Invoice 
Amt
EV01cMatchToOpen    IYPO Value - 
Match to Open (?)
EV02cMatchToAvailable    IYPO Value - 
Match to Open Less Avail (?)
EV03cMatchToEarnable    IYPO Value - 
Match to Open Less Earn (?)
EV04cPerformInvertedProcessing    IYPO Value - 
Perform Inverted Processing;  read oldest invoices first and match receipt to invoices not paid
MATH03      mnRcptEarnableAmount            I    Y    Receipt earnable amount
EV05cUnearnedDiscountMethod    IYPO Value - 
How to handle Unearned Discts -  WO, CB, Partial pay invoice
ARCRszUnearnedReasonCode    IYPO Value - 
must be passed for WO/CBs
INT01nNumberGraceDays    I YPO Value - 
grace days for earned discounts 
INT02nCurrentInvoiceNumber    IYCurrent 
Invoice Number (i.e., should keep running total outside this function of number invoices processed)
INT03nInvoiceCombinationLimit    IYPO Value - 
Maximum combinations that may beattempted by program
EV06cIncludeCreditMemos    IYPO Value - 
Wish to include Credit Memos (?)
EV07cReturnCode    O Returns 
either 'N' (Not Applied) or 'Y' (Applied)
MATH02     mnRcptAvailableAmount           I    Y    Receipt Available amount
EV04       cPartialReceiptStatus           O         '1' means unsuccessfully apply receipt to 
invoices.
ECBR        szChargebackReasonCode          I    N    Reason code for the chargeback. Required if 
chargeback amount is not zero.
DDEX        szReasonCodeforClaim            I    N    Reason code for the deduction. Required if 
deduction amount is not zero.
Related Tables 
F03B11Customer Ledger Table
Related Functions
B03B0012ARApplyReceiptToInvoice
B0000028Soft Round Currency Conversion, Calculate
B0000055F0012 Get AAI Account Number
Processing
Initialize and set up Cache structure and Index.
Get handle to Cache.
Determine the current invoice.
If MatchToEarnable 
 If Doing Inverted Processing
If MatchToAvailable 
 If Doing Inverted Processing
 If Including Credit Memos
 If Receipt GT Current Invoice 
 return "N";
As long as it is NOT First Invoice, Process Current Invoice
 Execute Process_Invoice
I_B03B0119_Process_Invoice
Initialize and set up Cache structure and Index.
Get handle to Cache.
Determine the current invoice.
Open Totals Cache - Point to first record in cache
while Record successfully read from the Cache and match the specific criteria
 If Record successfully read from the Cache
 Save Index of record read
  Else
   Skip this Cache record - get next record from Totals Cache
  If MatchToEarnable 
  If Doing Inverted Processing
   Total Available Amount
If the process not finished
set process to finished status
 Reset the Fetch Cursor and read next record
Close the Cache Cursor
I_B03B0119_Apply_Receipt
Initialize and set up Cache structure and Index.
While loop - Read each Invoice that makes up Index
 Open Totals Cache - Point to first record in cache
For each pay Item on Invoice
Calculate domestic and foreign amount with/out discount according  
to the currency mode
Call ARApplyReceiptToInvoice (B03B0012)
 Monitor unearned discount (create write-off, chargeback, deduction, or leave 
the invoice open)
mode
Call ARApplyReceiptToInvoice (B03B0012)
Call ARApplyReceiptToInvoice (B03B0012)
I_B03B0119_Apply_Inverse_Receipt
Initialize and set up Cache structure and Index.
Get handle to Cache.
Open Totals Cache - Point to first record in cache
while Record successfully read from the Cache
 If Invoice read match the specified criteria
 Skip Invoice 
 Else
 For each pay Item on Invoice
 If match type is 'E'
Calculate domestic and foreign amount with/out discount according to the currency 
mode
Call ARApplyReceiptToInvoice (B03B0012)
 Monitor unearned discount (create write-off, chargeback, deduction, or leave 
the invoice open)
mode
Call ARApplyReceiptToInvoice (B03B0012)
Call ARApplyReceiptToInvoice (B03B0012)
Close the Cache Cursor.
  
D03B0119 - DS for Combination Invoice Match Using Cache
Purpose
This function data structure is used by Combination Invoice Match Using Cache function.
Parameters
ItemDescription    I/OReq?Notes
PYIDmnRcptPaymentID    IYReceipt 
Payment ID
ICUTszRcptBatchType    IYReceipt 
Batch Type
ICUmnRcptBatchNumber    IYReceipt 
Batch Number
DGJjdRcptGLDate    IYReceipt GL 
Date
DICJjdRcptBatchDate    I Y    Receipt Batch Date
AAPmnRcptOpenAmount    I YReceipt Open 
Amount - Domestic:  should pass AAP; Foreign:  should pass FAP
CRDCszRcptBaseCurrency    I  YReceipt Base 
Currency (for foreign receipts)
CRCDszRcptCurrencyCodeFrom    IYReceipt 
Currency Code (for foreign receipts)
CRRMcRcptCurrencyMode    IYReceipt 
Currency Mode
CRRmnRcptExchangeRate    IYReceipt 
Exchange Rate  (for foreign receipts)
AN8mnRcptCustomerNumber    IYReceipt 
Customer Number
PYRmnRcptPayorNumber    IYReceipt 
Payor Number
DOCmnInvoiceNumber    IYInvoice 
Document Number
DCTszDocumentType    IYInvoice 
Document Type
KCOszInvoiceCompanyKey    IYInvoice 
Document Company
PAAPmnInvoiceTotalOpenAmount      I    Y   Required if want to match to total Open Invoice 
Amt
AGmnInvoiceTotalAvailableAmount   I    Y   Required if want to match to total Avail Invoice 
Amt
AAmnInvoiceTotalEarnableAmount   I    Y   Required if want to match to total Earn Invoice 
Amt
EV01cMatchToOpen    IYPO Value - 
Match to Open (?)
EV02cMatchToAvailable    IYPO Value - 
Match to Open Less Avail (?)
EV03cMatchToEarnable    IYPO Value - 
Match to Open Less Earn (?)
EV04cPerformInvertedProcessing    IYPO Value - 
Perform Inverted Processing;  read oldest invoices first and match receipt to invoices not paid
MATH03      mnRcptEarnableAmount            I    Y    Receipt earnable amount
EV05cUnearnedDiscountMethod    IYPO Value - 
How to handle Unearned Discts -  WO, CB, Partial pay invoice
ARCRszUnearnedReasonCode    IYPO Value - 
must be passed for WO/CBs
INT01nNumberGraceDays    I YPO Value - 
grace days for earned discounts 
INT02nCurrentInvoiceNumber    IYCurrent 
Invoice Number (i.e., should keep running total outside this function of number invoices processed)
INT03nInvoiceCombinationLimit    IYPO Value - 
Maximum combinations that may beattempted by program
EV06cIncludeCreditMemos    IYPO Value - 
Wish to include Credit Memos (?)
EV07cReturnCode    O Returns 
either 'N' (Not Applied) or 'Y' (Applied)
MATH02     mnRcptAvailableAmount           I    Y    Receipt Available amount
EV04       cPartialReceiptStatus           O         '1' means unsuccessfully apply receipt to 
invoices.
ECBR        szChargebackReasonCode          I    N    Reason code for the chargeback. Required if 
chargeback amount is not zero.
DDEX        szReasonCodeforClaim            I    N    Reason code for the deduction. Required if 
deduction amount is not zero.
^
| Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both | 
|---|---|---|---|---|
| mnRcptPaymentID | PYID | MATH_NUMERIC | NONE | NONE | 
| 
Item       Description           I/Oab Req?   Notes
 | ||||
| szRcptBatchType | ICUT | char | NONE | NONE | 
|  
Itemab Description          I/Oab Req?    Notes
 | ||||
| mnRcptBatchNumber | ICU | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab I/O    Req?ab  Notes
 | ||||
| jdRcptGLDate | DGJ | JDEDATE | NONE | NONE | 
|  
Itemab Description       I/O    Req?ab   Notes
 | ||||
| jdRcptBatchDate | DICJ | JDEDATE | NONE | NONE | 
|  
Itemab Description          I/Oab  Req?   Notes
 | ||||
| mnRcptOpenAmount | AAP | MATH_NUMERIC | NONE | NONE | 
|  
Itemab Description             I/Oab      Req?ab Notes
 | ||||
| szRcptBaseCurrency | CRDC | char | NONE | NONE | 
|  
Itemab  Descriptionab I/O   Req?ab Notes
 | ||||
| szRcptCurrencyCodeFrom | CRCD | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab I/O    Req?ab Notes
 | ||||
| cRcptCurrencyMode | CRRM | char | NONE | NONE | 
|  
Itemab  Descriptionab I/O    Req?   Notes
 | ||||
| mnRcptExchangeRate | CRR | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab I/O   Req?ab  Notes
 | ||||
| mnRcptCustomerNumber | AN8 | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab I/O    Req?ab Notes
 | ||||
| mnRcptPayorNumber | PYR | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnInvoiceNumber | DOC | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szDocumentType | DCT | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szInvoiceCompanyKey | KCO | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnInvoiceTotalOpenAmount | PAAP | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnInvoiceTotalAvailableAmount | AG | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnInvoiceTotalEarnableAmount | AA | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cMatchToOpen | EV01 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cMatchToAvailable | EV02 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cMatchToEarnable | EV03 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cPerformInvertedProcessing | EV04 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cUnearnedDiscountMethod | EV05 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szUnearnedReasonCode | ARCR | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| nNumberGraceDays | INT01 | integer | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| nCurrentInvoiceNumber | INT02 | integer | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| nInvoiceCombinationLimit | INT03 | integer | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cIncludeCreditMemos | EV06 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| cReturnCode | EV07 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnRcptAvailableAmount | MATH02 | MATH_NUMERIC | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| mnRcptEarnableAmount | MATH03 | MATH_NUMERIC | NONE | NONE | 
|  
Itemab Description                  I/O  Req?   Notes MATH03      mnRcptEarnableAmount         I    Y 
 | ||||
| cPartialReceiptStatus | EV04 | char | NONE | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szChargebackReasonCode | ECBR | char | OPT | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szReasonCodeforClaim | DDEX | char | OPT | NONE | 
|  
Itemab  Descriptionab  ab     I/Oab  Req?ab Notes
 | ||||
| szDiscountReasonCode | DRCO | char | OPT | NONE | 
| A code that specifies the reason that a discount is given. | ||||
| B0000028 CurrencyConvSftRound | ||||
| B0000055 ValidateAAICompletely | ||||
| B03B0012 F03B14 Apply Receipt to Invoice | 
| F03B11 Customer Ledger |