mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 05:29:18 +00:00
[cleanup] [accounts] delete gl entries on cancellation of accounting transactions
This commit is contained in:
@@ -73,7 +73,7 @@ def get_gl_entries(filters, before_report_date=True):
|
||||
conditions, supplier_accounts = get_conditions(filters, before_report_date)
|
||||
gl_entries = []
|
||||
gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||
where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" %
|
||||
where docstatus < 2 %s order by posting_date, account""" %
|
||||
(conditions), tuple(supplier_accounts), as_dict=1)
|
||||
return gl_entries
|
||||
|
||||
@@ -126,7 +126,7 @@ def get_outstanding_amount(gle, report_date):
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry`
|
||||
where account = %s and posting_date <= %s and against_voucher_type = %s
|
||||
and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""",
|
||||
and against_voucher = %s and name != %s""",
|
||||
(gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0]
|
||||
|
||||
outstanding_amount = flt(gle.credit) - flt(gle.debit) - flt(payment_amount)
|
||||
|
||||
@@ -65,7 +65,7 @@ def get_columns():
|
||||
def get_gl_entries(filters, upto_report_date=True):
|
||||
conditions, customer_accounts = get_conditions(filters, upto_report_date)
|
||||
return webnotes.conn.sql("""select * from `tabGL Entry`
|
||||
where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" %
|
||||
where docstatus < 2 %s order by posting_date, account""" %
|
||||
(conditions), tuple(customer_accounts), as_dict=1)
|
||||
|
||||
def get_conditions(filters, upto_report_date=True):
|
||||
@@ -116,7 +116,7 @@ def get_outstanding_amount(gle, report_date):
|
||||
select sum(ifnull(credit, 0)) - sum(ifnull(debit, 0))
|
||||
from `tabGL Entry`
|
||||
where account = %s and posting_date <= %s and against_voucher_type = %s
|
||||
and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""",
|
||||
and against_voucher = %s and name != %s""",
|
||||
(gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0]
|
||||
|
||||
return flt(gle.debit) - flt(gle.credit) - flt(payment_amount)
|
||||
@@ -130,7 +130,7 @@ def get_payment_amount(gle, report_date, entries_after_report_date):
|
||||
payment_amount = webnotes.conn.sql("""
|
||||
select sum(ifnull(credit, 0)) - sum(ifnull(debit, 0)) from `tabGL Entry`
|
||||
where account = %s and posting_date <= %s and against_voucher_type = %s
|
||||
and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""",
|
||||
and against_voucher = %s and name != %s""",
|
||||
(gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0]
|
||||
|
||||
return flt(payment_amount)
|
||||
|
||||
@@ -87,7 +87,7 @@ def get_actual_details(filters):
|
||||
return webnotes.conn.sql("""select gl.account, gl.debit, gl.credit,
|
||||
gl.cost_center, MONTHNAME(gl.posting_date) as month_name
|
||||
from `tabGL Entry` gl, `tabBudget Detail` bd
|
||||
where gl.fiscal_year=%s and company=%s and is_cancelled='No'
|
||||
where gl.fiscal_year=%s and company=%s
|
||||
and bd.account=gl.account""" % ('%s', '%s'),
|
||||
(filters.get("fiscal_year"), filters.get("company")), as_dict=1)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ def get_stock_ledger_entries(filters):
|
||||
voucher_detail_no, posting_date, posting_time, stock_value,
|
||||
warehouse, actual_qty as qty
|
||||
from `tabStock Ledger Entry`
|
||||
where ifnull(`is_cancelled`, "No") = "No" """
|
||||
where ifnull(`is_cancelled`, 'No') = No'"""
|
||||
|
||||
if filters.get("company"):
|
||||
query += """ and company=%(company)s"""
|
||||
|
||||
Reference in New Issue
Block a user