Functional Description  B03B0028
Purpose
Function will calculate the amount to pay and discount to take when applying a receipt to a specific 
invoice. Used in Auto Cash algorithm Balance Forward.
Setup Notes and Prerequisites
None.
Special Logic
None.
Technical Specification
Parameters
Item  DescriptionI/OReq?Notes
AAPmnInvoiceAmountOpenIYes
FAPmnInvoiceAmountForeignOpenIYes
ADSCmnInvoiceAmtDiscountAvailableIYes
CDSmnInvoiceForeignDiscountAvailIYes
DDNJjdInvoiceDateDiscountDueIYes
CRRMcReceiptCurrencyModeIYes
DGJjdReceiptGLDateIYes
EV01cReceiptAllowDiscountTakenIYes
EV02cReceiptApplyDueDateIYes
CRRmnReceiptCurrencyConvRateIYes
CRCDszReceiptCurrencyCodeFromIYes
AAPmnReceiptAmountOpenIYes
FAPmnReceiptAmountForeignOpenIYes
AAPmnAmountToApplyIYes
FAPmnForeignAmountToApplyIYes
ADSAmnDiscountToApplyIYes
CDSAmnForeignDiscountToApplyIYes
CRRmnInvoiceCurrencyConvRateIYes
COszReceiptCompanyIYes
Related Tables
None
Related Functions
B0000027CurrencyConvForAndDom
Processing
If allowing discount to be taken (processing option) :
later or equal to receipt G/L date.
Test if sufficient funds to fully pay invoice (including discount) and if so allow discount.
Calculate amount to apply as:
 
the receipt open amount remaining). 
Receipt open amount remaining  (if this amount is less than the invoice open amount minus 
discount allowed).
different to invoice exchange rate:
Call external function B0000027 to recalculate domestic amount applied (at receipt exchange 
rate).
reset domestic amount to apply to amount returned from B0000027.
 
Check that amount to apply is not more than receipt open amount, if so set it equal (to receipt 
open amount).
This can occur when receipt and invoice exchange rates are different (i.e. there is a currency 
gain/loss) and domestic open amount remaining is zero while foreign isn't (or vice versa).
D03B0028 - Calculate Amount to Pay
Item  DescriptionI/OReq?Notes
AAP  mnInvoiceAmountOpenIYesInvoice Open amount domestic
FAP  mnInvoiceAmountForeignOpenIYesInvoice open amount foreign
ADSC  mnInvoiceAmtDiscountAvailaIYesInvoice discount available doemsitc
CDS  mnInvoiceForeignDiscountAvIYesInvoice discount available foeign
DDNJ  jdInvoiceDateDiscountDueIYesInvoice discount due date
CRRM  cReceiptCurrencyModeIYesReceipt currency mode F/D
DGJ  jdReceiptGLDateIYesReceipt G/L date
EV01  cReceiptAllowDiscountTakenIYesProcessing Option if all discounts are to be taken 1- 
allow discounts other wise no discounts are to be taken
EV02  cReceiptApplyDueDateIYesProcessing option 1- Take only earned discounts Other 
wise take all discounts
CRR  mnReceiptCurrencyConvRateIYesReceipt exchange rate
CRCD  szReceiptCurrencyCodeFromIYesReceipt currency code
AAP  mnReceiptAmountOpenIYesReceipt open amount domestic
FAP  mnReceiptAmountForeignOpenIYesReceipt open amount foreign
AAP  mnAmountToApplyOYesAmount to apply to invoice domestic
FAP  mnForeignAmountToApplyOYesAmount to apply to invoice foreign
ADSA  mnDiscountToApplyOYesAmount of discount to take domestic
CDSA  mnForeignDiscountToApplyOYesAmount of discount to take foreign
CRR  mnInvoiceCurrencyConvRateIYesInvoice exchange rate
CO  szReceiptCompanyNNAParm not used
MATH01  mnMaxAutoCreditWrOffNNAParm not used                
CRR  mnRecTriangulationRate1IYesReceipt Triangulation leg 1 Euro 
CRR  mnRecTriangulationRate2 IYesReceipt Triangulation leg 2 Euro 
CRCM  cRecCurrencyConversionMethIYesReceipt currency conversion method Euro      
EFT  jdRecDateEffectiveRatesIYesReceipt exchange rate effective date Euro             
CRR  mnInvTriangulationRate1IYesInvoice Triangulation leg 1 Euro           
CRR  mnInvTriangulationRate2IYesInvoice Triangulation leg 2 Euro                 
CRCM  cInvCurrencyConversionMethIYesInvoice currency conversion method Euro         
EFT  jdInvTransactionDate IYesReceipt exchange rate effective date Euro             
^
| Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both | 
|---|---|---|---|---|
| mnInvoiceAmountOpen | AAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvoiceAmountForeignOpen | FAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvoiceAmtDiscountAvailable | ADSC | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvoiceForeignDiscountAvail | CDS | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| jdInvoiceDateDiscountDue | DDNJ | JDEDATE | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| cReceiptCurrencyMode | CRRM | char | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| jdReceiptGLDate | DGJ | JDEDATE | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| cReceiptAllowDiscountTaken | EV01 | char | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| cReceiptApplyDueDate | EV02 | char | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnReceiptCurrencyConvRate | CRR | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| szReceiptCurrencyCodeFrom | CRCD | char | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnReceiptAmountOpen | AAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnReceiptAmountForeignOpen | FAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnAmountToApply | AAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnForeignAmountToApply | FAP | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnDiscountToApply | ADSA | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnForeignDiscountToApply | CDSA | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvoiceCurrencyConvRate | CRR | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| szReceiptCompany | CO | char | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnMaxAutoCreditWrOff | MATH01 | MATH_NUMERIC | NONE | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnRecTriangulationRate1 | CRR | MATH_NUMERIC | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnRecTriangulationRate2 | CRR | MATH_NUMERIC | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| cRecCurrencyConversionMethod | CRCM | char | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| jdRecDateEffectiveRates | EFT | JDEDATE | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvTriangulationRate1 | CRR | MATH_NUMERIC | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| mnInvTriangulationRate2 | CRR | MATH_NUMERIC | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| cInvCurrencyConversionMethod | CRCM | char | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| jdInvTransactionDate | EFT | JDEDATE | OPT | NONE | 
 
Itemab    Descriptionab  ab  ab  I/Oab  Req?ab Notes
  | ||||
| B0000027 CurrencyConvForAndDom | 
| None |