The cash discount amount expected is already taken into consideration when the invoice is posted. The type of price control defined for the material determines which offsetting account is posted when the stock account is posted.
The cash discount amount is credited to the income from price differences account and debited from the cash discount clearing account.
The tax amount is credited to the stock account and debited from the cash discount clearing account, provided that there is sufficient stock to cover the quantity invoiced.

Net Posting for a Material with a Moving Average Price

If an invoice contains a cash discount and taxes, more tax is posted with the invoice than should be, as the cash discount is not taken into account. When payment is made, the system automatically corrects the tax payment: The tax amount for the cash discount is credited to the input tax account.
The input tax account is debited with $15 when the invoice is posted. However, only $95 (100 - 5%) is to be taxed. Therefore, the tax to be paid is 15% of $95 = $14.25. The difference of $0.75 is credited to the input tax account when the invoice is paid.

It is also possible to post the goods receipt net. In this case, when an invoice is entered, only the GR/IR clearing account is cleared and the vendor account credited.