diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php
index c96b690b..47545af6 100755
--- a/application/controllers/payslip.php
+++ b/application/controllers/payslip.php
@@ -504,14 +504,95 @@ function phpAlert($msg) {
$this->loadViews("payslipupload2", $this->global, NULL);
}
- public function monthlyInputs()
+ public function monthlyInputs()
{
$current = date("m-Y");
- $data['month'] = $this-> monthlypay_model->monthlyListing($current);
+ $data['month'] = $this->monthlypay_model->monthlyListing($current);
// $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
- $data['dropdownvalue'] = $current;
- $data['fresh'] = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current);
- $this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
+ $data['dropdownvalue'] = $current;
+ $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
+ //print_r( $data['fresh']);
+
+ $employeeSalary = [];
+foreach($data['fresh'] as $value){
+
+
+ $NoofDays=$value->NoofDays;//Month day 30,31,28
+ $HRA_Amount = $value->HRA_Amount;
+ $Basic_Pay = $value->Basic_Pay;
+ $TotalSalary = $value->TotalSalary;
+ $Food_Allowances= $value->Food_Allowances;
+ $Days_worked = $value->Days_worked; // working day
+ $LOP_Days = $value->LOP_Days; // not working day
+ $Paid_leave = $value->Paid_leave; // leave day
+ $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
+ $Monthly_Due= $value->Monthly_Due;// loan due amt
+ $Incentives=$value->Incentives;
+ $Allowances =$value->Allowances;
+ $HRA_Rate=$value->HRA_Rate;
+ $PF_Rate=$value->PF_Rate;
+ $ESI_Rate=$value->ESI_Rate;
+
+
+
+
+ $daySalarys = $Days_worked + $Paid_leave;
+
+ //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
+ //$Allowances = $allowances * $values;
+ $dayFood_Allowance = $Food_Allowances * $Days_worked;
+
+ $daySalary = $Basic_Pay / $NoofDays;
+ /**per day salary working hour**/
+ //echo $daySalary.'
';
+
+ $dayHra = $HRA_Amount / $NoofDays;
+ /** per day hra amount **/
+ //echo $dayHra.'
';
+
+ $onehoursSalary = ($daySalary + $dayHra) / 8;
+ /**one hour salay ot calculation**/
+ if ($OT_Hrs_Worked != 0)
+ {
+ $totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
+ }
+ else
+ {
+ $totSalayOT = 0;
+ }
+ $currentDaySalary = $daySalary * $daySalarys;
+ /** current day salary working days calculation**/
+
+
+ $currentDayHra = $dayHra * $daySalarys;
+ /** total working days hra calculations**/
+ // echo $currentDayHra.'
';
+ $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
+ /** current date pf calculation**/
+ if ($TotalSalary <= 20000)
+ {
+
+ $esiAmount = $currentDatePF * $ESI_Rate / 100;
+ /** esiamount not elgiable for 20000 **/
+ }
+ else
+ {
+ $esiAmount = 0;
+ }
+ $pfAmount = $currentDaySalary * $PF_Rate/ 100;
+ /** pf amount per day**/
+
+ //echo $totalothour;die;
+ $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentives;
+ $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due;
+ $employeeSalary []= round($salaryInCurrentday);
+
+
+
+}
+ $data['empSalary'] = $employeeSalary;
+
+ $this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global,$data,NULL);
@@ -522,11 +603,92 @@ function phpAlert($msg) {
$current = $this->input->post('monthyear');
- $data['month'] = $this-> monthlypay_model->monthlyListing($current);
+ $data['month'] = $this->monthlypay_model->monthlyListing($current);
+ //print_r($data['month']);
$data['dropdownvalue'] = $current;
- $data['fresh'] = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current);
-
+ $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
+
+ $employeeSalary = [];
+foreach($data['fresh'] as $value){
+
+
+ $NoofDays=$value->NoofDays;//Month day 30,31,28
+ $HRA_Amount = $value->HRA_Amount;
+ $Basic_Pay = $value->Basic_Pay;
+ $TotalSalary = $value->TotalSalary;
+ $Food_Allowances= $value->Food_Allowances;
+ $Days_worked = $value->Days_worked; // working day
+ $LOP_Days = $value->LOP_Days; // not working day
+ $Paid_leave = $value->Paid_leave; // leave day
+ $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
+ $Monthly_Due= $value->Monthly_Due;// loan due amt
+ $Incentives=$value->Incentives;
+ $Allowances =$value->Allowances;
+ $HRA_Rate=$value->HRA_Rate;
+ $PF_Rate=$value->PF_Rate;
+ $ESI_Rate=$value->ESI_Rate;
+
+
+
+
+ $daySalarys = $Days_worked + $Paid_leave;
+
+ //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
+ //$Allowances = $allowances * $values;
+ $dayFood_Allowance = $Food_Allowances * $Days_worked;
+
+ $daySalary = $Basic_Pay / $NoofDays;
+ /**per day salary working hour**/
+ //echo $daySalary.'
';
+
+ $dayHra = $HRA_Amount / $NoofDays;
+ /** per day hra amount **/
+ //echo $dayHra.'
';
+
+ $onehoursSalary = ($daySalary + $dayHra) / 8;
+ /**one hour salay ot calculation**/
+ if ($OT_Hrs_Worked != 0)
+ {
+ $totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
+ }
+ else
+ {
+ $totSalayOT = 0;
+ }
+ $currentDaySalary = $daySalary * $daySalarys;
+ /** current day salary working days calculation**/
+
+
+ $currentDayHra = $dayHra * $daySalarys;
+ /** total working days hra calculations**/
+ // echo $currentDayHra.'
';
+ $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
+ /** current date pf calculation**/
+ if ($TotalSalary <= 20000)
+ {
+
+ $esiAmount = $currentDatePF * $ESI_Rate/ 100;
+ /** esiamount not elgiable for 20000 **/
+ }
+ else
+ {
+ $esiAmount = 0;
+ }
+ $pfAmount = $currentDaySalary * $PF_Rate/ 100;
+ /** pf amount per day**/
+
+ //echo $totalothour;die;
+ $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentives;
+ $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount) - $Monthly_Due;
+ $employeeSalary []= round($salaryInCurrentday);
+
+
+
+}
+ $data['empSalary'] = $employeeSalary;
+
+ //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global,$data,NULL);
}
@@ -571,13 +733,18 @@ function phpAlert($msg) {
{
$ErrorFlag = 0;
- $EmpID = $j['Employee Id'];
- $Name = $j['Employee Name'];
+ $Emp = $j['Employee'];
+
+ $EmpID = substr($Emp,0,4);
+
+ //$Name = $j['Employee Name'];
+ //echo $EmpID; die;
+
$DaysWorked = $j['Days Worked'];
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
- $OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
- $Loan_Recovered = $j['Loan Recovered in ₹'];
+ $OT_Hrs_Worked = $j['OT Hrs'];
+ $Loan_Recovered = $j['Manual Loan Due ₹'];
$Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
@@ -673,13 +840,18 @@ function phpAlert($msg) {
{
foreach($json as $j)
{
- $EmpID = $j['Employee Id'];
- $Name = $j['Employee Name'];
+ $Emp = $j['Employee'];
+
+ $EmpID = substr($Emp,0,4);
+
+
+ //$Name = $j['Employee'];
+
$DaysWorked = $j['Days Worked'];
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
- $OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
- $Loan_Recovered = $j['Loan Recovered in ₹'];
+ $OT_Hrs_Worked = $j['OT Hrs'];
+ $Loan_Recovered = $j['Manual Loan Due ₹'];
if(is_string($Loan_Recovered))
{
$Loan_Recovered = strtoupper($Loan_Recovered);
@@ -1108,7 +1280,7 @@ function getEmployee()
$LOPDays = $sheet->getCell('D'.$x)->getValue();
$Paid_leave =$sheet->getCell('E'.$x)->getValue();
$OTHoursWorked =$sheet->getCell('F'.$x)->getValue();
- $loanRecovered=$sheet->getCell('G'.$x)->getValue();
+ $LoanRecovered=$sheet->getCell('G'.$x)->getValue();
if(is_string($loanRecovered))
{
$loanRecovered = strtoupper($loanRecovered);
diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php
index 7c277aca..5c7c005f 100755
--- a/application/models/monthlypay_model.php
+++ b/application/models/monthlypay_model.php
@@ -28,7 +28,7 @@ class monthlypay_model extends CI_Model
// $this->db->where('T_Employee_Details.DateofJoining <=',$lastdate);
// $this->db->where('Month_Year',$current);
- $sql="select T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.Loan_ID,T_Payroll.Key
+ $sql="select T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Payroll.Key
from T_Monthly_Pay_Inputs
left join T_Employee_Details on T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID and T_Employee_Details.DateofJoining <= ?
left join T_Payroll on T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID
@@ -79,7 +79,7 @@ class monthlypay_model extends CI_Model
//$monthyear_val = date('Y-m',strtotime($current));
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate;
- $sql = "select T_Emp_Pay_Data.EmpID,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_Payroll.Key from T_Emp_Pay_Data
+ $sql = "select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives,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_Payroll.Key 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 month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID
diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php
index d483f362..96b3910d 100755
--- a/application/views/monthlypayinputs.php
+++ b/application/views/monthlypayinputs.php
@@ -10,8 +10,8 @@
}
else{
$ex1 = $ex[0];
- }
- }
+ }
+ }
else{
$ex1 = $ex[0];
}
@@ -145,17 +145,23 @@ $('html').bind('keypress', function(e)