[Fix] Negative amount showing in the bank clearance summary
This commit is contained in:
parent
137a24f457
commit
1ff1fc4725
@ -35,16 +35,22 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
def get_entries(filters):
|
def get_entries(filters):
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
|
journal_entries = frappe.db.sql("""SELECT
|
||||||
jv.cheque_no, jv.clearance_date, jvd.against_account, (jvd.debit - jvd.credit)
|
"Journal Entry", jv.name, jv.posting_date, jv.cheque_no, jv.clearance_date, jvd.against_account,
|
||||||
from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
|
if((jvd.debit - jvd.credit) < 0, (jvd.debit - jvd.credit) * -1, (jvd.debit - jvd.credit))
|
||||||
where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
|
FROM
|
||||||
order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
|
`tabJournal Entry Account` jvd, `tabJournal Entry` jv
|
||||||
|
WHERE
|
||||||
|
jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
|
||||||
|
order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
|
||||||
|
|
||||||
payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date,
|
payment_entries = frappe.db.sql("""SELECT
|
||||||
reference_no, clearance_date, party, if(paid_from=%(account)s, paid_amount, received_amount)
|
"Payment Entry", name, posting_date, reference_no, clearance_date, party,
|
||||||
from `tabPayment Entry`
|
if(paid_from=%(account)s, paid_amount, received_amount)
|
||||||
where docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
|
FROM
|
||||||
order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
|
`tabPayment Entry`
|
||||||
|
WHERE
|
||||||
|
docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
|
||||||
|
order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
|
||||||
|
|
||||||
return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
|
return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
|
Loading…
x
Reference in New Issue
Block a user