Option for selecting already reconciled entries in bank reconciliation #1310

This commit is contained in:
Nabin Hait 2014-05-06 16:38:14 +05:30
parent 5c82014ba9
commit 3190f99ebe
2 changed files with 33 additions and 17 deletions

View File

@ -2,7 +2,7 @@
"allow_copy": 1,
"allow_email": 1,
"allow_print": 1,
"creation": "2013-01-10 16:34:05.000000",
"creation": "2013-01-10 16:34:05",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -10,6 +10,7 @@
"description": "Select account head of the bank where cheque was deposited.",
"fieldname": "bank_account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Bank Account",
"options": "Account",
"permlevel": 0,
@ -19,6 +20,7 @@
"fieldname": "company",
"fieldtype": "Link",
"hidden": 1,
"in_list_view": 1,
"label": "Company",
"options": "Company",
"permlevel": 0,
@ -28,6 +30,7 @@
{
"fieldname": "from_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "From Date",
"permlevel": 0,
"reqd": 1
@ -35,14 +38,22 @@
{
"fieldname": "to_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "To Date",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "get_non_reconciled_entries",
"fieldname": "include_reconciled_entries",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Include Reconciled Entries",
"permlevel": 0
},
{
"fieldname": "get_relevant_entries",
"fieldtype": "Button",
"label": "Get Non Reconciled Entries",
"label": "Get Relevant Entries",
"options": "get_details",
"permlevel": 0
},
@ -74,7 +85,7 @@
"icon": "icon-check",
"idx": 1,
"issingle": 1,
"modified": "2013-07-05 14:26:22.000000",
"modified": "2014-05-06 16:26:08.984595",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, getdate, nowdate
from frappe.utils import flt, getdate, nowdate
from frappe import msgprint, _
from frappe.model.document import Document
@ -13,29 +13,34 @@ class BankReconciliation(Document):
msgprint("Bank Account, From Date and To Date are Mandatory")
return
condition = ""
if not self.include_reconciled_entries:
condition = "and ifnull(clearance_date, '') in ('', '0000-00-00')"
dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit,
t2.credit, t1.posting_date, t2.against_account
t2.credit, t1.posting_date, t2.against_account, t1.clearance_date
from
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
where
t2.parent = t1.name and t2.account = %s
and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '')
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1""",
(self.bank_account, self.from_date, self.to_date))
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1 %s""" %
('%s', '%s', '%s', condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
self.set('entries', [])
self.total_amount = 0.0
for d in dl:
nl = self.append('entries', {})
nl.posting_date = cstr(d[5])
nl.voucher_id = cstr(d[0])
nl.cheque_number = cstr(d[1])
nl.cheque_date = cstr(d[2])
nl.debit = flt(d[3])
nl.credit = flt(d[4])
nl.against_account = cstr(d[6])
self.total_amount += flt(flt(d[4]) - flt(d[3]))
nl.posting_date = d.posting_date
nl.voucher_id = d.name
nl.cheque_number = d.cheque_no
nl.cheque_date = d.cheque_date
nl.debit = d.debit
nl.credit = d.credit
nl.against_account = d.against_account
nl.clearance_date = d.clearance_date
self.total_amount += flt(d.debit) - flt(d.credit)
def update_details(self):
vouchers = []