fix: Bank Statement loan amount query

This commit is contained in:
Rucha Mahabal 2022-06-27 19:18:13 +05:30
parent ba8ea0f4fb
commit 2b255bdddb

View File

@ -276,14 +276,13 @@ def get_loan_amount(filters):
frappe.qb.from_(loan_doc) frappe.qb.from_(loan_doc)
.select(amount_field) .select(amount_field)
.where(loan_doc.docstatus == 1) .where(loan_doc.docstatus == 1)
.where(salary_condition)
.where(account == filters.get("account")) .where(account == filters.get("account"))
.where(posting_date > getdate(filters.get("report_date"))) .where(posting_date > getdate(filters.get("report_date")))
.where(ifnull(loan_doc.clearance_date, "4000-01-01") <= getdate(filters.get("report_date"))) .where(ifnull(loan_doc.clearance_date, "4000-01-01") <= getdate(filters.get("report_date")))
) )
if doctype == "Loan Repayment" and frappe.db.has_column("Loan Repayment", "repay_from_salary"): if doctype == "Loan Repayment" and frappe.db.has_column("Loan Repayment", "repay_from_salary"):
query = query.run((loan_doc.repay_from_salary == 0)) query = query.where((loan_doc.repay_from_salary == 0))
amount = query.run()[0][0] amount = query.run()[0][0]
total_amount += flt(amount) total_amount += flt(amount)