累积计税法:算一算您一年缴了多少个税
生活随笔
收集整理的這篇文章主要介紹了
累积计税法:算一算您一年缴了多少个税
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前提:
上海、2021年的社保上限基數:31014, 個人繳費比例為10.5%(其中,社保8%,醫療生育2%, 失業0.5%)。 不考慮是每年中旬才調整的這個基數,我們就當全年都按照這個基數,來計算一下你的個人所得稅,也不考慮年終獎金、股票等。
首先奉上結果:
Python代碼如下所示:
import sys import os import shutil import time import random import subprocess import getopt import json import xlrd import xlwtdef get_config():with open('table.cfg', 'r') as f:return json.load(f)config = get_config() percent = config["social_insurance"]["shanghai"]["2021"]["percent"] base_limit = config["social_insurance"]["shanghai"]["2021"]["base_limit"] tax_stages = config["tax_stage"] tax_rates = config["tax_rate"] reductions = config["reduction"]def create_sheet(f,table_name,try_count):if try_count <= 1:returntry:sheet1 = f.add_sheet(table_name + '-' + str(11 - try_count),cell_overwrite_ok=True)return sheet1except Exception as e:return create_sheet(f,table_name,try_count-1)def create_a_new_excel(excel_path,table_name,title_name,use_lists):table1_invalid_start_x = 1;table1_invalid_start_y = 2;max_buf_len = []if os.path.exists(excel_path):os.remove(excel_path)f = xlwt.Workbook(encoding='utf-8') #新建excelfont = xlwt.Font()font.bold = Trueborders = xlwt.Borders()borders.left = xlwt.Borders.THINborders.right = xlwt.Borders.THINborders.top = xlwt.Borders.THINborders.bottom = xlwt.Borders.THINalignment = xlwt.Alignment()alignment.horz = xlwt.Alignment.HORZ_CENTER #水平方向alignment.vert = xlwt.Alignment.VERT_TOPstyle1 = xlwt.XFStyle()style1.font = font#style1.borders = bordersstyle1.alignment = alignmentstyle2 = xlwt.XFStyle()style2.alignment.wrap = 1 #自動換行try:sheet1 = f.add_sheet(table_name,cell_overwrite_ok=True)except Exception as e:sheet1 = create_sheet(f,table_name,10)for item in range(0, len(title_name)):sheet1.write(1, item+table1_invalid_start_x, title_name[item],style=style1)max_buf_len.append(len(title_name[item]))sheet1.col(1).width = 256 * (max_buf_len[item])item = 0column_len = len(title_name)for use_list in use_lists:for column_index in range(0, column_len):if len(use_list[title_name[column_index]]) > max_buf_len[column_index]:max_buf_len[column_index] = len(use_list[title_name[column_index]])if max_buf_len[column_index] > 150:max_buf_len[column_index] = 150sheet1.col(column_index+table1_invalid_start_x).width = 256 * (max_buf_len[column_index] + 3)sheet1.write(table1_invalid_start_y + item, column_index+table1_invalid_start_x, use_list[title_name[column_index]],style2)item += 1f.save(excel_path)test_title = ["年薪","社保公積金共計繳納","共計交稅","稅后總收入" ] user = {}test_use_list = []def calculate_tax(salary): #salary yearif salary / 12 > base_limit:base = base_limitelse:base = salary / 12insurance= base * 12 * percent / 100print("年薪:%s" % str(salary))print("社保公積金共計繳納:%s" % str(insurance))taxable_income = salary - insurance - 5000 * 12if taxable_income < 0:taxable_income = 0#print("需要納稅總額度:%s" % str(taxable_income))i = 0for tax_stage in tax_stages:if taxable_income < tax_stage:breaki = i + 1tax = taxable_income * tax_rates[i] / 100 - reductions[i]print("共計繳納稅:%s" % str(tax))after_tax = salary - tax - insuranceprint("稅后總收入:%s" % str(after_tax))print("%s\t%s\t%s\t%s" %(str(salary), str(insurance), str(tax), str(after_tax)))user["年薪"] = str(salary)user["社保公積金共計繳納"] = str(insurance)user["共計交稅"] = str(tax)user["稅后總收入"] = str(after_tax)test_use_list.append(user.copy())if __name__ == '__main__':print(str(sys.argv[0]) + " enter")curdir = os.getcwd()for i in range(6,101): # 6-100wsalary = i * 10000calculate_tax(salary)for i in range(1,51): # 110w - 500wsalary = i*100000 + 1000000calculate_tax(salary)print(test_use_list)s_name = "1.xls"create_a_new_excel(s_name,"table1",test_title, test_use_list)配置表:
{"social_insurance":{"shanghai":{"2021":{"percent":10.5,"base_limit":31014}}},"tax_stage":[36000,144000,300000,420000,660000,960000],"tax_rate":[3,10,20,25,30,35,45],"reduction":[0,2520,16920,31920,52920,85920,181920] }(backup)
2021 交金基數和比例
2021個人所得稅新稅率表
前提:2021年,上海的社保公積金上限是31014,假設你的年薪都按照工資計稅,不按年終獎計稅。
1、如果您2021年是100W的薪資,那么今年社保公積金繳納了接近4W,你的個稅繳納了25W。,一年到手71w
2、如果您2021年是80W的薪資,那么今年社保公積金繳納了接近4W,你的個稅繳納了17.5W,一年到手58.5w
3、如果您2021年是60W的薪資,那么今年社保公積金繳納了接近4W,你的個稅繳納了11.5W,一年到手43.5w
4、如果您2021年是40W的薪資,那么今年社保公積金繳納了接近4W,你的個稅繳納了5.8W,一年到手30.2w
總結
以上是生活随笔為你收集整理的累积计税法:算一算您一年缴了多少个税的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: armv8-M(cortex-m) Tr
- 下一篇: 思考:通过MMU/TLB/Cache对安