Merge pull request #17058 from hrwX/bank_reco_fix
fix(Bank Reconciliation): get credit and debit in float and not string
This commit is contained in:
commit
fb8f1b93d6
@ -23,36 +23,36 @@ class BankReconciliation(Document):
|
|||||||
|
|
||||||
|
|
||||||
journal_entries = frappe.db.sql("""
|
journal_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
"Journal Entry" as payment_document, t1.name as payment_entry,
|
"Journal Entry" as payment_document, t1.name as payment_entry,
|
||||||
t1.cheque_no as cheque_number, t1.cheque_date,
|
t1.cheque_no as cheque_number, t1.cheque_date,
|
||||||
sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit,
|
sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit,
|
||||||
t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency
|
t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency
|
||||||
from
|
from
|
||||||
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
||||||
where
|
where
|
||||||
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
||||||
and t1.posting_date >= %s and t1.posting_date <= %s
|
and t1.posting_date >= %s and t1.posting_date <= %s
|
||||||
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
||||||
group by t2.account, t1.name
|
group by t2.account, t1.name
|
||||||
order by t1.posting_date ASC, t1.name DESC
|
order by t1.posting_date ASC, t1.name DESC
|
||||||
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||||
|
|
||||||
payment_entries = frappe.db.sql("""
|
payment_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
"Payment Entry" as payment_document, name as payment_entry,
|
"Payment Entry" as payment_document, name as payment_entry,
|
||||||
reference_no as cheque_number, reference_date as cheque_date,
|
reference_no as cheque_number, reference_date as cheque_date,
|
||||||
if(paid_from=%(account)s, paid_amount, "") as credit,
|
if(paid_from=%(account)s, paid_amount, 0) as credit,
|
||||||
if(paid_from=%(account)s, "", received_amount) as debit,
|
if(paid_from=%(account)s, 0, received_amount) as debit,
|
||||||
posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
|
posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
|
||||||
if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
|
if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
|
||||||
from `tabPayment Entry`
|
from `tabPayment Entry`
|
||||||
where
|
where
|
||||||
(paid_from=%(account)s or paid_to=%(account)s) and docstatus=1
|
(paid_from=%(account)s or paid_to=%(account)s) and docstatus=1
|
||||||
and posting_date >= %(from)s and posting_date <= %(to)s {0}
|
and posting_date >= %(from)s and posting_date <= %(to)s {0}
|
||||||
order by
|
order by
|
||||||
posting_date ASC, name DESC
|
posting_date ASC, name DESC
|
||||||
""".format(condition),
|
""".format(condition),
|
||||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||||
|
|
||||||
pos_entries = []
|
pos_entries = []
|
||||||
@ -107,10 +107,10 @@ class BankReconciliation(Document):
|
|||||||
d.clearance_date = None
|
d.clearance_date = None
|
||||||
|
|
||||||
frappe.db.set_value(d.payment_document, d.payment_entry, "clearance_date", d.clearance_date)
|
frappe.db.set_value(d.payment_document, d.payment_entry, "clearance_date", d.clearance_date)
|
||||||
frappe.db.sql("""update `tab{0}` set clearance_date = %s, modified = %s
|
frappe.db.sql("""update `tab{0}` set clearance_date = %s, modified = %s
|
||||||
where name=%s""".format(d.payment_document),
|
where name=%s""".format(d.payment_document),
|
||||||
(d.clearance_date, nowdate(), d.payment_entry))
|
(d.clearance_date, nowdate(), d.payment_entry))
|
||||||
|
|
||||||
clearance_date_updated = True
|
clearance_date_updated = True
|
||||||
|
|
||||||
if clearance_date_updated:
|
if clearance_date_updated:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user