-
Notifications
You must be signed in to change notification settings - Fork 0
/
salaryhr.js
43 lines (39 loc) · 2.24 KB
/
salaryhr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function calculate() {
var hrsworked = parseFloat(document.getElementById("hrsworked").value);
var days = parseFloat(document.getElementById("days").value);
var hrsover = parseFloat(document.getElementById("hrsover").value);
var hrrate = parseFloat(document.getElementById("hrrate").value);
var hall = parseFloat(document.getElementById("hall").value);
var mall = parseFloat(document.getElementById("mall").value);
var taxrate = parseFloat(document.getElementById("taxrate").value);
var mpr = parseFloat(document.getElementById("mpr").value);
var inr = parseFloat(document.getElementById("inr").value);
var nssf = parseFloat(document.getElementById("nssf").value);
var nhif = parseFloat(document.getElementById("nhif").value);
var pension = parseFloat(document.getElementById("pension").value);
var damages = parseFloat(document.getElementById("damages").value);
var bankloanmi = parseFloat(document.getElementById("bankloanmi").value);
var savings = parseFloat(document.getElementById("savings").value);
var stdloan = parseFloat(document.getElementById("stdloan").value);
var disability = parseFloat(document.getElementById("disability").value);
let normal = hrrate * hrsworked * days;
document.getElementById("normal").value = normal.toFixed(2);
let overrate = 1.5 * hrrate;
document.getElementById("overrate").value = overrate.toFixed(2);
let overpay = overrate * hrsover;
document.getElementById("overpay").value = overpay.toFixed(2);
let basicpay = normal + overpay;
document.getElementById("basicpay").value = basicpay.toFixed(2);
let gpay = basicpay + hall + mall;
document.getElementById("gpay").value = gpay.toFixed(2);
let taxable = gpay - nssf;
document.getElementById("taxable").value = taxable.toFixed(2);
let tottax = taxable * (taxrate / 100);
document.getElementById("tottax").value = tottax.toFixed(2);
let paye= tottax - (mpr + inr );
document.getElementById("paye").value = paye.toFixed(2);
let totdeduc= paye+ nssf + nhif + pension + damages + bankloanmi + savings + stdloan + disability;
document.getElementById("totdeduc").value = totdeduc.toFixed(2);
let netsal=gpay-totdeduc;
document.getElementById("netsal").value = netsal.toFixed(2);
}