123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- // const low = [
- // [380.34, 105],
- // [199.3, 110],
- // [379.33, 120.4],
- // [449.3, 115]
- // ]
- // const position = [
- // [18213, 22275, 24654],
- // [22440, 25044],
- // [21258, 25401],
- // [21396]
- // ]
- // const value = [
- // [ (m, p) => { return [m * 0.102, m * p] },
- // (m, p) => { return [1457 + m * 0.022, m * p] },
- // (m, p) => { return [1947.05, m * p] },
- // (m, p) => { return [1947.05, 24654 * p] } ],
- // [ (m, p) => { return [m * 0.08, m * p] },
- // (m, p) => { return [1822.9, m * p] },
- // (m, p) => { return [1822.9, 25044 * p] }],
- // [ (m, p) => { return [m * 0.102, m * p] },
- // (m, p) => { return [m * 0.102, 21258 * p] },
- // (m, p) => { return [2590.9, 21258 * p] } ],
- // [ (m, p) => { return [m * 0.105, m * p] },
- // (m, p) => { return [2246.58, 21396 * p] } ]
- // ]
- function calculate(m, s, a, p, d, md) {
- // var A = 0
- // var B = 0
- // if (s < 2 || a < 2) {
- // var l = low[c]//最低标准
- // var v = value[c]
- // var po = []//工资标准
- // var P = position[c]
- // for (var i = 0; i < P.length; i++) {
- // if (m <= P[i]) {
- // po = v[i](m, 0.05 + p * 0.01)
- // break
- // }
- // }
- // if (po.length == 0) {
- // po = v[P.length](m, 0.05 + p * 0.01)
- // }
-
- // if (s < 2) {
- // var A = s == 0 ? l[0] : po[0]//社保缴纳
- // }
- // if (a < 2) {
- // var B = a == 0 ? l[1] : po[1]//公积金缴纳
- // }
- // }
- var A = Number(s).toFixed(2)
- var B = Number(a).toFixed(2)
-
-
-
- // var A = 0
- // var B = 0
- console.log(d)
- var salary = m - A - B//每月应纳税工资
- var taxesS = m - A - B - d//每月实际纳税工资
- var ex = 5000//每个月免税额度
- var lastC = 0//累计个税
- var lastT = 0//累计税后工资
- var result = []
- var income = []
- for (var i = 1; i < 13; i ++) {
- var allE = ex * i
- var allT = taxesS * i - allE//需交税部分工资
- // console.log(allT)
- var C = calculateTax(allT)
- // console.log(C)
- result.push((C - lastC).toFixed(2))
- income.push((salary - C + lastC).toFixed(2))
- lastT = lastT + salary - C + lastC
- lastC = C
-
- }
-
- result.push(lastC.toFixed(2))
- income.push(lastT.toFixed(2))
- // console.log(result)
- // console.log(lastC)
-
-
- // C = C.toFixed(1)
- // var income = (taxesS - C).toFixed(2)//税后收入
- // console.log(taxesS)
- // console.log(B)
- // console.log(C)
- // console.log(income)
- //算大病医疗退税
- var allT = (taxesS - ex) * 12 - md//年度需交税部分工资
- var rebate = calculateTax(allT)
-
- rebate = result[12] - rebate
- if (rebate < 0) {
- rebate = 0
- }
- return [A, B, result, income, rebate]
- }
- function calculateTax(s) {
- var C = 0//个税
- if (s > 960000) {
- C = s * 0.45 - 181920
- } else if (s > 660000) {
- C = s * 0.35 - 85920
- } else if (s > 420000) {
- C = s * 0.3 - 52920
- } else if (s > 300000) {
- C = s * 0.25 - 31920
- } else if (s > 144000) {
- C = s * 0.2 - 16920
- } else if (s > 36000) {
- C = s * 0.1 - 2520
- } else if (s > 0) {
- C = s * 0.03
- }
- return C
- }
- module.exports = {
- calculate: calculate
- }
|