Merge pull request #5446 from rohitwaghchaure/purchase_register_total_amount_issue

[Fixes] Purchase register, showing wrong value for total amount if tax has deducted.
This commit is contained in:
Nabin Hait 2016-06-21 16:29:27 +05:30 committed by GitHub
commit 5db108116a

View File

@ -147,10 +147,11 @@ def get_invoice_expense_map(invoice_list):
def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
tax_details = frappe.db.sql("""
select parent, account_head, sum(base_tax_amount_after_discount_amount) as tax_amount
select parent, account_head, case add_deduct_tax when "Add" then sum(base_tax_amount_after_discount_amount)
else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount
from `tabPurchase Taxes and Charges`
where parent in (%s) and category in ('Total', 'Valuation and Total')
group by parent, account_head
group by parent, account_head, add_deduct_tax
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_tax_map = {}