fix(Party Ledger Summary): Added Supplier/Customer Name column
This commit is contained in:
parent
55566b7f8e
commit
31d58eac01
@ -134,7 +134,7 @@ class PartyLedgerSummaryReport(object):
|
|||||||
for gle in self.gl_entries:
|
for gle in self.gl_entries:
|
||||||
self.party_data.setdefault(gle.party, frappe._dict({
|
self.party_data.setdefault(gle.party, frappe._dict({
|
||||||
"party": gle.party,
|
"party": gle.party,
|
||||||
"party_name": "", # TODO add party_name
|
"party_name": gle.party_name,
|
||||||
"opening_balance": 0,
|
"opening_balance": 0,
|
||||||
"invoiced_amount": 0,
|
"invoiced_amount": 0,
|
||||||
"paid_amount": 0,
|
"paid_amount": 0,
|
||||||
@ -171,16 +171,25 @@ class PartyLedgerSummaryReport(object):
|
|||||||
|
|
||||||
def get_gl_entries(self):
|
def get_gl_entries(self):
|
||||||
conditions = self.prepare_conditions()
|
conditions = self.prepare_conditions()
|
||||||
|
join = join_field = ""
|
||||||
|
if self.filters.party_type == "Customer":
|
||||||
|
join_field = ", p.customer_name as party_name"
|
||||||
|
join = "left join `tabCustomer` p on gle.party = p.name"
|
||||||
|
elif self.filters.party_type == "Supplier":
|
||||||
|
join_field = ", p.supplier_name as party_name"
|
||||||
|
join = "left join `tabSupplier` p on gle.party = p.name"
|
||||||
|
|
||||||
self.gl_entries = frappe.db.sql("""
|
self.gl_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
posting_date, party, voucher_type, voucher_no, against_voucher_type, against_voucher, debit, credit
|
gle.posting_date, gle.party, gle.voucher_type, gle.voucher_no, gle.against_voucher_type,
|
||||||
from
|
gle.against_voucher, gle.debit, gle.credit {join_field}
|
||||||
`tabGL Entry`
|
from `tabGL Entry` gle
|
||||||
|
{join}
|
||||||
where
|
where
|
||||||
docstatus < 2 and party_type=%(party_type)s and ifnull(party, '') != '' and posting_date <= %(to_date)s
|
gle.docstatus < 2 and gle.party_type=%(party_type)s and ifnull(gle.party, '') != ''
|
||||||
{0}
|
and gle.posting_date <= %(to_date)s {conditions}
|
||||||
order by posting_date""".format(conditions), self.filters, as_dict=True)
|
order by gle.posting_date
|
||||||
|
""".format(join=join, join_field=join_field, conditions=conditions), self.filters, as_dict=True)
|
||||||
|
|
||||||
def prepare_conditions(self):
|
def prepare_conditions(self):
|
||||||
conditions = [""]
|
conditions = [""]
|
||||||
@ -265,7 +274,6 @@ class PartyLedgerSummaryReport(object):
|
|||||||
where gle.party_type=%(party_type)s and ifnull(party, '') != ''
|
where gle.party_type=%(party_type)s and ifnull(party, '') != ''
|
||||||
and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 {conditions}
|
and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 {conditions}
|
||||||
)
|
)
|
||||||
order by posting_date
|
|
||||||
""".format(conditions=conditions, income_or_expense=income_or_expense), self.filters, as_dict=True)
|
""".format(conditions=conditions, income_or_expense=income_or_expense), self.filters, as_dict=True)
|
||||||
|
|
||||||
self.party_adjustment_details = {}
|
self.party_adjustment_details = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user