本文涉及工资奖金所得税。
工资薪金所得_概念
工资、薪金所得,是指个人因任职或受雇而取得的工资、薪金、奖金、年终加薪、劳动分红、津贴、补贴以及与任职或受雇有关的其他所得。
工资个税预扣预缴计算公式
本期预扣预缴税额 =(累计预扣预缴应纳税所得额 * 预扣率 - 速算扣除数)- 累计已缴纳税额
累计预扣预缴应纳税所得额 = 累计收入 - 累计五险一金 - 累计专项附加扣除 - 累计减除费用
累计专项附加扣除:赡养老人,子女教育,继续教育,租房租金,大病医疗等人群在征税中所享有的专项扣除。
速算扣除数: 累计预扣预缴应纳税所得额 * 预扣率 - 速算扣除数 = 实际预扣预缴税额
(例如:假设累计预扣预缴应纳税所得额为40000,超过第一级别36000。我们的习惯思维是将36000*3% = 1080,再加上4000*10% = 400,实际预扣预缴税额为1480。这样算没什么毛病,但代码实现中会让程序变得很复杂,你需要先计算应纳税所得额是在哪个区间,然后才能进行计算。于是我们提出速算扣除数的概念,同样是累计预扣预缴应纳税所得额为40000,我们可以用40000*10%=4000,再减去2520(36000*7%)得到1480。)
累计减除费用:月数 x 5000(起征点是5000元)
累计已缴纳税额:前几个月已缴纳的预扣预缴税总额
政策
2021年最新个人所得税税率表
级数 | 累计预扣预缴应纳税所得额 | 预扣税率 | 速算扣除数 |
---|---|---|---|
1 | 不超过36000元的部分 | 3% | 0 |
2 | 超过36000元至144000元的部分 | 10% | 2520 |
3 | 超过144000元至300000元的部分 | 20% | 16920 |
4 | 超过300000元至420000元的部分 | 25% | 31920 |
5 | 超过420000元至660000元的部分 | 30% | 52920 |
6 | 超过660000元至960000元的部分 | 35% | 85920 |
7 | 超过960000元的部分 | 45% | 181920 |
案例
小李是北京一家上市公司的产品经理,月薪3万元,有一个3岁的小孩正在上幼儿园,可以扣除子女教育的2000元专项扣除,并且有住房贷款要还,还可以扣除1000元贷款利息,所以他每月的专项扣除费用为3000元。五险一金扣除比例22%,个人部分每月可扣除6600元,请问小李每月需要缴纳多少个税?
解析如下:
1月份:(30000-30000*22%-5000-3000)*3%=462
( 30000-30000*22%-5000-3000 = 15400 < 36000,因此采用第一级别)
2月份:(30000*2-30000*22%*2-5000*2-3000*2)*3%-462=462
(30000*2-30000*22%*2-5000*2-3000*2 = 30800 < 36000,因此采用第一级别)
3月份:(30000*3-30000*22%*3-5000*3-3000*3)*10%-2520-462-462=1176
(30000*3-30000*22%*3-5000*3-3000*3 = 46200 > 36000,因此采用第二级别)
采用这样的累计预扣预缴的缴税政策,每个月预扣预缴税额不同。
代码
def calculate_tax(monthly_income, months_paid, fund_deduction, special_deduction):
"""
计算累计预缴个人所得税
"""
# 定义税率表和速算扣除数
tax_brackets = [
(36000, 0.03, 0),
(144000, 0.10, 2520),
(300000, 0.20, 16920),
(420000, 0.25, 31920),
(660000, 0.30, 52920),
(960000, 0.35, 85920),
(float('inf'), 0.45, 181920)
]
# 累计收入和累计税款
cumulative_income = 0
cumulative_tax = 0
# 每月的税额记录
monthly_taxes = [0.0] * 12
# 计算已缴月份的累计税款
for month in range(months_paid):
# 每月应纳税所得额
monthly_taxable_income = monthly_income - fund_deduction - special_deduction - 5000 # 5000元起征点
if monthly_taxable_income < 0:
monthly_taxable_income = 0
cumulative_income += monthly_taxable_income
# 累计所得税计算
for bracket in tax_brackets:
if cumulative_income > bracket[0]:
continue
else:
# 找到对应的税率和速算扣除数
rate = bracket[1]
deduction = bracket[2]
# 计算累计税款
cumulative_tax = cumulative_income * rate - deduction
break
monthly_taxes[month] = cumulative_tax
# 计算当月应缴税款
monthly_taxable_income = monthly_income - fund_deduction - special_deduction - 5000 # 5000元起征点
if monthly_taxable_income < 0:
monthly_taxable_income = 0
cumulative_income += monthly_taxable_income
# 累计所得税计算
for bracket in tax_brackets:
if cumulative_income > bracket[0]:
continue
else:
# 找到对应的税率和速算扣除数
rate = bracket[1]
deduction = bracket[2]
# 计算累计税款
cumulative_tax = cumulative_income * rate - deduction
break
if months_paid == 0:
tax_for_this_month = cumulative_tax
else:
tax_for_this_month = cumulative_tax - monthly_taxes[months_paid - 1]
return tax_for_this_month
while True:
try:
# 输入已经缴税的月份数量,并限制在0-12之间
months_paid_count = int(input("已经缴税的月份数量 (0-12): "))
if months_paid_count < 0 or months_paid_count > 12:
print("月份数量必须在0到12之间,请重新输入。")
continue
# 输入每月的工资,如果未输入则默认值为0
monthly_income_input = input("每月工资: ")
monthly_income = float(monthly_income_input) if monthly_income_input else 0
# 输入五险一金,如果未输入则默认值为0
fund_deduction_input = input("五险一金: ")
fund_deduction = float(fund_deduction_input) if fund_deduction_input else 0
# 输入专项扣除,如果未输入则默认值为0
special_deduction_input = input("专项扣除: ")
special_deduction = float(special_deduction_input) if special_deduction_input else 0
# 计算当月应缴税款
tax = calculate_tax(monthly_income, months_paid_count, fund_deduction, special_deduction)
# 输出当月的应缴税款
print(f"当月应缴税款: {tax:.2f}元")
# 询问用户是否重新输入
repeat = input("是否重新计算?(y/n): ").strip().lower()
if repeat != 'y':
break
except ValueError:
print("输入错误,请输入正确的数字。")
重新完善了,1.限制了输入月份在0-12
2.用户未输入的情况下默认为0.
3.循环输入。