# [Python] 年终奖税后计算器

def taxRate(bonus,thirteen_month_salary):

total = bonus + thirteen_month_salary
base = total/12

if base < 0:
bonus_tax = 0
if base <= 1500:
bonus_tax = total * 0.03
elif base > 1500 and base <= 4500:
bonus_tax = total * 0.1 - 105
elif base > 4500 and base <= 9000:
bonus_tax = total * 0.2 - 555
elif base > 9000 and base <= 35000:
bonus_tax = total * 0.25 - 1005
elif base > 35000 and base <= 55000:
bonus_tax = total * 0.3 - 2755
elif base > 55000 and base <= 80000:
bonus_tax = total * 0.35 - 5505
elif base > 80000:
bonus_tax = total * 0.45 - 13505

print('Bonus tax payable is : %d' % bonus_tax)

return bonus_tax

def BonusAfterTax(bonus, thirteen_month_salary):
# 纳税额
tax = taxRate(bonus,thirteen_month_salary)

# 税后bonus
bonus_after_tax = bonus + thirteen_month_salary - tax

print('Bonus after tax is : %d' % bonus_after_tax)
print('bonus_after_tax percentage is : %.2f %%' % float(bonus_after_tax * 100 / (bonus + thirteen_month_salary)))

return bonus_after_tax

if __name__ == '__main__':
BonusAfterTax(bonus_before_tax, thirteen_month_salary)

代码如下

def bonusTaxRate(bonus,thirteen_month_salary):

total = bonus + thirteen_month_salary
base = total/12

if base < 0:
bonus_tax = 0
if base <= 1500:
bonus_tax = total * 0.03
elif base > 1500 and base <= 4500:
bonus_tax = total * 0.1 - 105
elif base > 4500 and base <= 9000:
bonus_tax = total * 0.2 - 555
elif base > 9000 and base <= 35000:
bonus_tax = total * 0.25 - 1005
elif base > 35000 and base <= 55000:
bonus_tax = total * 0.3 - 2755
elif base > 55000 and base <= 80000:
bonus_tax = total * 0.35 - 5505
elif base > 80000:
bonus_tax = total * 0.45 - 13505

print('Bonus tax payable is : %d' % bonus_tax)

return bonus_tax

def bonusAfterTax(bonus, thirteen_month_salary):
# 纳税额
tax = bonusTaxRate(bonus,thirteen_month_salary)

# 税后bonus
bonus_after_tax = bonus + thirteen_month_salary - tax

print('Bonus after tax is : %d' % bonus_after_tax)
print('bonus_after_tax percentage is : %.2f %%' % float(bonus_after_tax * 100 / (bonus + thirteen_month_salary)))
print('                 ')

return bonus_after_tax

def newBonusTaxRate(bonus, thirteen_month_salary):

total = bonus + thirteen_month_salary
base = total / 12
#速扣数相应增大12倍
if base < 0:
bonus_tax = 0
if base <= 1500:
bonus_tax = total * 0.03
elif base > 1500 and base <= 4500:
bonus_tax = total * 0.1 - 105 * 12
elif base > 4500 and base <= 9000:
bonus_tax = total * 0.2 - 555 * 12
elif base > 9000 and base <= 35000:
bonus_tax = total * 0.25 - 1005 * 12
elif base > 35000 and base <= 55000:
bonus_tax = total * 0.3 - 2755 * 12
elif base > 55000 and base <= 80000:
bonus_tax = total * 0.35 - 5505 * 12
elif base > 80000:
bonus_tax = total * 0.45 - 13505 * 12

print('New bonus tax payable is : %d' % bonus_tax)

return bonus_tax

def newBonusAfterTax(bonus, thirteen_month_salary):
total = bonus + thirteen_month_salary

# 纳税额
new_bonus_tax = newBonusTaxRate(bonus,thirteen_month_salary)

# 税后bonus
bonus_after_tax = total - new_bonus_tax

print('New Bonus after tax is : %d' % bonus_after_tax)
print('New bonus_after_tax percentage is : %.2f %%' % float(bonus_after_tax * 100 / total))
print('                ')

return bonus_after_tax

if __name__ == '__main__':
bonusAfterTax(bonus_before_tax, thirteen_month_salary)
newBonusAfterTax(bonus_before_tax, thirteen_month_salary)

• 0
点赞
• 0
收藏
觉得还不错? 一键收藏
• 0
评论
12-13
02-03 72
08-02 619
09-21
08-09
04-02
12-27
07-08 1063
04-17 3410
09-29 456

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。