ERPNext takes an Additional Discount off the items' net amounts and,
for a discount on Grand Total, splits it between net and taxes: each
charge is booked at tax_amount_after_discount_amount and Total Taxes
and Charges sums those. The print showed the discount as entered and
the pre-discount tax_amount, so on a Grand Total discount the VAT line
disagreed with the invoice.
The totals includes now print the discount's net share (sum of
item.distributed_discount_amount), Net Total, and each charge after
discount, so the lines add up to Grand Total whichever total the
discount applies on and with inclusive or exclusive tax. A discount
that is not distributed (cash / non-trade) stays after the charges.
Default Standard Sales Invoice and Tax Invoice/Receipt printed the
Additional Discount Amount among the charges, after the Total line but
with no total after the discount. App copies of ERPNext's totals
includes are swapped in via doc.print_templates:
- taxes.html: a discount on Net Total is followed by the Net Total line
ahead of the charges; a discount on Grand Total stays after them.
- total.html: with inclusive tax, "Total (Without Tax)" is the total
before the discount (net_total + discount_amount); upstream printed
net_total, which already has the discount taken off, so the same
figure appeared before and after the discount line.
- translations/th.csv: custom field labels, messages, print format and
letter head text, the 22 Tax Withholding Category names; overrides the
upstream Thai for the standard labels the print formats show
- print formats embed Sarabun (public/fonts, OFL) so PDFs render Thai on
servers without a Thai font
- letter head labels go through _()
- withholding row description is translated when stored
- in_words: Thai "...บาทถ้วน" wording via num2words when the language is
Thai (ThaiSalesInvoice.set_total_in_words); print formats re-derive it
in the print language (get_in_words)
- fixture `modified` bumped so migrate re-imports the changed documents
- Split the Customer block into two columns: name / address / tax id on
the left, contact person with phone, mobile and email on the right
(only when the invoice has a contact person; phone read from Contact)
- Thailand Address Template: drop the blank line between the address and
the phone / fax / email lines
- Hide Total Quantity, Update Billed Amount in Delivery Note, Amount
Eligible for Commission and Company Tax ID (already in the letterhead)
- Move Posting Date / Payment Due Date into the print heading, right-aligned
- Add a Customer block (name, address, contact, tax id) under the heading
- Render Total (Without Tax) in the same right-half grid as Taxes / Totals
- Put In Words in the empty left column of Totals, level with Grand Total
- Print Format CSS: one 1.8 line-height rhythm with no row margins, 5px
letterhead margin, 5px margins around the item table