Skip to content

Instantly share code, notes, and snippets.

@vivithemage
Last active January 22, 2019 16:36
Show Gist options
  • Save vivithemage/0b5f016b3e7dd58ddfbba9f89bd1484d to your computer and use it in GitHub Desktop.
Save vivithemage/0b5f016b3e7dd58ddfbba9f89bd1484d to your computer and use it in GitHub Desktop.
UK Apprenticeship Levy Calculator (javascript only)
/**
* Takes the total bill and percentage to generate the results
* @param {[type]} pay_bill [description]
* @param {[type]} percentage_in_england [description]
* @constructor
*/
function ApprenticeshipLevyCalculator(pay_bill, percentage_in_england) {
var results = {
totalLevy : (pay_bill*0.005).toFixed(0),
levyAllowance : (15000).toFixed(0),
totalPayable : ((pay_bill*0.005)-15000).toFixed(0),
amountInDigitalAccount : (((pay_bill*0.005)-15000)*percentage_in_england*0.01).toFixed(0),
tenPercentTopUp : (((pay_bill*0.005)-15000)*percentage_in_england*0.001).toFixed(0),
totalToInvestTraining : (((pay_bill*0.005)-15000)*percentage_in_england*0.011).toFixed(0),
averageOfFivek : ((((pay_bill*0.005)-15000)*percentage_in_england*1.1)/500000).toFixed(0),
averageOfTwok : ((((pay_bill*0.005)-15000)*percentage_in_england*1.1)/2400000).toFixed(0),
blendAveragetwelvek : ((((pay_bill*0.005)-15000)*percentage_in_england*1.1)/1200000).toFixed(0),
}
return results;
}
console.log(ApprenticeshipLevyCalculator(10000, 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment