Basically, similar to AP in AR the AR_PAYMENT_SCHEDULES_ALL table captures the discount details.

When entering receipts manually, Receivables determines whether discounts are allowed based on the payment terms, discount grace days, system options, transaction date, and receipt apply date. If discounts are allowed, Receivables determines the amount of earned and unearned discounts and displays this information in the Discount field.

Receivables defaults applied receipt amounts into the receipt application windows. The default amount applied is the remaining amount of the transaction, less any available discount. However, if the remaining amount of the receipt is less then the balance of the transaction, the default amount applied is the remaining amount of the receipt and Receivables takes the discount available on the transaction.

Calculation of Discounts

If the receipt amount is more than the amount due remaining less the discount, Receivables uses the following formula to determine the earned discount:

Earned Discount = Amount Due Remaining * Discount Percent

If the receipt amount is either the same or less than the amount due remaining less the discount, Receivables uses the following formula to determine the earned discount:

Earned Discount = (Receipt Amount * Discount Percent) / 1 - Discount Percent

Unearned Discounts with Partial Payment Discounts Allowed

Receivables uses the following formula to determine unearned discounts if partial payments are allowed:

Unearned Discount = Maximum Discount - Earned Discount

Earned Discounts with Partial Payment Discounts Not Allowed

If the Allow Discount on Partial Payments check box for your payment terms is not checked, Receivables only takes discounts if the receipt amount closes the installment

Receivables uses the following formula to determine earned discounts if partial payment discounts are not allowed:

Earned Discount = Amount Due Original * Discount Percent

Unearned Discounts and Partial Payments Not Allowed

If the Allow Discount on Partial Payments check box for your payment terms is not checked, Receivables only takes discounts if the receipt amount closes the installment.

Receivables uses the following formula to determine unearned discounts if partial payments are not allowed:

Unearned Discount = Amount Due Original * Maximum Discount Percent - Earned Discount

Discount on Lines Only

If the Discount Basis option for your payment term is set to Lines Only, Receivables does not take discounts on receipt amounts applied to tax, freight, or late charges and uses the following formula to determine the discount amount:

Line Percent = Discount Percent * (Sum of Lines + Sum of Line Adjustments - Sum of

Line Credits / Amount Due Original + Sum of Adjustments - Sum of Credits)

Once you determine the discount line percent, use this as the discount percent in the formulas above

Earned Discount = Amount Due Remaining * Discount Percent

If the receipt amount is either the same or less than the amount due remaining less the discount, Receivables uses the following formula to determine the earned discount:

Earned Discount = (Receipt Amount * Discount Percent) / 1 - Discount Percent

Unearned Discounts with Partial Payment Discounts Allowed

Receivables uses the following formula to determine unearned discounts if partial payments are allowed:

Unearned Discount = Maximum Discount - Earned Discount

Earned Discounts with Partial Payment Discounts Not Allowed

If the Allow Discount on Partial Payments check box for your payment terms is not checked, Receivables only takes discounts if the receipt amount closes the installment

Receivables uses the following formula to determine earned discounts if partial payment discounts are not allowed:

Earned Discount = Amount Due Original * Discount Percent

Unearned Discounts and Partial Payments Not Allowed

If the Allow Discount on Partial Payments check box for your payment terms is not checked, Receivables only takes discounts if the receipt amount closes the installment.

Receivables uses the following formula to determine unearned discounts if partial payments are not allowed:

Unearned Discount = Amount Due Original * Maximum Discount Percent - Earned Discount

Discount on Lines Only

If the Discount Basis option for your payment term is set to Lines Only, Receivables does not take discounts on receipt amounts applied to tax, freight, or late charges and uses the following formula to determine the discount amount:

Line Percent = Discount Percent * (Sum of Lines + Sum of Line Adjustments - Sum of

Line Credits / Amount Due Original + Sum of Adjustments - Sum of Credits)

Once you determine the discount line percent, use this as the discount percent in the formulas above

Courtesy :Oracle Documentation