pay str

 

Prepare Salary Breakup

Note: Only Gross & State is mandatory, others are optional. Please Click Here to refer rule. 

 








// Rule for Basic Calculation const basic = grossSalary * basicPercentage > (minimumWageBasic + minimumWageDA) ? grossSalary * (basicPercentage - basicPercentage * 0.20) : minimumWageBasic;

// Rule for HRA Calculation let hra; const da = grossSalary * basicPercentage > (minimumWageBasic + minimumWageDA) ? basic * 0.25 : minimumWageDA; const basicDA = basic + da; const condition1 = basicDA * hraPercentage + basic + da + (serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0) + specialAllowance; const condition2 = basicDA * 0.05 + basic + da + (serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0) + specialAllowance + 1;

if (grossSalary < condition2) { hra = grossSalary - basic - da - (serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0) - specialAllowance; } else if (grossSalary < condition1) { hra = grossSalary - basic - da - (serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0) - specialAllowance; } else { hra = basicDA * hraPercentage; } // Rule for Other Allowance Calculation const otherAllowance = grossSalary - basic - da - hra - specialAllowance - (serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0); const specialAllowanceAmount = specialAllowance; const serviceWeightage = serviceWeightageApplicability === 'Yes' ? 0.01 * basic : 0; const esiEmployee = grossSalary <= 21000 ? 0.0075 * grossSalary : 0; const originalPFEmployee = (grossSalary - hra) > 15000 ? 1800 : 0.12 * (grossSalary - hra); const pfEmployee = originalPFEmployee + vpfAmount; const esiEmployer = grossSalary <= 21000 ? 0.0325 * grossSalary : 0; const pfEmployer = (grossSalary - hra) > 15000 ? 1950 : 0.13 * (grossSalary - hra); const bonus = bonusApplicability === 'Yes' ? (basic > 21000 ? 0 : 0.0833 * basic) : 0; const gratuity = gratuityApplicability === 'Yes' ? 0.0481 * basic : 0;

const deductions = esiEmployee + pt + pfEmployee; const employerContributions = esiEmployer + pfEmployer + bonus + gratuity; const netPay = grossSalary - (esiEmployee + pt + originalPFEmployee) - vpfAmount; const totalCTC = grossSalary + employerContributions;

const resultContainer = document.getElementById('result'); resultContainer.innerHTML = `

Salary Breakup

Components Amount
Earnings
Basic ${basic.toFixed(2)}
DA ${da.toFixed(2)}
HRA ${hra.toFixed(2)}
Other Allowance ${otherAllowance.toFixed(2)}
Special Allowance ${specialAllowanceAmount.toFixed(2)}
Service Weightage ${serviceWeightage.toFixed(2)}
Gross Earnings ${(basic + da + hra + otherAllowance + specialAllowanceAmount + serviceWeightage).toFixed(2)}
Deductions
ESI Employee ${esiEmployee.toFixed(2)}
Professional Tax ${pt.toFixed(2)}
PF Employee ${pfEmployee.toFixed(2)}
Total Deductions ${deductions.toFixed(2)}
Employer Contributions
ESI Employer ${esiEmployer.toFixed(2)}
PF Employer ${pfEmployer.toFixed(2)}
Bonus ${bonus.toFixed(2)}
Gratuity ${gratuity.toFixed(2)}
Total Contributions ${employerContributions.toFixed(2)}
Net Pay ${netPay.toFixed(2)}
Monthly CTC ${totalCTC.toFixed(2)}

`; }