Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Created October 3, 2017 14:16
Show Gist options
  • Save anthonybudd/8b35e2992eb5606e0897a7e1793c02d5 to your computer and use it in GitHub Desktop.
Save anthonybudd/8b35e2992eb5606e0897a7e1793c02d5 to your computer and use it in GitHub Desktop.
<?php
$salary = 60000;
$oneMonth = ($salary / 12);
$twoMonths = ($salary / 6);
$halfMonth = ($salary / 24);
$monthlyCommission = 10000;
$annualBonus = 120000;
$noticePeriod = x;
$noticePay = 12000;
$grievance = true;
$discrimination = true;
$onSick = true;
$leftEmployment = true;
$disciplinary = true;
$sar = true;
$performanceReview = true;
$tribunalClaimIssued = true;
$disabled = true;
$whistleblowing = true;
$gotAnotherJob = true;
$doYouWorkInThePublicSector = true;
$beenOfferedAnSA = true;
$annualBonusFactor = (($annualBonus / 12) * 0.5);
$monthlyCommissionFactor = (($monthlyCommission) * 0.5);
$grievanceFactor = 0;
if ($grievance){
$grievanceFactor = $halfMonth;
}
$discriminationFactor = 0;
if ($discrimination){
$discriminationFactor = $halfMonth;
}
$on_sick_factor = 0;
if ($onSick) {
$onSickFactor = $halfMonth;
}
$disciplinaryFactor = 0;
if ($disciplinary){
$disciplinaryFactor = -$oneMonth;
}
$sarFactor = 0;
if($sar){
$sarFactor = $oneMonth;
}
$performanceReviewFactor = 0;
if($performanceReview){
$performanceReviewFactor = $oneMonth;
}
$tribunalClaimIssuedFactor = 0;
if($tribunalClaimIssued){
$tribunalClaimIssuedFactor = $oneMonth;
}
$disabledFactor = 0;
if($disabled){
$disabledFactor = $halfMonth;
}
$whistleblowingFactor = 0;
if($whistleblowing){
$whistleblowingFactor = $halfMonth;
}
$gotAnotherJobFactor = 0;
if($gotAnotherJob){
$gotAnotherJobFactor = -$oneMonth;
}
$redundancyFactor = 0;
if($redundancyJustMeGoing){
$redundancyFactor = $halfMonth;
}
if($redundancythers_going_too){
redundancyFactor = -($oneMonth * 1.5);
}
$total = ($twoMonths +
$ageFactor +
$numberOfPeopleFactor +
$grievanceFactor +
$discriminationFactor +
$onSickFactor +
$disciplinaryFactor+
$sarFactor+
$performanceReviewFactor +
$tribunalClaimIssuedFactor +
$disabledFactor +
$whistleblowingFactor+
$annualBonusFactor+
$monthlyCommissionFactor+
$gotAnotherJobFactor+
$redundancyFactor);
$doYouWorkInThePublicSectorFactor = 1;
if($doYouWorkInThePublicSector)!.($beenOfferedAnSA){
$doYouWorkInThePublicSectorFactor = 0;
}
/* $years_service_factor
Here if years' service is less than 2 years, then make the whole result equal to Notice Pay only.
The exception to this rule is if there are discrimination, whistleblowing, commission or bonus.
If years service is less than 2, and discrimination or whistleblowing apply then subtract one month from the total.
If years' service is less than 2 and commission or bonus do apply then make the whole result equal to Notice Pay only then add commissionFactor or bonusFactor as above.
If years' service is less than 2 and if there are (discrimination or whistleblowing) and (bonus or commission) then perform the sum as usual but then subtract one month from the total.l
*/
/*if ($left_employment = true) {$left_employment_factor = -$notice_period;}
In other words here we need to subtract notice period from the total, if the user has left employment*/
/*
$age =
$age_up_to_50 = 0
$age_50_to_55 = + halfMonth
$age_55_to_60 = + oneMonth
$age_60_to_65 = + (oneMonth * 1.5)
$age_65_to_70 = + (oneMonth * 2)
$age_70_and_over = oneMonth
First attempt at way to do age:
If $age > 49 && $age < 56 {+ $half_month};
Elseif $age >55 && $age < 61 {+$one_month};
*/
/*
$no_of_people_1_to_10 = -$half_month
$no_of_people_10_to_50 = +$half_month
$no_of_people_50_to_500 = 0
$no_of_people_500_plus = +$half_month
*/
$grandTotal = ($total * $doYouWorkInThePublicSectorFactor)+($noticePay);
//echo $grandTotal;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment