Customer Credit Terms - Discount Available

Hi,

One of my clients use the following Terms and Discount for their customer.

Their standard credit terms is four month.

If the customer paid

within four month -  20% Discount on Invoice Amount.

within five month - 15 %

within six month - 10%

within seven month  - 5%

within eight moth - 0%

over eight month - 5% interest charges on Invoice Amount every month until the customer paid the amount due.

I would like to calculate the discount available amount column automatically in the receipt entry according to the above payment discount based on the invoice date and receipt date.How can I automate that?

I would like to know how to process interest charges for the overdue customer.

Thanks in advance