mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 11:44:11 +00:00
feat: added column to show Dr/Cr
This commit is contained in:
@@ -242,6 +242,8 @@ class PartyLedgerSummaryReport:
|
||||
}
|
||||
]
|
||||
|
||||
if self.filters.show_dr_cr:
|
||||
columns.append({"label": "Dr/Cr", "fieldname": "dr_or_cr", "fieldtype": "Data", "width": 100})
|
||||
return columns
|
||||
|
||||
def get_data(self):
|
||||
@@ -300,6 +302,14 @@ class PartyLedgerSummaryReport:
|
||||
for account in self.party_adjustment_accounts:
|
||||
row["adj_" + scrub(account)] = adjustments.get(account, 0)
|
||||
|
||||
if self.filters.show_dr_cr:
|
||||
if self.filters.party_type == "Customer":
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Dr" if balance > 0 else "Cr" if balance < 0 else ""
|
||||
else:
|
||||
balance = row.get("closing_balance", 0)
|
||||
row["dr_or_cr"] = "Cr" if balance > 0 else "Dr" if balance < 0 else ""
|
||||
|
||||
out.append(row)
|
||||
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user