There should be an option to decide the CD applicable amount logic:
Either only invoice value
Total amount including charges
Ideally the buyer is already taking input of GST so the cash discount shouldn't consider GST in calculating the applicable amount. If still the seller is providing discount on GST as well, then the user can change the amount while preparing the AP voucher. We are marking this idea as "Unlikely to implement". Will keep it open for more votes.