chore: Handle edge cases
This commit is contained in:
@@ -437,36 +437,40 @@ def get_tds_amount(ldc, parties, inv, tax_details, tax_deducted, vouchers):
|
|||||||
|
|
||||||
def get_tcs_amount(parties, inv, tax_details, vouchers, adv_vouchers):
|
def get_tcs_amount(parties, inv, tax_details, vouchers, adv_vouchers):
|
||||||
tcs_amount = 0
|
tcs_amount = 0
|
||||||
|
invoiced_amt = 0
|
||||||
|
advance_amt = 0
|
||||||
|
|
||||||
# sum of debit entries made from sales invoices
|
# sum of debit entries made from sales invoices
|
||||||
invoiced_amt = (
|
if vouchers:
|
||||||
frappe.db.get_value(
|
invoiced_amt = (
|
||||||
"GL Entry",
|
frappe.db.get_value(
|
||||||
{
|
"GL Entry",
|
||||||
"is_cancelled": 0,
|
{
|
||||||
"party": ["in", parties],
|
"is_cancelled": 0,
|
||||||
"company": inv.company,
|
"party": ["in", parties],
|
||||||
"voucher_no": ["in", vouchers],
|
"company": inv.company,
|
||||||
},
|
"voucher_no": ["in", vouchers],
|
||||||
"sum(debit)",
|
},
|
||||||
|
"sum(debit)",
|
||||||
|
)
|
||||||
|
or 0.0
|
||||||
)
|
)
|
||||||
or 0.0
|
|
||||||
)
|
|
||||||
|
|
||||||
# sum of credit entries made from PE / JV with unset 'against voucher'
|
# sum of credit entries made from PE / JV with unset 'against voucher'
|
||||||
advance_amt = (
|
if advance_amt:
|
||||||
frappe.db.get_value(
|
advance_amt = (
|
||||||
"GL Entry",
|
frappe.db.get_value(
|
||||||
{
|
"GL Entry",
|
||||||
"is_cancelled": 0,
|
{
|
||||||
"party": ["in", parties],
|
"is_cancelled": 0,
|
||||||
"company": inv.company,
|
"party": ["in", parties],
|
||||||
"voucher_no": ["in", adv_vouchers],
|
"company": inv.company,
|
||||||
},
|
"voucher_no": ["in", adv_vouchers],
|
||||||
"sum(credit)",
|
},
|
||||||
|
"sum(credit)",
|
||||||
|
)
|
||||||
|
or 0.0
|
||||||
)
|
)
|
||||||
or 0.0
|
|
||||||
)
|
|
||||||
|
|
||||||
# sum of credit entries made from sales invoice
|
# sum of credit entries made from sales invoice
|
||||||
credit_note_amt = sum(
|
credit_note_amt = sum(
|
||||||
|
|||||||
Reference in New Issue
Block a user