Merge pull request #37211 from deepeshgarg007/trial_balance_net_values
feat: Toggle net values in Trial Balance report
This commit is contained in:
commit
9dbb9e7515
@ -99,6 +99,12 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"label": __("Include Default Book Entries"),
|
"label": __("Include Default Book Entries"),
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"default": 1
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_net_values",
|
||||||
|
"label": __("Show net values in opening and closing columns"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"formatter": erpnext.financial_statements.formatter,
|
"formatter": erpnext.financial_statements.formatter,
|
||||||
|
|||||||
@ -120,7 +120,9 @@ def get_data(filters):
|
|||||||
ignore_opening_entries=True,
|
ignore_opening_entries=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
calculate_values(accounts, gl_entries_by_account, opening_balances)
|
calculate_values(
|
||||||
|
accounts, gl_entries_by_account, opening_balances, filters.get("show_net_values")
|
||||||
|
)
|
||||||
accumulate_values_into_parents(accounts, accounts_by_name)
|
accumulate_values_into_parents(accounts, accounts_by_name)
|
||||||
|
|
||||||
data = prepare_data(accounts, filters, parent_children_map, company_currency)
|
data = prepare_data(accounts, filters, parent_children_map, company_currency)
|
||||||
@ -310,7 +312,7 @@ def get_opening_balance(
|
|||||||
return gle
|
return gle
|
||||||
|
|
||||||
|
|
||||||
def calculate_values(accounts, gl_entries_by_account, opening_balances):
|
def calculate_values(accounts, gl_entries_by_account, opening_balances, show_net_values):
|
||||||
init = {
|
init = {
|
||||||
"opening_debit": 0.0,
|
"opening_debit": 0.0,
|
||||||
"opening_credit": 0.0,
|
"opening_credit": 0.0,
|
||||||
@ -335,6 +337,7 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances):
|
|||||||
d["closing_debit"] = d["opening_debit"] + d["debit"]
|
d["closing_debit"] = d["opening_debit"] + d["debit"]
|
||||||
d["closing_credit"] = d["opening_credit"] + d["credit"]
|
d["closing_credit"] = d["opening_credit"] + d["credit"]
|
||||||
|
|
||||||
|
if show_net_values:
|
||||||
prepare_opening_closing(d)
|
prepare_opening_closing(d)
|
||||||
|
|
||||||
|
|
||||||
@ -375,7 +378,7 @@ def prepare_data(accounts, filters, parent_children_map, company_currency):
|
|||||||
|
|
||||||
for d in accounts:
|
for d in accounts:
|
||||||
# Prepare opening closing for group account
|
# Prepare opening closing for group account
|
||||||
if parent_children_map.get(d.account):
|
if parent_children_map.get(d.account) and filters.get("show_net_values"):
|
||||||
prepare_opening_closing(d)
|
prepare_opening_closing(d)
|
||||||
|
|
||||||
has_value = False
|
has_value = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user