public String wagesCalculate(double key) {
// 小数保留两位
DecimalFormat df = new DecimalFormat("######0.00");
// 养老 22% 8%
double endowment_company = key * 0.22;
double endowment_personal = key * 0.08;
// 医疗 6% 1%
double medical_company = key * 0.06;
double medical_personal = key * 0.01;
// 工伤 0.5%
double injury_company = key * 0.005;
// 住房公积金 7% 7%
double fund_company = key * 0.07;
double fund_personal = key * 0.07;
String fundCompany = df.format(fund_company);
String fundPersonal = df.format(fund_personal);
// 社保后工资
double wages = key - endowment_personal - medical_personal
- fund_personal;
// 纳税工资,3500起征点
double taxes_wages = wages - 3500;
double taxes = 0;
// 超额累进税率计算个人所得税
if (taxes_wages <= 1500) {
taxes = taxes_wages * 0.03;
} else if (taxes_wages > 1500 && taxes_wages <= 4500) {
taxes = taxes_wages * 0.1 - 105;
} else if (taxes_wages > 4500 && taxes_wages <= 9000) {
taxes = taxes_wages * 0.2 - 555;
} else if (taxes_wages > 9000 && taxes_wages <= 35000) {
taxes = taxes_wages * 0.25 - 1005;
} else if (taxes_wages > 35000 && taxes_wages <= 55000) {
taxes = taxes_wages * 0.3 - 2775;
} else if (taxes_wages > 55000 && taxes_wages <= 80000) {
taxes = taxes_wages * 0.35 - 5505;
} else if (taxes_wages > 80000) {
taxes = taxes_wages * 0.45 - 13505;
}
// 实际工资
double actual_wages = wages - taxes;
String returnStr = " 公司 个人"
+ System.getProperty("line.separator") + "养老: "
+ endowment_company + " " + endowment_personal
+ System.getProperty("line.separator") + "医疗: "
+ medical_company + " " + medical_personal
+ System.getProperty("line.separator") + "工伤: "
+ injury_company + System.getProperty("line.separator")
+ "公积金:" + fundCompany + " " + fundPersonal
+ System.getProperty("line.separator") + "个人所得税:" + taxes
+ System.getProperty("line.separator")
+ "----------------------------------------------"
+ System.getProperty("line.separator") +"税前月薪:"+key+" 税后月薪: "
+ actual_wages;
return returnStr;
}