1 /**
2 * 计算个人所得税
3 * www.xcc.cn 版权所有
4 * @param minusAmount 扣除社保的金额
5 * @param minusAmount2 当月工资(扣除社保后)(算年终奖)
6 * @param salaryType 收入类型
7 * @param minimumAmount 个税基数,5000
8 * */
9 public GeshuiDto calc(double originAmount, double minusAmount, double minusAmount2, String salaryType, int minimumAmount) {
10 GeshuiDto dto = new GeshuiDto();
11 dto.originAmount = originAmount;
12 dto.minusAmount = minusAmount;
13 dto.taxAmount = 0;
14 dto.finalAmount = 0;
15
16 if(originAmount == 0){
17 return dto;
18 }
19
20 //工资、薪金所得
21 if(Objects.equal("1", salaryType)){
22 double balanceAmount = BigDecimal.valueOf(originAmount)
23 .subtract(BigDecimal.valueOf(minusAmount))
24 .subtract(BigDecimal.valueOf(minimumAmount)).doubleValue();
25 dto.balanceAmount = balanceAmount;
26 if(minimumAmount == 5000) {
27 if(balanceAmount >0 && balanceAmount <=3000){
28 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.03)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
29 }
30 if(balanceAmount >3000 && balanceAmount <=12000){
31 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(210)).doubleValue();
32 }
33 if(balanceAmount >12000 && balanceAmount <=25000){
34 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(1410)).doubleValue();
35 }
36 if(balanceAmount >25000 && balanceAmount <=35000){
37 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.25)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(2660)).doubleValue();
38 }
39 if(balanceAmount >35000 && balanceAmount <=55000){
40 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(4410)).doubleValue();
41 }
42 if(balanceAmount >55000 && balanceAmount <=80000){
43 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.35)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(7160)).doubleValue();
44 }
45 if(balanceAmount >80000 ){
46 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.45)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(15160)).doubleValue();
47 }
48 }else {
49 if(balanceAmount >0 && balanceAmount <=1500){
50 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.03)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
51 }
52 if(balanceAmount >1500 && balanceAmount <=4500){
53 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(105)).doubleValue();
54 }
55 if(balanceAmount >4500 && balanceAmount <=9000){
56 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(555)).doubleValue();
57 }
58 if(balanceAmount >9000 && balanceAmount <=35000){
59 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.25)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(1005)).doubleValue();
60 }
61 if(balanceAmount >35000 && balanceAmount <=55000){
62 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(2755)).doubleValue();
63 }
64 if(balanceAmount >55000 && balanceAmount <=80000){
65 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.35)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(5505)).doubleValue();
66 }
67 if(balanceAmount >80000 ){
68 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.45)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(13505)).doubleValue();
69 }
70 }
71
72 }else if(Objects.equal("2", salaryType)){ //个体工商户生产、经营所得
73 double balanceAmount = originAmount;
74 dto.balanceAmount = balanceAmount;
75 if(balanceAmount >0 && balanceAmount <= 15000){
76 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.05)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
77 }
78 if(balanceAmount > 15000 && balanceAmount <= 30000){
79 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(750)).doubleValue();
80 }
81 if(balanceAmount > 30000 && balanceAmount <= 60000){
82 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(3750)).doubleValue();
83 }
84 if(balanceAmount > 60000 && balanceAmount <= 100000){
85 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(9750)).doubleValue();
86 }
87 if(balanceAmount > 100000){
88 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.35)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(14750)).doubleValue();
89 }
90 }else if(Objects.equal("3", salaryType)){ //年终奖所得
91 double balanceAmount = 0;
92 if(minusAmount2 - minimumAmount < 0){
93 balanceAmount = BigDecimal.valueOf(originAmount).subtract(BigDecimal.valueOf(3500-minusAmount2)).doubleValue();
94 }else{
95 balanceAmount = originAmount;
96 }
97 dto.balanceAmount = balanceAmount;
98 double avg_balanceAmount = balanceAmount/12;
99 if(minimumAmount == 5000) {
100 if(avg_balanceAmount >0 && avg_balanceAmount<=3000){
101 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.03)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
102 }
103 if(avg_balanceAmount >3000 && avg_balanceAmount<=12000){
104 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(210)).doubleValue();
105 }
106 if(avg_balanceAmount >12000 && avg_balanceAmount<=25000){
107 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(1410)).doubleValue();
108 }
109 if(avg_balanceAmount >25000 && avg_balanceAmount<=35000){
110 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.25)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(2660)).doubleValue();
111 }
112 if(avg_balanceAmount >35000 && avg_balanceAmount<=55000){
113 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(4410)).doubleValue();
114 }
115 if(avg_balanceAmount >55000 && avg_balanceAmount<=80000){
116 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.35)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(7160)).doubleValue();
117 }
118 if(avg_balanceAmount >80000){
119 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.45)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(15160)).doubleValue();
120 }
121 }else {
122 if(avg_balanceAmount >0 && avg_balanceAmount<=1500){
123 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.03)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
124 }
125 if(avg_balanceAmount >1500 && avg_balanceAmount<=4500){
126 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(105)).doubleValue();
127 }
128 if(avg_balanceAmount >4500 && avg_balanceAmount<=9000){
129 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(555)).doubleValue();
130 }
131 if(avg_balanceAmount >9000 && avg_balanceAmount<=35000){
132 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.25)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(1005)).doubleValue();
133 }
134 if(avg_balanceAmount >35000 && avg_balanceAmount<=55000){
135 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(2775)).doubleValue();
136 }
137 if(avg_balanceAmount >55000 && avg_balanceAmount<=80000){
138 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.35)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(5505)).doubleValue();
139 }
140 if(avg_balanceAmount >80000){
141 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.45)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(13505)).doubleValue();
142 }
143 }
144
145 }else if(Objects.equal("4", salaryType)){ //劳务报酬所得
146 dto.balanceAmount = originAmount;
147 if(originAmount>0 && originAmount <= 800){
148 dto.taxAmount =0;
149 }else if(originAmount > 800){
150 double balanceAmount = 0;
151 if(originAmount >800 && originAmount <= 4000){
152 balanceAmount = originAmount-800;
153 }
154 if(originAmount > 4000){
155 balanceAmount = originAmount*0.8;
156 }
157 if(balanceAmount >0 && balanceAmount <= 20000){
158 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
159 }
160 if(balanceAmount >20000 && balanceAmount <= 50000){
161 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(2000)).doubleValue();
162 }
163 if(balanceAmount >50000){
164 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.4)).setScale(2, BigDecimal.ROUND_HALF_UP).subtract(BigDecimal.valueOf(7000)).doubleValue();
165 }
166 }
167 }else if(Objects.equal("5", salaryType)){ //稿酬所得
168 double balanceAmount = 0;
169 if(originAmount >0 && originAmount <= 4000){
170 balanceAmount = originAmount-800;
171 }else if(originAmount > 4000){
172 balanceAmount = originAmount*0.8;
173 }
174 dto.balanceAmount = balanceAmount;
175 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.14)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
176 }else if(Objects.equal("6", salaryType)){ //特许权使用费所得
177 double balanceAmount = 0;
178 if(originAmount >0 && originAmount <= 4000){
179 balanceAmount = originAmount-800;
180 }else if(originAmount > 4000){
181 balanceAmount = originAmount*0.8;
182 }
183 dto.balanceAmount = balanceAmount;
184 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
185 }else if(Objects.equal("7", salaryType)){ //财产租赁所得
186 double balanceAmount = 0;
187 if(originAmount >0 && originAmount <= 4000){
188 balanceAmount = originAmount-800;
189 }else if(originAmount > 4000){
190 balanceAmount = originAmount*0.8;
191 }
192 dto.balanceAmount = balanceAmount;
193 dto.taxAmount = BigDecimal.valueOf(balanceAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
194 }else if(Objects.equal("8", salaryType)){ //财产转让所得
195 dto.balanceAmount = originAmount;
196 dto.taxAmount = BigDecimal.valueOf(originAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
197 }else if(Objects.equal("9", salaryType)){ //利息、股息、红利所得
198 dto.balanceAmount = originAmount;
199 dto.taxAmount = BigDecimal.valueOf(originAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
200 }else if(Objects.equal("10", salaryType)){ //偶然所得
201 dto.balanceAmount = originAmount;
202 dto.taxAmount = BigDecimal.valueOf(originAmount).multiply(BigDecimal.valueOf(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
203 }else{
204 return dto;
205 }
206 if(Objects.equal("1", salaryType)){
207 dto.finalAmount = BigDecimal.valueOf(originAmount)
208 .subtract(BigDecimal.valueOf(minusAmount))
209 .subtract(BigDecimal.valueOf(dto.taxAmount))
210 .setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
211 }else{
212 dto.finalAmount = BigDecimal.valueOf(originAmount)
213 .subtract(BigDecimal.valueOf(dto.taxAmount))
214 .setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
215 }
216 return dto;
217 }