2019年新税法+抵扣项的个人所得税攻击计算器

由于新税法是累进抵扣,所以每月需要缴税的金额也是不一样的,写了个python程序算一下自己每年要交多少个税

# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
def get_rate(m):
    if m <= 36000:
        return 0.03
    if m <= 144000:
        return 0.1
    if m <= 300000:
        return 0.2
    if m <= 420000:
        return 0.25
    if m <= 660000:
        return 0.3
    if m <= 960000:
        return 0.35
    return 0.45


def get_susuan(m):
    if m <= 36000:
        return 0
    if m <= 144000:
        return 2520
    if m <= 300000:
        return 16920
    if m <= 420000:
        return 31920
    if m <= 660000:
        return 52920
    if m <= 960000:
        return 85920
    return 181920


def shebao(m):
    if m > 25401:
        return 25401
    return m


def cal(m, dikou, jishu = None):
    if jishu is None:
        jishu = shebao(m)
    cc = []
    for x in xrange(12):
        before = (x + 1) * (m - jishu * (0.02 + 0.12 + 0.08 + 0.002) - 5000 - dikou)
        print (m-jishu*(0.02+0.12+0.08+0.002)), before
        cc.append(before * get_rate(before) - get_susuan(before) - sum(cc))
        print "第{}个月应缴个税:".format(str(x + 1)) + str(cc[x]) + " \t税后工资:" + str(
            m - jishu * (0.02 + 0.12 + 0.08 + 0.002) - cc[x])

    # print cc
    print "全年总计扣除个税:" + str(sum(cc))
    plt.figure(figsize=(18,10))
    plt.plot(range(1, 13), cc)
    plt.ylabel(u'personal tax')
    my_x_ticks = np.arange(1, 13, 1)

    plt.xticks(my_x_ticks)
    plt.show()


cal(25000, 1500)

你可能感兴趣的:(玩具)