The payment discount is calculated based on:
1) Amount field in Sales and Purchase documents
2) Sales/Purch. (LCY) field in General Journals
The payment discounts will be posted to
1) Payment Disc. Debit Acc. - post granted sales payment discount
2) Payment Disc. Credit Acc. - post reductions in sales payment discount amount
The payment disc. debit/credit acc. can be set at the Customer Posting Group and Vendor Posting Group.