NewDueDateCalculation

New Due Date Calculation

Major Business Rule

Object Name: X03021

Parent DLL: CALLBSFN

Location: Client/Server

Language: C

Functional Description

Purpose

This function is used to calculate the Due Date and Discount Due Date of a document when advanced 

payment terms are used. Typically, this function should be called from B0000163, after it has been 

determined that advanced payment terms were used for a specific document. If advanced payment terms were not 

used, the Default Due Date (B0400037) function should be used instead. 


Setup Notes and Prerequisites

Valid values for Due Date Rule, Discount Due Date, Document Date, GL Date, and Service Tax Date are 

required by this function.


Special Logic

The function uses the "based on date" parameter retrieved from F00142 to decide which of the three 

dates passed into the function (Document Date, GL Date, or Service Tax Date) to use for the new due date 

calculations.



Technical Specification


Parameters

Item DescriptionI/OReq?Notes
DDRLszDueDateRuleIYThe due date rule.
DDDRszDiscountDueDateRuleIYThe discount due date rule.

DDJjdDiscountDueDateONNew discount due date.

DDJjdNetDueDateONNew due date.

DIVJjdDateInvoiceJIYDocument date.

DGJjdDateForGLandVoucherJULIIYDocument GL date.

DSVJjdServiceTaxDateIYDocument service tax date.


Related Tables

F00142Due Date Rules

F00143Due Date Rules Day Range


Related Functions

B0000149Is Date A Work Date

B0000150Advance Work Days


Processing

Initialize return values.

Validate required parameters.

Open F00142 table.

If table open failed,

Set error.

Else,

Open F00143 table.

If open table failed,

Set error.

Endif.

Endif.

If open table was successful,

Execute CalculateDueDate to calculate Net Due Date.

If CalculateDueDate run successfully,

Execute CalculateDueDate to calculate Discount Due Date.

Endif.

Close tables.

Endif.

Perform function clean-up.


CalculateDueDate

Retrieve the F00142 record for the given date rule.

If retrieval failed,

Set error.

Else,

Load transaction date from the based on date.

If transaction date loaded successfully,

Load date rule parameters.

Execute PerformDateRule to perform date rule calculation.

If PerformDateRule run successfully,

Execute RetrieveDateRange.

Endif.

Perform work day rule calculation by calling B0000149 or 

B0000150.

Endif.

Endif.


PerformDateRule

Determine date rule case.

Switch (date rule case),

Case 1: No date rules specified.

Case 2: Fixed days only.

Case 3: Days to add only.

Case 4: Months to add only.

Case 5: Fixed days and months to add.

Case 6: Days to add and months to add.

End Switch.


RetrieveDateRange

Initialize return values.

Validate required parameters.

If validation failed,

 Set error.

Else,

Perform data selection on the F00143 table for the given date rule.

If selection failed,

Set error.

Else,

Calculate date range.

Endif.

Endif.





Data Structure

D03021 - New Due Date Calculation

Parameter NameData ItemData TypeReq/OptI/O/Both
szDueDateRuleDDRLcharNONENONE

A code that specifies how the system calculates either the discount due date or the net due date, depending on how it is assigned to the 
payment term.

szDiscountDueDateRuleDDDRcharNONENONE

The rule that the system uses to calculate the discount due date of a voucher or invoice.

jdDiscountDueDateDDJJDEDATENONENONE

In Accounts Receivable, the date that the net payment is due. In Accounts Payable, the date that the payment is due to receive a discount 
or, if no discount is offered, the net due date. The system calculates the due date based on the payment term entered, or you can enter it 
manually. If you enter a negative voucher or invoice (debit or credit memo), the system might use the G/L date as the due date regardless of the 
payment term entered. A processing option in the master business function (P0400047 for vouchers and P03B0011 for invoices) controls how 
the system calculates the due date for debit and credit memos.

jdNetDueDateDDJJDEDATENONENONE

In Accounts Receivable, the date that the net payment is due. In Accounts Payable, the date that the payment is due to receive a discount 
or, if no discount is offered, the net due date. The system calculates the due date based on the payment term entered, or you can enter it 
manually. If you enter a negative voucher or invoice (debit or credit memo), the system might use the G/L date as the due date regardless of the 
payment term entered. A processing option in the master business function (P0400047 for vouchers and P03B0011 for invoices) controls how 
the system calculates the due date for debit and credit memos.

jdDateInvoiceJDIVJJDEDATENONENONE

The date that either you or the system assigns to an invoice or voucher. This can be either the date of the supplier's invoice to you or the 
date of your invoice to the customer.

jdDateForGLandVoucherJULIADGJJDEDATENONENONE

A date that identifies the financial period to which the transaction will be posted. You define financial periods for a date pattern code that you 
assign to the company record. The system compares the date that you enter on the transaction to the fiscal date pattern assigned to the 
company to retrieve the appropriate fiscal period number, as well as to perform date validations.

jdServiceTaxDateDSVJJDEDATENONENONE

A date that indicates when you purchased goods or services, or when you incurred a tax liability. 

Related Functions

B0000149 Is Date A Work Date
B0000150 Advance Work Days

Related Tables

F00142 Due Date Rules
F00143 Due Date Rules Day Range