diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php
index 4fa76a59..1eecb8c6 100755
--- a/application/controllers/payslip.php
+++ b/application/controllers/payslip.php
@@ -517,8 +517,6 @@ function phpAlert($msg) {
foreach($data['fresh'] as $value){
- //print_r($value);
- //die();
$NoofDays=$value->NoofDays;//Month day 30,31,28
$HRA_Amount = $value->HRA_Amount;
@@ -535,6 +533,15 @@ function phpAlert($msg) {
$MasterIncentives=$value->MasterIncentives;//Master values get
// echo 'master'.$MasterIncentives;
+
+
+ $due_start_date = $value->DueDate;
+ $paydate = $current;//From POST parm
+ $pmonth = substr($paydate,0,2);
+ $pyear = substr($paydate,-4);
+
+ $pday=cal_days_in_month(CAL_GREGORIAN,$pmonth,$pyear);
+ $paymonth = $pyear.'-'.$pmonth.'-'.$pday;
$Loan_amount = $value->Loan_Amount;
$Paid_Amount = $value->Paid_Amount;
@@ -549,11 +556,17 @@ function phpAlert($msg) {
}
else if($Loan_Recovered == 0.00)
{
- $loan=$Monthly_Due;
+ if(strtotime($due_start_date) <= strtotime($paymonth))
+ {
+ $loan=$Monthly_Due;
+ }
}
else if($Loan_Recovered >= 0.00)
{
- $loan = $Loan_Recovered;
+ if(strtotime($due_start_date) <= strtotime($paymonth))
+ {
+ $loan = $Loan_Recovered;
+ }
}
@@ -665,12 +678,12 @@ function phpAlert($msg) {
{
$current = $this->input->post('monthyear');
- //echo $current;
+
$data['month'] = $this->monthlypay_model->monthlyListing($current);
//print_r($data['month']);
$data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
-
+ //print_r($data['fresh']);
$employeeSalary = [];
@@ -689,6 +702,18 @@ function phpAlert($msg) {
$Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due = $value->Monthly_Due;// AUTO LOAN DUE
+ $due_start_date = $value->DueDate;
+ $paydate = $current;//From POST parm
+
+ if(strlen($paydate) == 6)
+ {
+ $paydate = '0'.$paydate;
+ }
+ $pmonth = substr($paydate,0,2);
+ $pyear = substr($paydate,-4);
+
+ $pday=cal_days_in_month(CAL_GREGORIAN,$pmonth,$pyear);
+ $paymonth = $pyear.'-'.$pmonth.'-'.$pday;
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
@@ -708,11 +733,19 @@ function phpAlert($msg) {
}
else if($Loan_Recovered == 0.00)
{
- $loan=$Monthly_Due;
+ if(strtotime($due_start_date) <= strtotime($paymonth))
+ {
+ $loan=$Monthly_Due;
+ }
+
}
else if($Loan_Recovered >= 0.00)
{
- $loan = $Loan_Recovered;
+
+ if(strtotime($due_start_date) <= strtotime($paymonth))
+ {
+ $loan = $Loan_Recovered;
+ }
}
diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php
index 90ab0e31..83f0c956 100755
--- a/application/models/monthlypay_model.php
+++ b/application/models/monthlypay_model.php
@@ -99,7 +99,7 @@ if(strlen($month) == 6)
//echo $lastdate;
//left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
- $sql ="select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives as MasterIncentives,T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Loan_Master.Loan_Amount,T_Loan_Master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Monthly_Pay_Inputs.Estimate,T_Monthly_Pay_Inputs.Festival_Bonus,T_Monthly_Pay_Inputs.Other_Deductions,T_Loan_History .Balance_Amount
+ $sql ="select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives as MasterIncentives,T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Loan_Master.Due_Start_Date as DueDate,T_Loan_Master.Loan_Amount,T_Loan_Master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Monthly_Pay_Inputs.Estimate,T_Monthly_Pay_Inputs.Festival_Bonus,T_Monthly_Pay_Inputs.Other_Deductions,T_Loan_History .Balance_Amount
from T_Emp_Pay_Data
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and T_Payroll.PayOn = ?
@@ -116,6 +116,7 @@ if(strlen($month) == 6)
return $query->result();
}
+
function getPublicHoldays($current="")
{
if(!empty($current))
diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php
index 06a0e0f9..f9131224 100755
--- a/application/views/monthlypayinputs.php
+++ b/application/views/monthlypayinputs.php
@@ -876,6 +876,954 @@ function calculategrandtotal(){
+ $.each(totalmonthloan, function( index, value )
+ {
+ //var res2 = value.split('-');
+ tempTotal[index]=parseFloat(value);
+ });
+
+ var sum = 0;
+
+ for (var i = 0; i < tempTotal.length; i++) {
+ sum += tempTotal[i] << 0;
+ }
+ $('#monthloan').text(parseFloat(sum).toFixed(2));
+
+ console.log(totalmanualoan);
+ $.each(totalmanualoan, function( index, value )
+ {
+ //var res2 = value.split('-');
+ tempTotal[index]=parseFloat(value);
+ });
+
+ var sum = 0;
+
+ for (var i = 0; i < tempTotal.length; i++) {
+ sum += tempTotal[i] << 0;
+ }
+ $('#manualoan').text(parseFloat(sum).toFixed(2));
+}
+
+
+ function show_hide_column(col_no, do_show) {
+ var rows = document.getElementById('monthlylistings').rows;
+
+ for (var row = 0; row < rows.length; row++) {
+ var cols = rows[row].cells;
+ if (col_no >= 0 && col_no < cols.length) {
+ cols[col_no].style.display = do_show ? '' : 'none';
+ }
+ }
+}
+
+ Key))
+ {
+ $show_hide_column_value = false;
+ }
+ else
+ {
+ $show_hide_column_value = true;
+ }
+ break;
+ }
+
+ $ex = explode('-',$dropdownvalue);
+
+ if(strlen($ex[0])== '2')
+ {
+ if($ex[0] < 10)
+ {
+ $ex1 = substr($ex[0],1);
+ }
+ else{
+ $ex1 = $ex[0];
+ }
+ }
+ else{
+ $ex1 = $ex[0];
+ }
+
+ $drop = $ex1.'-'.$ex[1];
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "Jan", "2" => "Feb","3" => "Mar","4" => "Apr","5" => "May","6" => "June","7"=> "July","8"=> "Aug","9" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
+
+ $currentmontharray = array(array($month."-".$year => $monthsoptions[$month]."-".$year));
+ // For find out Next and previous month and year from current year
+ $aftersix = array();
+ for ($i = 0; $i <3;$i++){
+
+ $month++;
+ if($month > 12)
+ {
+ $month = 1;
+ $year = $year +1;
+ }
+
+ $aftersix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
+
+ }
+
+ $year = date("Y");
+ $month = date("m");
+
+ $beforesix = array();
+ for ($i = 3; $i >0;$i--){
+
+ $month--;
+ if($month < 1 )
+ {
+ $month = 12;
+ $year = $year - 1;
+ }
+
+ $beforesix[]=array($month."-".$year => $monthsoptions[$month]."-".$year);
+
+ }
+
+ $beforesix = array_reverse($beforesix);
+
+
+ $options = array_merge($options,$beforesix);
+ //echo count($options);
+
+ $options = array_merge($options,$currentmontharray);
+ $options = array_merge($options,$aftersix);
+
+ $ot = array();
+ foreach($options as $o)
+ {
+
+ foreach($o as $key => $value)
+ {
+
+ $ot[$key] = $value;
+
+ }
+
+ }
+ ?>
+
+
+
+
+
+
+ | S.No |
+ Employee |
+
+ Days Worked |
+ LOP Days |
+ Paid Leave |
+ OT Hrs |
+
+ Auto Loan Due ₹ |
+
+ Manual Loan Due ₹ |
+
+ Incentives in ₹ |
+ Other Deductions in ₹ |
+ Festival Bonus in ₹ |
+
+ Estimate in ₹ |
+
+
+
+
+
+
+ $record)
+ {
+ //echo 'PAY'.$record->Key;
+ $index++;
+
+ if(in_array($record->EmpID,$testarray))
+ {
+ $index--;
+
+
+ }
+ else{
+
+
+ array_push($testarray,$record->EmpID);
+
+
+
+ ?>
+
+
+ |
+
+ EmpID ."-".$record->FirstName ."". $record->LastName ?> |
+
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Days_worked)){echo $record->Days_worked;}else{echo "0.00";}?> |
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?> |
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?> |
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?> |
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Monthly_Due)){echo $record->Monthly_Due; $totalmonthloan []=$record->Monthly_Due;}else { echo number_format(0.00,2,'.','');} ?> |
+
+
+
+
+
+
+ Key) && !empty($record->Loan_ID)){ echo "contenteditable='true'; style='background-color:#ffcccc;text-align:right' title='Loan Pending'"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >
+
+ Loan_Recovered))
+ {if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.',''); $totalmanualoan[] = $record->Loan_Recovered;}else {echo $record->Loan_Recovered; $totalmanualoan[] = $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?>
+
+
+
+
+ |
+
+
+ Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >
+
+
+ MonthlyIncentives)){echo $record->MonthlyIncentives; $totalinst [] = $record->MonthlyIncentives;}else {echo $record->MasterIncentives; $totalinst [] = $record->MasterIncentives;}
+
+ ?>
+
+
+
+ |
+
+
+
+ Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Other_Deductions)){echo $record->Other_Deductions;$totalotherDet [] = $record->Other_Deductions;}else{ echo number_format(0.00,2,'.','');} ?> |
+
+
+ Key)){echo "contenteditable='true';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"style="text-align:right;" >Festival_Bonus)){echo $record->Festival_Bonus;$totalfestival [] = $record->Festival_Bonus;}else{ echo number_format(0.00,2,'.','');;} ?> |
+
+
+
+ Key)){echo "contenteditable='false';"; } ?> Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"> Estimate)){echo $record->Estimate; $estTotal [] = $record->Estimate; }else { echo $empSalary[$i]; $estTotal [] = $empSalary[$i];
+}?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ Total |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+