Skip to content

Commit

Permalink
fix: Use normal rounding for Tax Withholding Category (frappe#34114)
Browse files Browse the repository at this point in the history
fix: Use normal rounding for Tax Withholding Category (frappe#34114)

(cherry picked from commit 35cdd99)

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
mergify[bot] and deepeshgarg007 authored Feb 21, 2023
1 parent 7bed6cd commit 26ed460
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,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 @@ -555,3 +555,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 26ed460

Please sign in to comment.