Payment Entry Doubt

How to writeoff an amount from invoice as discount after submitted invoice

when invoice is submitted, following transactions happen:

Dr. A/R
Cr. Sales
+
Dr. Cost of Sales
Cr. Stock

so to write off amount as discount against invoice, perform payment entry like this one: