From 237f3765e560b4e69f0d84f30125da6d30f8b122 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Aug 2014 16:29:06 +0530 Subject: [PATCH 1/2] Bank reconciliation statement: show amounts which has cleared in the bank but not registered in the system --- .../bank_reconciliation_statement.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 119de09e41..2c0a6afb79 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -15,25 +15,36 @@ def execute(filters=None): data = get_entries(filters) from erpnext.accounts.utils import get_balance_on - balance_as_per_company = get_balance_on(filters["account"], filters["report_date"]) + balance_as_per_system = get_balance_on(filters["account"], filters["report_date"]) total_debit, total_credit = 0,0 for d in data: total_debit += flt(d[2]) total_credit += flt(d[3]) - bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit) + amounts_not_reflected_in_system = frappe.db.sql("""select sum(ifnull(jvd.debit, 0) - ifnull(jvd.credit, 0)) + from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv + where jvd.parent = jv.name and jv.docstatus=1 and jvd.account=%s + and jv.posting_date > %s and jv.clearance_date <= %s + """, (filters["account"], filters["report_date"], filters["report_date"])) + + amounts_not_reflected_in_system = flt(amounts_not_reflected_in_system[0][0]) \ + if amounts_not_reflected_in_system else 0.0 + + bank_bal = flt(balance_as_per_system) - flt(total_debit) + flt(total_credit) \ + + amounts_not_reflected_in_system data += [ - get_balance_row("Balance as per company books", balance_as_per_company), + get_balance_row("Balance as per system", balance_as_per_system), ["", "Amounts not reflected in bank", total_debit, total_credit, "", "", "", ""], + get_balance_row("Amounts not reflected in system", amounts_not_reflected_in_system), get_balance_row("Balance as per bank", bank_bal) ] return columns, data def get_columns(): - return ["Posting Date:Date:100", "Journal Voucher:Link/Journal Voucher:200", + return ["Posting Date:Date:100", "Journal Voucher:Link/Journal Voucher:220", "Debit:Currency:120", "Credit:Currency:120", "Against Account:Link/Account:200", "Reference::100", "Ref Date:Date:110", "Clearance Date:Date:110" ] @@ -55,4 +66,4 @@ def get_balance_row(label, amount): if amount > 0: return ["", label, amount, 0, "", "", "", ""] else: - return ["", label, 0, amount, "", "", "", ""] + return ["", label, 0, abs(amount), "", "", "", ""] From 432431f2e6d392d2684705d98cb2b26a18ad6656 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Aug 2014 16:49:44 +0530 Subject: [PATCH 2/2] fix for translation --- .../bank_reconciliation_statement.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 2c0a6afb79..4fda0300b6 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import flt +from frappe import _ def execute(filters=None): if not filters: filters = {} @@ -35,10 +36,12 @@ def execute(filters=None): + amounts_not_reflected_in_system data += [ - get_balance_row("Balance as per system", balance_as_per_system), - ["", "Amounts not reflected in bank", total_debit, total_credit, "", "", "", ""], - get_balance_row("Amounts not reflected in system", amounts_not_reflected_in_system), - get_balance_row("Balance as per bank", bank_bal) + get_balance_row(_("System Balance"), balance_as_per_system), + [""]*len(columns), + ["", _("Amounts not reflected in bank"), total_debit, total_credit, "", "", "", ""], + get_balance_row(_("Amounts not reflected in system"), amounts_not_reflected_in_system), + [""]*len(columns), + get_balance_row(_("Expected balance as per bank"), bank_bal) ] return columns, data