added vat amount to payment report

This commit is contained in:
Ali 2025-07-21 15:53:05 +04:00
parent a56092b533
commit 875e7a3a34
2 changed files with 40 additions and 0 deletions

View File

@ -32,6 +32,16 @@ frappe.query_reports["Payment entry info report"] = {
value = "<span style='color: #2ca02c; font-weight: bold;'>" + value + "</span>";
}
// Highlight VAT amount in orange
if (column.fieldname == "vat_amount" && data && data.vat_amount > 0) {
value = "<span style='color: #ff7f0e; font-weight: bold;'>" + value + "</span>";
}
// Highlight grand total in dark green
if (column.fieldname == "grand_total" && data && data.grand_total > 0) {
value = "<span style='color: #17a2b8; font-weight: bold;'>" + value + "</span>";
}
// Highlight reference number in dark gray
if (column.fieldname == "reference_no" && data && data.reference_no) {
value = "<span style='color: #333; font-weight: bold;'>" + value + "</span>";

View File

@ -64,6 +64,18 @@ def get_columns():
"fieldtype": "Currency",
"width": 120
},
{
"label": _("VAT Amount"),
"fieldname": "vat_amount",
"fieldtype": "Currency",
"width": 120
},
{
"label": _("Grand Total"),
"fieldname": "grand_total",
"fieldtype": "Currency",
"width": 120
},
{
"label": _("Mode of Payment"),
"fieldname": "mode_of_payment",
@ -99,15 +111,33 @@ def get_data(filters):
pe.party_name,
pe.paid_amount,
pe.received_amount,
COALESCE(SUM(CASE
WHEN atc.account_head = '521.3 - ƏDV' OR acc.account_number = '521.3'
THEN atc.tax_amount
ELSE 0
END), 0) as vat_amount,
pe.received_amount + COALESCE(SUM(CASE
WHEN atc.account_head = '521.3 - ƏDV' OR acc.account_number = '521.3'
THEN atc.tax_amount
ELSE 0
END), 0) as grand_total,
pe.mode_of_payment,
pe.reference_no,
pe.reference_date
FROM
`tabPayment Entry` pe
LEFT JOIN
`tabAdvance Taxes and Charges` atc ON atc.parent = pe.name
LEFT JOIN
`tabAccount` acc ON acc.name = atc.account_head
WHERE
pe.docstatus = 1
AND pe.payment_type = 'Receive'
{conditions}
GROUP BY
pe.name, pe.posting_date, pe.payment_type, pe.party_type, pe.party,
pe.party_name, pe.paid_amount, pe.received_amount, pe.mode_of_payment,
pe.reference_no, pe.reference_date
ORDER BY
pe.posting_date DESC, pe.name
""", filters, as_dict=1)