mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Merge pull request #52595 from ljain112/fix-tds-report-v15
fix: add base_tax_withholding_net_total to tax withholding report
This commit is contained in:
@@ -51,7 +51,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
|
|||||||
entries = {}
|
entries = {}
|
||||||
for name, details in gle_map.items():
|
for name, details in gle_map.items():
|
||||||
for entry in details:
|
for entry in details:
|
||||||
tax_amount, total_amount, grand_total, base_total = 0, 0, 0, 0
|
tax_amount, total_amount, grand_total, base_total, base_tax_withholding_net_total = 0, 0, 0, 0, 0
|
||||||
tax_withholding_category, rate = None, None
|
tax_withholding_category, rate = None, None
|
||||||
bill_no, bill_date = "", ""
|
bill_no, bill_date = "", ""
|
||||||
party = entry.party or entry.against
|
party = entry.party or entry.against
|
||||||
@@ -83,6 +83,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
|
|||||||
# back calculate total amount from rate and tax_amount
|
# back calculate total amount from rate and tax_amount
|
||||||
base_total = min(flt(tax_amount / (rate / 100), precision=precision), values[0])
|
base_total = min(flt(tax_amount / (rate / 100), precision=precision), values[0])
|
||||||
total_amount = grand_total = base_total
|
total_amount = grand_total = base_total
|
||||||
|
base_tax_withholding_net_total = total_amount
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if tax_amount and rate:
|
if tax_amount and rate:
|
||||||
@@ -93,12 +94,16 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
|
|||||||
|
|
||||||
grand_total = values[1]
|
grand_total = values[1]
|
||||||
base_total = values[2]
|
base_total = values[2]
|
||||||
|
base_tax_withholding_net_total = total_amount
|
||||||
|
|
||||||
if voucher_type == "Purchase Invoice":
|
if voucher_type == "Purchase Invoice":
|
||||||
|
base_tax_withholding_net_total = values[0]
|
||||||
bill_no = values[3]
|
bill_no = values[3]
|
||||||
bill_date = values[4]
|
bill_date = values[4]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
total_amount += entry.credit
|
total_amount += entry.credit
|
||||||
|
base_tax_withholding_net_total = total_amount
|
||||||
|
|
||||||
if tax_amount:
|
if tax_amount:
|
||||||
if party_map.get(party, {}).get("party_type") == "Supplier":
|
if party_map.get(party, {}).get("party_type") == "Supplier":
|
||||||
@@ -125,6 +130,7 @@ def get_result(filters, tds_docs, tds_accounts, tax_category_map, journal_entry_
|
|||||||
"rate": rate,
|
"rate": rate,
|
||||||
"total_amount": total_amount,
|
"total_amount": total_amount,
|
||||||
"grand_total": grand_total,
|
"grand_total": grand_total,
|
||||||
|
"base_tax_withholding_net_total": base_tax_withholding_net_total,
|
||||||
"base_total": base_total,
|
"base_total": base_total,
|
||||||
"tax_amount": tax_amount,
|
"tax_amount": tax_amount,
|
||||||
"transaction_date": posting_date,
|
"transaction_date": posting_date,
|
||||||
@@ -252,14 +258,14 @@ def get_columns(filters):
|
|||||||
"width": 60,
|
"width": 60,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Total Amount"),
|
"label": _("Tax Withholding Net Total"),
|
||||||
"fieldname": "total_amount",
|
"fieldname": "base_tax_withholding_net_total",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 120,
|
"width": 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Base Total"),
|
"label": _("Taxable Amount"),
|
||||||
"fieldname": "base_total",
|
"fieldname": "total_amount",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 120,
|
"width": 120,
|
||||||
},
|
},
|
||||||
@@ -270,10 +276,16 @@ def get_columns(filters):
|
|||||||
"width": 120,
|
"width": 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Grand Total"),
|
"label": _("Grand Total (Company Currency)"),
|
||||||
|
"fieldname": "base_total",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Grand Total (Transaction Currency)"),
|
||||||
"fieldname": "grand_total",
|
"fieldname": "grand_total",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 120,
|
"width": 170,
|
||||||
},
|
},
|
||||||
{"label": _("Transaction Type"), "fieldname": "transaction_type", "width": 130},
|
{"label": _("Transaction Type"), "fieldname": "transaction_type", "width": 130},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase):
|
|||||||
result = execute(filters)[1]
|
result = execute(filters)[1]
|
||||||
expected_values = [
|
expected_values = [
|
||||||
# Check for JV totals using back calculation logic
|
# Check for JV totals using back calculation logic
|
||||||
[jv.name, "TCS", 0.075, -10000.0, -7.5, -10000.0],
|
[jv.name, "TCS", 0.075, -10000.0, -10000.0, -7.5, -10000.0],
|
||||||
[pe.name, "TCS", 0.075, 2550, 0.53, 2550.53],
|
[pe.name, "TCS", 0.075, 706.67, 2550.0, 0.53, 2550.53],
|
||||||
[si.name, "TCS", 0.075, 1000, 0.52, 1000.52],
|
[si.name, "TCS", 0.075, 693.33, 1000.0, 0.52, 1000.52],
|
||||||
]
|
]
|
||||||
self.check_expected_values(result, expected_values)
|
self.check_expected_values(result, expected_values)
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase):
|
|||||||
frappe._dict(company="_Test Company", party_type="Supplier", from_date=today(), to_date=today())
|
frappe._dict(company="_Test Company", party_type="Supplier", from_date=today(), to_date=today())
|
||||||
)[1]
|
)[1]
|
||||||
expected_values = [
|
expected_values = [
|
||||||
[inv_1.name, "TDS - 1", 10, 5000, 500, 5500],
|
[inv_1.name, "TDS - 1", 10, 5000, 5000, 500, 5500],
|
||||||
[inv_2.name, "TDS - 2", 20, 5000, 1000, 6000],
|
[inv_2.name, "TDS - 2", 20, 5000, 5000, 1000, 6000],
|
||||||
]
|
]
|
||||||
self.check_expected_values(result, expected_values)
|
self.check_expected_values(result, expected_values)
|
||||||
|
|
||||||
@@ -107,8 +107,8 @@ class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase):
|
|||||||
)[1]
|
)[1]
|
||||||
|
|
||||||
expected_values = [
|
expected_values = [
|
||||||
[inv_1.name, "TDS - 3", 10.0, 5000, 500, 4500],
|
[inv_1.name, "TDS - 3", 10.0, 5000, 5000, 500, 4500],
|
||||||
[inv_2.name, "TDS - 3", 20.0, 5000, 1000, 4000],
|
[inv_2.name, "TDS - 3", 20.0, 5000, 5000, 1000, 4000],
|
||||||
]
|
]
|
||||||
self.check_expected_values(result, expected_values)
|
self.check_expected_values(result, expected_values)
|
||||||
|
|
||||||
@@ -120,6 +120,7 @@ class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase):
|
|||||||
voucher.ref_no,
|
voucher.ref_no,
|
||||||
voucher.section_code,
|
voucher.section_code,
|
||||||
voucher.rate,
|
voucher.rate,
|
||||||
|
voucher.base_tax_withholding_net_total,
|
||||||
voucher.base_total,
|
voucher.base_total,
|
||||||
voucher.tax_amount,
|
voucher.tax_amount,
|
||||||
voucher.grand_total,
|
voucher.grand_total,
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ def get_columns(filters):
|
|||||||
"width": 120,
|
"width": 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Total Amount"),
|
"label": _("Total Taxable Amount"),
|
||||||
"fieldname": "total_amount",
|
"fieldname": "total_amount",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 120,
|
"width": 120,
|
||||||
|
|||||||
Reference in New Issue
Block a user