Skip to content

Instantly share code, notes, and snippets.

@tbtbt
Created January 26, 2018 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbtbt/9fbf8867f34c78cacc28e8bed45f1052 to your computer and use it in GitHub Desktop.
Save tbtbt/9fbf8867f34c78cacc28e8bed45f1052 to your computer and use it in GitHub Desktop.
社会保険料額表@協会けんぽ(平成29年9月以降分、東京)(Google Cloud Functions用)
// 社会保険料率一覧表
const socialInsurancePaymentList = [
[1, 1, 58000, 0, 63000, 5747.80, 2873.90, 6704.80, 3352.40, 16104.00, 8052.00, ],
[2, 1, 68000, 63000, 73000, 6738.80, 3369.40, 7860.80, 3930.40, 16104.00, 8052.00, ],
[3, 1, 78000, 73000, 83000, 7729.80, 3864.90, 9016.80, 4508.40, 16104.00, 8052.00, ],
[4, 1, 88000, 83000, 93000, 8720.80, 4360.40, 10172.80, 5086.40, 16104.00, 8052.00, ],
[5, 2, 98000, 93000, 101000, 9711.80, 4855.90, 11328.80, 5664.40, 17934.00, 8967.00, ],
[6, 3, 104000, 101000, 107000, 10306.40, 5153.20, 12022.40, 6011.20, 19032.00, 9516.00, ],
[7, 4, 110000, 107000, 114000, 10901.00, 5450.50, 12716.00, 6358.00, 20130.00, 10065.00, ],
[8, 5, 118000, 114000, 122000, 11693.80, 5846.90, 13640.80, 6820.40, 21594.00, 10797.00, ],
[9, 6, 126000, 122000, 130000, 12486.60, 6243.30, 14565.60, 7282.80, 23058.00, 11529.00, ],
[10, 7, 134000, 130000, 138000, 13279.40, 6639.70, 15490.40, 7745.20, 24522.00, 12261.00, ],
[11, 8, 142000, 138000, 146000, 14072.20, 7036.10, 16415.20, 8207.60, 25986.00, 12993.00, ],
[12, 9, 150000, 146000, 155000, 14865.00, 7432.50, 17340.00, 8670.00, 27450.00, 13725.00, ],
[13, 10, 160000, 155000, 165000, 15856.00, 7928.00, 18496.00, 9248.00, 29280.00, 14640.00, ],
[14, 11, 170000, 165000, 175000, 16847.00, 8423.50, 19652.00, 9826.00, 31110.00, 15555.00, ],
[15, 12, 180000, 175000, 185000, 17838.00, 8919.00, 20808.00, 10404.00, 32940.00, 16470.00, ],
[16, 13, 190000, 185000, 195000, 18829.00, 9414.50, 21964.00, 10982.00, 34770.00, 17385.00, ],
[17, 14, 200000, 195000, 210000, 19820.00, 9910.00, 23120.00, 11560.00, 36600.00, 18300.00, ],
[18, 15, 220000, 210000, 230000, 21802.00, 10901.00, 25432.00, 12716.00, 40260.00, 20130.00, ],
[19, 16, 240000, 230000, 250000, 23784.00, 11892.00, 27744.00, 13872.00, 43920.00, 21960.00, ],
[20, 17, 260000, 250000, 270000, 25766.00, 12883.00, 30056.00, 15028.00, 47580.00, 23790.00, ],
[21, 18, 280000, 270000, 290000, 27748.00, 13874.00, 32368.00, 16184.00, 51240.00, 25620.00, ],
[22, 19, 300000, 290000, 310000, 29730.00, 14865.00, 34680.00, 17340.00, 54900.00, 27450.00, ],
[23, 20, 320000, 310000, 330000, 31712.00, 15856.00, 36992.00, 18496.00, 58560.00, 29280.00, ],
[24, 21, 340000, 330000, 350000, 33694.00, 16847.00, 39304.00, 19652.00, 62220.00, 31110.00, ],
[25, 22, 360000, 350000, 370000, 35676.00, 17838.00, 41616.00, 20808.00, 65880.00, 32940.00, ],
[26, 23, 380000, 370000, 395000, 37658.00, 18829.00, 43928.00, 21964.00, 69540.00, 34770.00, ],
[27, 24, 410000, 395000, 425000, 40631.00, 20315.50, 47396.00, 23698.00, 75030.00, 37515.00, ],
[28, 25, 440000, 425000, 455000, 43604.00, 21802.00, 50864.00, 25432.00, 80520.00, 40260.00, ],
[29, 26, 470000, 455000, 485000, 46577.00, 23288.50, 54332.00, 27166.00, 86010.00, 43005.00, ],
[30, 27, 500000, 485000, 515000, 49550.00, 24775.00, 57800.00, 28900.00, 91500.00, 45750.00, ],
[31, 28, 530000, 515000, 545000, 52523.00, 26261.50, 61268.00, 30634.00, 96990.00, 48495.00, ],
[32, 29, 560000, 545000, 575000, 55496.00, 27748.00, 64736.00, 32368.00, 102480.00, 51240.00, ],
[33, 30, 590000, 575000, 605000, 58469.00, 29234.50, 68204.00, 34102.00, 107970.00, 53985.00, ],
[34, 31, 620000, 605000, 635000, 61442.00, 30721.00, 71672.00, 35836.00, 113460.00, 56730.00, ],
[35, 31, 650000, 635000, 665000, 64415.00, 32207.50, 75140.00, 37570.00, 113460.00, 56730.00, ],
[36, 31, 680000, 665000, 695000, 67388.00, 33694.00, 78608.00, 39304.00, 113460.00, 56730.00, ],
[37, 31, 710000, 695000, 730000, 70361.00, 35180.50, 82076.00, 41038.00, 113460.00, 56730.00, ],
[38, 31, 750000, 730000, 770000, 74325.00, 37162.50, 86700.00, 43350.00, 113460.00, 56730.00, ],
[39, 31, 790000, 770000, 810000, 78289.00, 39144.50, 91324.00, 45662.00, 113460.00, 56730.00, ],
[40, 31, 830000, 810000, 855000, 82253.00, 41126.50, 95948.00, 47974.00, 113460.00, 56730.00, ],
[41, 31, 880000, 855000, 905000, 87208.00, 43604.00, 101728.00, 50864.00, 113460.00, 56730.00, ],
[42, 31, 930000, 905000, 955000, 92163.00, 46081.50, 107508.00, 53754.00, 113460.00, 56730.00, ],
[43, 31, 980000, 955000, 1005000, 97118.00, 48559.00, 113288.00, 56644.00, 113460.00, 56730.00, ],
[44, 31, 1030000, 1005000, 1055000, 102073.00, 51036.50, 119068.00, 59534.00, 113460.00, 56730.00, ],
[45, 31, 1090000, 1055000, 1115000, 108019.00, 54009.50, 126004.00, 63002.00, 113460.00, 56730.00, ],
[46, 31, 1150000, 1115000, 1175000, 113965.00, 56982.50, 132940.00, 66470.00, 113460.00, 56730.00, ],
[47, 31, 1210000, 1175000, 1235000, 119911.00, 59955.50, 139876.00, 69938.00, 113460.00, 56730.00, ],
[48, 31, 1270000, 1235000, 1295000, 125857.00, 62928.50, 146812.00, 73406.00, 113460.00, 56730.00, ],
[49, 31, 1330000, 1295000, 1355000, 131803.00, 65901.50, 153748.00, 76874.00, 113460.00, 56730.00, ],
[50, 31, 1390000, null, 1355000, 137749.00, 68874.50, 160684.00, 80342.00, 113460.00, 56730.00, ]
];
// 社会保険料を取得する
exports.getSocialInsurance201709 = (req, res) => {
// check parameters.
if (!('salary' in req.query) || !('kaigo' in req.query) ||
!/[1-9][0-9]*/.test(req.query.salary) || ['0', '1'].indexOf(req.query.kaigo) === -1) {
res.status(400).send(`invalid parameters.`);
}
let salary = parseInt(req.query.salary, 10);
for (let i = 0; i < socialInsurancePaymentList.length; i++) {
if (salary >= socialInsurancePaymentList[i][3] && (salary === null || salary < socialInsurancePaymentList[i][4])) {
let insuranceIndex = (req.query.kaigo === '1') ? 8 : 6;
return res.status(200).send({
"standardRemuneration": socialInsurancePaymentList[i][2],
"insurance": {
"grade": socialInsurancePaymentList[i][0],
"payment": Math.round(socialInsurancePaymentList[i][insuranceIndex]),
},
"pension": {
"grade": socialInsurancePaymentList[i][1],
"payment": Math.round(socialInsurancePaymentList[i][10]),
}
});
}
}
res.status(500).send(`ABNORMAL END.`);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment