fix: sending proper arguments for report
This commit is contained in:
parent
48b0f0da96
commit
fa932e2a3e
@ -1,7 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt, getdate
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category \
|
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category \
|
||||||
import get_advance_vouchers, get_debit_note_amount
|
import get_advance_vouchers, get_debit_note_amount
|
||||||
@ -55,7 +55,7 @@ def get_result(filters):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
account = []
|
account = []
|
||||||
total_invoiced_amount, tds_deducted = get_invoice_and_tds_amount(supplier.name, account,
|
total_invoiced_amount, tds_deducted = get_invoice_and_tds_amount(supplier.name, account,
|
||||||
filters.company, filters.from_date, filters.to_date)
|
filters.company, filters.from_date, filters.to_date, filters.fiscal_year)
|
||||||
|
|
||||||
if total_invoiced_amount or tds_deducted:
|
if total_invoiced_amount or tds_deducted:
|
||||||
row = [supplier.pan, supplier.name]
|
row = [supplier.pan, supplier.name]
|
||||||
@ -68,7 +68,7 @@ def get_result(filters):
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date):
|
def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date, fiscal_year):
|
||||||
''' calculate total invoice amount and total tds deducted for given supplier '''
|
''' calculate total invoice amount and total tds deducted for given supplier '''
|
||||||
|
|
||||||
entries = frappe.db.sql("""
|
entries = frappe.db.sql("""
|
||||||
@ -94,7 +94,9 @@ def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date):
|
|||||||
""".format(', '.join(["'%s'" % d for d in vouchers])),
|
""".format(', '.join(["'%s'" % d for d in vouchers])),
|
||||||
(account, from_date, to_date, company))[0][0])
|
(account, from_date, to_date, company))[0][0])
|
||||||
|
|
||||||
debit_note_amount = get_debit_note_amount([supplier], from_date, to_date, company=company)
|
date_range_filter = [fiscal_year, from_date, to_date]
|
||||||
|
|
||||||
|
debit_note_amount = get_debit_note_amount([supplier], date_range_filter, company=company)
|
||||||
|
|
||||||
total_invoiced_amount = supplier_credit_amount + tds_deducted - debit_note_amount
|
total_invoiced_amount = supplier_credit_amount + tds_deducted - debit_note_amount
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user