Skip to content

Commit

Permalink
fix: Use normal rounding for Tax Withholding Category (#34114)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 authored Feb 21, 2023
1 parent 18541ef commit 35cdd99
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N
tax_amount = get_tcs_amount(parties, inv, tax_details, vouchers, advance_vouchers)

if cint(tax_details.round_off_tax_amount):
tax_amount = round(tax_amount)
tax_amount = normal_round(tax_amount)

return tax_amount, tax_deducted, tax_deducted_on_advances, voucher_wise_amount

Expand Down Expand Up @@ -603,3 +603,20 @@ def is_valid_certificate(
valid = True

return valid


def normal_round(number):
"""
Rounds a number to the nearest integer.
:param number: The number to round.
"""
decimal_part = number - int(number)

if decimal_part >= 0.5:
decimal_part = 1
else:
decimal_part = 0

number = int(number) + decimal_part

return number

0 comments on commit 35cdd99

Please sign in to comment.