[fix] Opening balance in trial balance and general ledger based on is_opening

This commit is contained in:
Nabin Hait 2015-06-17 15:35:06 +05:30
parent 1ac9f2f50d
commit e91025c0aa
3 changed files with 3 additions and 4 deletions

View File

@ -210,7 +210,7 @@ def get_gl_entries(company, from_date, to_date, root_lft, root_rgt, ignore_closi
if from_date: if from_date:
additional_conditions.append("and posting_date >= %(from_date)s") additional_conditions.append("and posting_date >= %(from_date)s")
gl_entries = frappe.db.sql("""select posting_date, account, debit, credit from `tabGL Entry` gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening from `tabGL Entry`
where company=%(company)s where company=%(company)s
{additional_conditions} {additional_conditions}
and posting_date <= %(to_date)s and posting_date <= %(to_date)s

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import flt, getdate from frappe.utils import flt, getdate, cstr
from frappe import _ from frappe import _
def execute(filters=None): def execute(filters=None):

View File

@ -90,8 +90,7 @@ def get_rootwise_opening_balances(filters, report_type):
where where
company=%(company)s company=%(company)s
{additional_conditions} {additional_conditions}
and (posting_date < %(from_date)s or and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
(posting_date >= %(from_date)s and ifnull(is_opening, 'No') = 'Yes'))
and account in (select name from `tabAccount` where report_type=%(report_type)s) and account in (select name from `tabAccount` where report_type=%(report_type)s)
group by account""".format(additional_conditions=additional_conditions), group by account""".format(additional_conditions=additional_conditions),
{ {