每月個人所得稅、稅后薪資計算器:
def due_tax(due_income): ''' 本函數計算年度應繳個稅 :param due_income:本年累計應納稅所得額 :return:本月應繳個稅金額 ''' if 0<due_income<=36000:return due_income*0.03-0 #本年累計應納稅所得額*稅率-速算扣除數 if 36000<due_income<=144000:return due_income*0.10-2520 if 144000<due_income<=300000:return due_income*0.20-16920 if 300000<due_income<=420000:return due_income*0.25-31920 if 420000<due_income<=660000:return due_income*0.30-52920 if 660000<due_income<=960000:return due_income*0.35-85920 if due_income>960000:return due_income*0.45-181920 def cal_income(monthly_income=15000,house=0.07,pension=0.08,medical=0.02,unemployment=6.6,monthly_deductable=5000): ''' 計算個稅及稅后薪資 :param monthly_income: 每月稅前薪資 :param house: 公積金比例 :param pension: 養老金比例 :param medical: 醫療保險比例 :param unemployment: 每月失業保險金(元) :param monthly_deductable: 每月扣除金額(如房租等) :return: 全年累計應繳個稅、累計三險一金、累計凈收入、每月應繳個稅、每月稅后收入 ''' print('每月稅前工資:{:.2f}'.format(monthly_income)) print('公積金比例:{:.2f}'.format(house)) print('養老保險比例:{:.2f}'.format(pension)) print('醫療保險比例:{:.2f}'.format(medical)) print('失業保險金:{:.2f}'.format(unemployment)) print('每月扣除金額:{:.2f}'.format(monthly_deductable)) months=12 #本年工作月數 sum_insurance=0 #本年累計已繳三險一金 sum_deductable=0 #本年累計扣除 sum_income=0 #本年累計收入 sum_tax=0 #本年累計已繳個稅 sum_pure_income=0 #本年累計凈收入(稅后或到手工資) taxes=[] pure_incomes=[] for i in range(1,months+1): sum_income+=monthly_income sum_deductable+=monthly_deductable #本年度累計應繳稅所得額=年度累計總收入-累計扣除-累計三險一金 due_income=sum_income-sum_deductable-sum_insurance #本月個稅=本年累計應繳個稅-本年累計已繳個稅 tax=due_tax(due_income)-sum_tax taxes.append(tax) #本月三險一金 insurance=monthly_income*(house+pension+medical)+unemployment #本月凈收入=稅前工資-本月三險一金-本月個稅 pure_income=monthly_income-insurance-tax pure_incomes.append(pure_income) #打印本月個稅、凈收入 print('{}月份-本月應繳個稅:{:.2f},稅后收入:{:.2f}'.format(i,tax,pure_income)) #更新累計已繳個稅、已繳三險一金、凈收入 sum_tax+=tax sum_insurance+=insurance sum_pure_income+=pure_income plus_house=sum_pure_income+monthly_income*house*months print('全年累計應繳個稅:{:.2f},全年應繳三險一金:{:.2f},全年凈收入:{:.2f},凈收入+公積金:{:.2f}'.format(sum_tax,sum_insurance,sum_pure_income,plus_house)) return sum_tax,sum_insurance,sum_pure_income,taxes,pure_incomes if __name__=='__main__': cal_income()
用以上默認的薪資等參數,函數的輸出為:
每月稅前工資:15000.00 公積金比例:0.07 養老保險比例:0.08 醫療保險比例:0.02 失業保險金:6.60 每月扣除金額:5000.00 1月份-本月應繳個稅:300.00,稅后收入:12143.40 2月份-本月應繳個稅:223.30,稅后收入:12220.10 3月份-本月應繳個稅:223.30,稅后收入:12220.10 4月份-本月應繳個稅:223.30,稅后收入:12220.10 5月份-本月應繳個稅:487.45,稅后收入:11955.95 6月份-本月應繳個稅:744.34,稅后收入:11699.06 7月份-本月應繳個稅:744.34,稅后收入:11699.06 8月份-本月應繳個稅:744.34,稅后收入:11699.06 9月份-本月應繳個稅:744.34,稅后收入:11699.06 10月份-本月應繳個稅:744.34,稅后收入:11699.06 11月份-本月應繳個稅:744.34,稅后收入:11699.06 12月份-本月應繳個稅:744.34,稅后收入:11699.06 全年累計應繳個稅:6667.74,全年應繳三險一金:30679.20,全年凈收入:142653.06,凈收入+公積金:155253.06
將月收入設為3萬元,則:
每月稅前工資:30000.00 公積金比例:0.07 養老保險比例:0.08 醫療保險比例:0.02 失業保險金:6.60 每月扣除金額:5000.00 1月份-本月應繳個稅:750.00,稅后收入:24143.40 2月份-本月應繳個稅:1219.34,稅后收入:23674.06 3月份-本月應繳個稅:1989.34,稅后收入:22904.06 4月份-本月應繳個稅:1989.34,稅后收入:22904.06 5月份-本月應繳個稅:1989.34,稅后收入:22904.06 6月份-本月應繳個稅:1989.34,稅后收入:22904.06 7月份-本月應繳個稅:2025.38,稅后收入:22868.02 8月份-本月應繳個稅:3978.68,稅后收入:20914.72 9月份-本月應繳個稅:3978.68,稅后收入:20914.72 10月份-本月應繳個稅:3978.68,稅后收入:20914.72 11月份-本月應繳個稅:3978.68,稅后收入:20914.72 12月份-本月應繳個稅:3978.68,稅后收入:20914.72 全年累計應繳個稅:31845.48,全年應繳三險一金:61279.20,全年凈收入:266875.32,凈收入+公積金:292075.32