看看你的年终奖发的是否合理:


def getTaxRatio(taxSalary):

ratiolist =(
(500, 0.05, 0),
(2000, 0.10, 25),
(5000, 0.15, 125),
(20000, 0.20, 375),
(40000, 0.25, 1375),
(60000, 0.30, 3375),
(80000, 0.35, 6375),
(100000, 0.40, 10375),
(9999999,0.45, 15375)
)

if taxSalary>= 0:
for ratio in ratiolist:
if taxSalary<= ratio[0]:
return (ratio[1], ratio[2])
return (0, 0)

def calcYearAwardTax(yearAward):

monthAward = yearAward / 12
taxRatio, taxAdjust = getTaxRatio(monthAward)

tax = yearAward * taxRatio - taxAdjust
resultAward = yearAward - tax
retcode = (yearAward, resultAward, tax, taxRatio, taxAdjust)
#print('yearAward= %d, resultAward= %f, tax= %f, taxRatio= %f, taxAdjust= %d'%retcode)
return retcode


################################################################################

import sys
import os

argNum = len(sys.argv)
if argNum == 1:
scriptName = os.path.basename(__file__)
print('usage1: %s awardUpperBound'%scriptName)
print('usage2: %s awardLowerBound awardUpperBound'%scriptName)
sys.exit()


print('-----------------------------------------------------------------------')

awardLowerBound, awardUpperBound = 0, 0
if argNum == 2:
awardUpperBound = int(sys.argv[1])
elif argNum == 3:
awardLowerBound, awardUpperBound = int(sys.argv[1]), int(sys.argv[2])

if awardLowerBound> awardUpperBound:
swap(awardLowerBound, awardUpperBound)
perfectAward, perfectGain = 0, 0

for award in range(awardLowerBound, awardUpperBound + 1):
retcode = calcYearAwardTax(award)
if len(retcode) > 2:
if retcode[1]> perfectGain:
perfectAward = retcode[0]
perfectGain = retcode[1]
if award== awardUpperBound:
print('upperBoundAward= %d,\tgain= %f,\ttax= %f'%(retcode[0], retcode[1], retcode[0] - retcode[1]))

print("perfectAward= %d,\tgain= %f,\ttax= %f"%(perfectAward, perfectGain, perfectAward - perfectGain))



保存成文件 awardTax.py 然后在命令行调用即可。
比如你年终奖发了25000,则:

ok, 那么你亏了,你比拿24000的同志多交税3625-2375= 1250元,最终收益还比他少21625-21375= 250元。
这个数值段最佳的年终奖数额为24000,因此还是向老板申请少给你发点年终奖吧。