Thank you

B station is really a learning place. After watching the teacher’s video, I finally figured out how to calculate individual income tax. On the link, friends who do not know the same thing as me can learn to save the fear of accounting mistakes for you.

Reference: www.bilibili.com/video/BV1v5…

Annual bonus income tax calculation

Def NZJGS (n): """ :type n: float total year-end bonus :rtype: float tax paid "" TMP = n/12 if TMP <= 3000: Return n * 0.03 if 3000 < TMP <= 12000: return n * 0.1-210 if 12000 < TMP <= 25000: Return n * 0.2-1410 if 25000 <= 35000: return n * 0.25-2660 if 35000 < TMP <= 55000: Return n * 0.3-4410 if 55000 < TMP <= 80000: return n * 0.35-7160 return n * 0.45-15160Copy the code

If MY year-end bonus is 40,000 yuan (only if), then 3790.0 will be the tax paid after calling the function.

3790.0 print (NZJGS (40000))Copy the code

Monthly individual income tax calculation

Def yxgs(n, s, shebao, zhuanxiangfujiakouchu, zhuanxiangfujiakouchu): "" : float month: float month: float s: float month: float month: float month: float month: float Float monthly social security payment :type Qitakouchu: float monthly other deduction :type ZhuanxiangFujiakouchu: float monthly special additional deduction: RTYPE: zhuanxiangFujiakouchu: FLOAT "" koushui = [] for I in range(1, n+1): total_s = s * i total_shebao = shebao * i total_zhuanxiangkouchu = qitakouchu * i total_5000 = 5000 * i total_zhuanxiangfujiakouchu = zhuanxiangfujiakouchu * i total_suodee = total_s - total_shebao - total_zhuanxiangkouchu -  total_5000 - total_zhuanxiangfujiakouchu if total_suodee <= 36000: Append (total_suodee * 0.03 -sum (koushui)) if 36000 < total_suodee <= 14000: Append (total_suodee * 0.1-2520-sum (koushui)) if 144000<total_suodee<=300000: Append (total_suodee * 0.2-16920-sum (koushui)) if 300000<total_suodee<=420000: Append (total_suodee * 0.25-31920-sum (koushui)) if 420000<total_suodee<=660000: Append (total_suodee * 0.3-52920-sum (koushui)) if 660000<total_suodee<=960000: Append (total_suodee * 0.35-85920-sum (koushui)) if 960000<total_suodee: Append (total_suodee * 0.45-181920-sum (koushui)) return Koushui, koushui[-1], sum(koushui)Copy the code

If MY monthly salary is 20000, and I pay social security 2025 every month, special additional deduction is 0, and other deductions are 300, then my tax payable in the 12th month will be 2077.5:

Print (yxgs(12, 20000, 2025, 300, 0)) ([380.25, 380.25, 522.0, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 1267.5, 2077.5, 2077.5, 13500.0)Copy the code

The sum of the

If the above two parts are my annual income, after calculating the above two parts separately, the total amount of tax paid this year will be 17,290.0. In the 12th month, since I got salary and year-end bonus at the same time, the tax paid will be 5,867.5.

New annual bonus individual income tax calculation in 2022

If I still have a monthly salary of 20,000 yuan and other deductible expenses remain unchanged, then the first 11 months will be the same as before. However, since 2022, both salary and year-end bonus will be combined to calculate individual income tax, so the tax paid in the 12th month must include the usual monthly salary and year-end bonus. This function must apply to the previous one.

Def XBNZJGS (NZJ, n, shebao, zhuanxiangfujiakouchu, zhuanxiangfujiakouchu): "" : float Float monthly salary :type shebao: float monthly social security payment :type qitakouchu: float other deductible fees :type ZhuanxiangFujiakouchu: float Float Monthly special additional deduction: RTYPE: P = yxgs(11, n, shebao, qitakouchu, zhuanxiangfujiakouchu) total_suodee = nzj + n * 12 - (shebao + qitakouchu + zhuanxiangfujiakouchu + 5000) * 12 if Total_suodee <= 144000: return total_suodee * 0.03 -p [2] if total_suodee <= 144000: Return total_suodee * 0.1-2520 -p [2] if 144000<total_suodee<=300000: Return total_suodee * 0.2-16920 -p [2] if 300000<total_suodee<=420000: Return total_suodee * 0.25-31920 -p [2] if 420000<total_suodee<=660000: Return total_suodee * 0.3-52920 -p [2] if 660000<total_suodee<=960000: Return total_suodee * 0.35-85920 -p [2] if 960000<total_suodee: return total_suodee * 0.45-181920 -p [2]Copy the code

If MY usual monthly salary is 20,000 yuan, if I get 40,000 yuan in year-end bonus and other things remain unchanged, then the tax payable in the 12th month will be 10077.5:

Print (XBNZJGS (40000, 20000, 2025, 300, 0)) 10077.5Copy the code

This is 4,210 more than the total tax paid in the previous 12 months, which is really a huge tax deduction, what can I say, probably because I think the middle class of society has grown and needs to cut a wave.

The tail down

  • Writing these functions is just for fun. Please forgive me for the rough implementation of the above functions.
  • The first two functions are correct. The final calculation method of 2022 year-end bonus is the algorithm I deduced by myself. It may not be correct.