ComputeDueDate

Compute Due Date

Minor Business Rule

Object Name: X0302

Parent DLL: CFIN

Location: Client/Server

Language: C

Functional Description

Purpose

This function computes the Due Date for transactions based on the payment terms.


Setup Notes and Prerequisites

None


Special Logic

None



Technical Specification



Parameters

ItemDescriptionI/OReq?Notes

PTCszPaymentTermsCodeIYPayment Term

DDNJjdDateDiscountDueJulianINThe julian date after 

Which the discount is 

No longer applicable 

DDJjdDateNetDueJulianONThe date on which the 

Net balance is due

TRDJjdTransDateIYDate Order/Transaction 

Occurred.



Related Tables

F0014 - Payment Terms


Related Functions

None


Processing

If jdTransactionDate is null 

IdReturnValue = ER_ERROR

Else

Open the F0014 table

If F0014 not opened 

IdReturnValue = ER_ERROR

Else

Fetch the F0014 record for the given payment term

If the fetch is unsuccessful

IdReturnValue = ER_ERROR

Else

Call the internal function I0302_CalculateNetDueDate 

To calculate the net due date.

Call the internal function 
I0302_CalculateDiscountDueDate to calculate the 

discount due date.

Close the F0014 table



Internal Function I0302_CalculateNetDueDate - This function takes a date and performs the 

calculations to derive the net due date.


Set mnZero = 0

If Net Days to pay is > 0

Perform net days to pay calculation

Else if Discount Payment terms is > 0

Perform discount days to pay calculation

Else if Due Date is not null

Perform due date calculation

Else if ProxDateMonth != 0 or ProxDateDay != 0

Perform prox date calculations

If the due date is over 1 month away

Add number of months between

Else 

If the due date is passed the fixed day 

add 1 month
else

jdDateNetDueJulian = jdTransactionDate

If the fixed day is past the end of the month 

Due date = last day

Else

Perform transaction date calculations

Return IdReturnValue


Internal Function I0302_CalculateDiscountDueDate - This function takes a date and performs the 

calculations to derive the discount due date.


Set mnZero = 0

If DiscountPaymentTerms > 0 

Perform discount days to pay calculation

Else

Perform net due date calculation

Return IdReturnValue


Data Structure

D0400290 - Compute Due Date


^

Parameter NameData ItemData TypeReq/OptI/O/Both
szPaymentTermsCodePTCcharNONENONE

A code that specifies the terms of payment, including the percentage of discount available if the invoice is paid by the discount due date. 
Use a blank code to indicate the most frequently-used payment term. You define each type of payment term on the Payment Terms Revisions 
form. Examples of payment terms include: Blank Net 15 001      1/10 net 30 002      2/10 net 30 003      Due on the 10th day of every month 006     
Due upon receipt  This code prints on customer invoices.

jdDateDiscountDueJulianDDNJJDEDATENONENONE

In the Accounts Receivable system, the date that the invoice must be paid to receive the discount. The system calculates the discount due 
date based on the payment term. If the payment term does not specify a discount, the system completes this field with the net due date. In the 
Accounts Payable system, the date that the voucher is due.

jdDateNetDueJulianDDJJDEDATENONENONE

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.

jdTransactionDateTRDJJDEDATENONENONE

The date that an order was entered into the system. This date determines which effective level the system uses for inventory pricing.

Related Functions

None

Related Tables

F0014 Payment Terms