Option for selecting already reconciled entries in bank reconciliation #1310
This commit is contained in:
parent
5c82014ba9
commit
3190f99ebe
@ -2,7 +2,7 @@
|
|||||||
"allow_copy": 1,
|
"allow_copy": 1,
|
||||||
"allow_email": 1,
|
"allow_email": 1,
|
||||||
"allow_print": 1,
|
"allow_print": 1,
|
||||||
"creation": "2013-01-10 16:34:05.000000",
|
"creation": "2013-01-10 16:34:05",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -10,6 +10,7 @@
|
|||||||
"description": "Select account head of the bank where cheque was deposited.",
|
"description": "Select account head of the bank where cheque was deposited.",
|
||||||
"fieldname": "bank_account",
|
"fieldname": "bank_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Bank Account",
|
"label": "Bank Account",
|
||||||
"options": "Account",
|
"options": "Account",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -19,6 +20,7 @@
|
|||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -28,6 +30,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "from_date",
|
"fieldname": "from_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "From Date",
|
"label": "From Date",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
@ -35,14 +38,22 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "to_date",
|
"fieldname": "to_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "To Date",
|
"label": "To Date",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"reqd": 1
|
"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",
|
"fieldtype": "Button",
|
||||||
"label": "Get Non Reconciled Entries",
|
"label": "Get Relevant Entries",
|
||||||
"options": "get_details",
|
"options": "get_details",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
@ -74,7 +85,7 @@
|
|||||||
"icon": "icon-check",
|
"icon": "icon-check",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"modified": "2013-07-05 14:26:22.000000",
|
"modified": "2014-05-06 16:26:08.984595",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Bank Reconciliation",
|
"name": "Bank Reconciliation",
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import cstr, flt, getdate, nowdate
|
from frappe.utils import flt, getdate, nowdate
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
@ -13,29 +13,34 @@ class BankReconciliation(Document):
|
|||||||
msgprint("Bank Account, From Date and To Date are Mandatory")
|
msgprint("Bank Account, From Date and To Date are Mandatory")
|
||||||
return
|
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,
|
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
|
from
|
||||||
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
|
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
|
||||||
where
|
where
|
||||||
t2.parent = t1.name and t2.account = %s
|
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 %s""" %
|
||||||
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1""",
|
('%s', '%s', '%s', condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||||
(self.bank_account, self.from_date, self.to_date))
|
|
||||||
|
|
||||||
self.set('entries', [])
|
self.set('entries', [])
|
||||||
self.total_amount = 0.0
|
self.total_amount = 0.0
|
||||||
|
|
||||||
for d in dl:
|
for d in dl:
|
||||||
nl = self.append('entries', {})
|
nl = self.append('entries', {})
|
||||||
nl.posting_date = cstr(d[5])
|
nl.posting_date = d.posting_date
|
||||||
nl.voucher_id = cstr(d[0])
|
nl.voucher_id = d.name
|
||||||
nl.cheque_number = cstr(d[1])
|
nl.cheque_number = d.cheque_no
|
||||||
nl.cheque_date = cstr(d[2])
|
nl.cheque_date = d.cheque_date
|
||||||
nl.debit = flt(d[3])
|
nl.debit = d.debit
|
||||||
nl.credit = flt(d[4])
|
nl.credit = d.credit
|
||||||
nl.against_account = cstr(d[6])
|
nl.against_account = d.against_account
|
||||||
self.total_amount += flt(flt(d[4]) - flt(d[3]))
|
nl.clearance_date = d.clearance_date
|
||||||
|
self.total_amount += flt(d.debit) - flt(d.credit)
|
||||||
|
|
||||||
def update_details(self):
|
def update_details(self):
|
||||||
vouchers = []
|
vouchers = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user