不知不觉间帝都已经没有了酷暑的燥热,前几天还下了几场雨,当秋雨冲刷着仲夏的尸体,不得不承认这一伤感的季节又要来了。可谓是一场秋雨一场寒,早晚出行时都能感觉到一丝凉意了。黄昏之时迎着微风走向地铁站(不加班?嗯?),看着摇摇欲坠的树叶以及远处蔚蓝的天空,几朵白云还在互相追赶,闭上眼睛深吸一口气,再缓缓吐出,不得不感叹天凉好个秋,颇为舒适。
好啦好啦,醒醒吧,2019都过去三分之二了,快看看今年的搬砖的受益如何吧!
以下是按照新个税政策计算薪资的java代码,FYI (For Your Information)供你们参考!比实际多不要高兴,比实际少可以偷乐!
package com.sinosoft.aikes;
/**
* 按照2019新个税规则,计算薪资
*
* @author Aikes
*
* Created on 2019-08-27
*/
public class TaxCalculate {
private double mUnitMoney;
private double mSumMoney;
private double mSocialFee;
private int mTimes;
private int mStartTimes = 1;
private double mTax;
/**
* 该方法默认一月到当前月薪资相同进行计算,且未考虑附加扣
* 除项(继续教育、赡养老人等六项附加扣除条款)
*
* @param cMoney 税前月薪
* @param cSocialFee 社保+公积金
* @param cTimes 薪资计算月(若每6.15发工资,此处填 5 )
*/
public void computeSalary(double cMoney, double cSocialFee, int cTimes) {
this.mTimes = cTimes;
this.mUnitMoney = cMoney;
this.mSocialFee = cSocialFee;
computeAllTax();
// 最后一个月税额需要单独拉出来计算,用于计算当月实际工资
double tTax = mTimes * (mUnitMoney - 5000 - cSocialFee);
tTax = computeTax(tTax);
System.out.println("第" + mStartTimes + "个月税额:" + tTax);
System.out.println("***********************************");
System.out.println("* 本年度累计纳税:" + mTax);
System.out.println("* 本年度累计收入:" + mSumMoney);
System.out.println("* 本月应缴税额:" + tTax);
System.out.println("* 本月实收薪资:" + (cMoney - tTax - cSocialFee));
System.out.println("***********************************");
}
/**
* 计算年度累计纳税金额
*
* @return
*/
private double computeAllTax() {
if (mStartTimes == mTimes)
return mTax;
double tTax = mStartTimes * (mUnitMoney - 5000 - mSocialFee);
tTax = computeTax(tTax);
System.out.println("第" + mStartTimes + "个月税额:" + tTax);
mStartTimes++;
return computeAllTax();
}
/**
* 计算单次税额
*
* @param tTax
* @return
*/
private double computeTax(double cTax) {
if (cTax <= 36000) {
cTax = (cTax * 0.03) - mTax;
} else if (cTax > 36000 && cTax <= 144000) {
cTax = (cTax * 0.10 - 2520) - mTax;
} else if (cTax > 144000 && cTax <= 300000) {
cTax = (cTax * 0.20 - 16920) - mTax;
} else if (cTax > 300000 && cTax <= 420000) {
cTax = (cTax * 0.25 - 31920) - mTax;
} else if (cTax > 420000 && cTax <= 660000) {
cTax = (cTax * 0.30 - 52920) - mTax;
} else if (cTax > 660000 && cTax <= 960000) {
cTax = (cTax * 0.35 - 85920) - mTax;
} else {
cTax = (cTax * 0.45 - 181920) - mTax;
}
mTax += cTax;
mSumMoney += (mUnitMoney - cTax);
return cTax;
}
public static void main(String[] args) {
new TaxCalculate().computeSalary(35000, 3000, 7);
}
}