Good day!
I have table in my database which I could check the range of compensatin,monthly salary credit, monthly contribution.
Now i am in the process of analyzing how can I get the monthly contribution of employee it is depend on their basic pay.
I have this code for getting the basic pay of employee:
$sql = "SELECT em.EMP_NO, w.RATE, e.Hours FROM $ADODB_DB.wage w, $ADODB_DB.employment em, $PAYROLL.earnings e WHERE w.EMP_ID = '$currentEmpID' AND em.EMP_ID = '$currentEmpID' AND e.EMP_NO = em.EMP_NO";
$RsEarnings = $conn2->Execute($sql);
$Rate = trim($RsEarnings->fields['RATE']);
$Hours = trim($RsEarnings->fields['Hours']);
$Hours = substr($Hours, 0, 5);
$Hours = str_replace(':', '.', $Hours);
$Amount = $_POST["Amount"];
$Amount = mysql_real_escape_string($Amount);
$Amount = round(($Hours/8)* $Rate, 2);
$smarty->assign('Rate', $Rate);
$smarty->assign('Hours', $Hours);
$smarty->assign('Amount', $Amount);
the Amount is the Basic Pay and it is only display the basic pay not yet save in the database.
and I have table deduction that has fields:
RangeCompensation varchar
MonthlySalaryCredit varchar
MonthlyContribution varchar
Example data:
1000 - 1249.99 1000 33.30
1250 - 1749.99 1500 50.00
1750 - 2249.99 2000 66.70 and so on.....
The deduction is base on the Amount, what should be my query or condition to check if what would be his monthlydeduction.
For example Amount or Basic pay is 5422.5
Where should I base is it in MonthlySalaryCredit? or should separate the rangecompensation into two then i will based on that? to get his monthly deduction
Thank you so much...