drive payslip merged : ps

This commit is contained in:
VE10-Sanjeev 2025-02-26 13:22:04 +00:00
parent b6ea64666d
commit 926c3ed2a9
15 changed files with 763 additions and 108 deletions

View File

@ -87,6 +87,7 @@ $routes->post('fetchDriverAttendanceDetails', 'Driver::fetchDriverAttendanceDeta
$routes->get('reActivateDriverAttendance', 'Driver::reActivateDriverAttendance'); $routes->get('reActivateDriverAttendance', 'Driver::reActivateDriverAttendance');
$routes->get('deleteDriverAttendance', 'Driver::deleteDriverAttendance'); $routes->get('deleteDriverAttendance', 'Driver::deleteDriverAttendance');
$routes->post('gatheredCustAndQty', 'Driver::gatheredCustAndQty'); $routes->post('gatheredCustAndQty', 'Driver::gatheredCustAndQty');
$routes->match(['GET', 'POST'], 'updateDieselAndShedValuesBasedonEmpID', 'Driver::updateDieselAndShedValuesBasedonEmpID');
// Driver Monthly Pay Inputs Routes // Driver Monthly Pay Inputs Routes
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverMonthlyPayInputs', 'Driver::driverMonthlyPayInputs'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverMonthlyPayInputs', 'Driver::driverMonthlyPayInputs');
$routes->post('saveMonthlyData', 'Driver::saveMonthlyData'); $routes->post('saveMonthlyData', 'Driver::saveMonthlyData');

View File

@ -150,16 +150,36 @@ class Driver extends BaseController
$to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month-$year"); $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month-$year");
$indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month-$year"); $indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month-$year");
$amount = $this->driver_model->getDriverAttendanceTable($input_driver_id,"$year-$month");
$data['driver_attendance_list'] = $this->driver_model->useDriverAttendanceTable()->getDriverAttendanceList($input_driver_id,$from_mysql_date,$to_mysql_date); $data['driver_attendance_list'] = $this->driver_model->useDriverAttendanceTable()->getDriverAttendanceList($input_driver_id,$from_mysql_date,$to_mysql_date);
$data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id); $data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id,0);
$data['invoice_info'] = $this->driver_model->getInvoiceInfo(); $data['invoice_info'] = $this->driver_model->getInvoiceInfo();
$data['datefordropdown'] = $input_date; $data['datefordropdown'] = $input_date;
$data['gobal_driver_id'] = $input_driver_id; $data['gobal_driver_id'] = $input_driver_id;
$data['gobal_diesel_amount'] = isset($amount->diesel_amount) ? $amount->diesel_amount : 0 ;
$data['gobal_shed_amount'] = isset($amount->shed_amount) ? $amount->shed_amount : 0 ;
$this->global['pageTitle'] = 'Driver Attendance List'; $this->global['pageTitle'] = 'Driver Attendance List';
$this->loadViews("driverAttendance", $this->global, $data, NULL); $this->loadViews("driverAttendance", $this->global, $data, NULL);
} }
public function updateDieselAndShedValuesBasedonEmpID(){
$arr = $this->request->getPost();
$userId = $this->session->get('userId');
$to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m',$arr['date']);
$update_arr = ['driver_id' =>$arr['empid'],$arr['column'] =>$arr['value'],'updated_by' => $userId];
$where_arr = ['DATE_FORMAT(t_driver_attendance.date, "%Y-%m")' =>$to_mysql_date,'t_driver_attendance.driver_id' =>$arr['empid']];
$data = $this->driver_model->updateDieselAndShedValuesBasedonEmpID($where_arr,$update_arr);
return $data;
// [column] => shed_amount
// [value] => 400
// [date] => 21-02-2025
// [empid] => RIPL136
}
public function fetchDriverAttendanceDetails(){ public function fetchDriverAttendanceDetails(){
$userId = $this->session->get('userId'); $userId = $this->session->get('userId');
@ -385,7 +405,7 @@ class Driver extends BaseController
{ {
$PayOn = $this->request->getPost('payon'); $PayOn = $this->request->getPost('payon');
$Driver = $this->request->getPost('driver'); $Driver = $this->request->getPost('employee');
$res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn); $res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn);
@ -394,13 +414,9 @@ class Driver extends BaseController
$data = [ $data = [
'PayOn' => $result->month_year, 'PayOn' => $result->month_year,
'driver_id' => $result->driver_id, 'driver_id' => $result->driver_id,
'driver_name' => $result->driver_name,
'no_of_loads' => $result->no_of_loads, 'no_of_loads' => $result->no_of_loads,
'driver_monthly_salary_amount' => $result->driver_monthly_salary_amount, 'driver_monthly_salary_amount' => $result->driver_monthly_salary_amount,
'driver_monthly_food_amount' => $result->driver_monthly_food_amount,
'driver_earnings_amount' => $result->driver_earnings_amount, 'driver_earnings_amount' => $result->driver_earnings_amount,
'diesel' => $result->diesel,
'shed_duty_amount' => $result->shed_duty_amount,
'driver_final_payment' => $result->driver_final_payment, 'driver_final_payment' => $result->driver_final_payment,
'created_by' => $this->session->get('userId') 'created_by' => $this->session->get('userId')
]; ];

View File

@ -10,6 +10,7 @@ use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Monthlypay_model; use App\Models\Monthlypay_model;
use App\Models\Payroll_model; use App\Models\Payroll_model;
use App\Models\Driver_model;
use Mpdf\Mpdf; use Mpdf\Mpdf;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
@ -33,6 +34,7 @@ class Payslip extends BaseController
{ {
protected $payroll_model; protected $payroll_model;
protected $monthlypay_model; protected $monthlypay_model;
protected $driver_model;
protected $session; protected $session;
/** /**
@ -43,6 +45,7 @@ class Payslip extends BaseController
parent::__construct(); parent::__construct();
$this->payroll_model = new Payroll_model(); $this->payroll_model = new Payroll_model();
$this->monthlypay_model = new Monthlypay_model(); $this->monthlypay_model = new Monthlypay_model();
$this->driver_model = new Driver_model();
$this->session = session(); $this->session = session();
helper('form'); //$this->load->library('form_validation'); helper('form'); //$this->load->library('form_validation');
$this->isLoggedIn(); $this->isLoggedIn();
@ -596,14 +599,15 @@ class Payslip extends BaseController
$data['month'] = $this->monthlypay_model->monthlyListing($current); $data['month'] = $this->monthlypay_model->monthlyListing($current);
$data['dropdownvalue'] = $current; $data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
// dd($data['fresh']);
$data['drivermonthinputs'] = $this->driverMonthlyPayInputs($current);
$employeeSalary = []; $employeeSalary = [];
$esi = []; $esi = [];
$pf = []; $pf = [];
$ot = []; $ot = [];
foreach ($data['fresh'] as $value) { foreach ($data['fresh'] as $value) {
$is_driver = $value->is_driver;
$NoofDays = $value->NoofDays; //Month day 30,31,28 $NoofDays = $value->NoofDays; //Month day 30,31,28
$HRA_Amount = $value->HRA_Amount; $HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay; $Basic_Pay = $value->Basic_Pay;
@ -722,6 +726,78 @@ class Payslip extends BaseController
$this->loadViews("monthlypayinputs", $this->global, $data, NULL); $this->loadViews("monthlypayinputs", $this->global, $data, NULL);
} }
public function driverMonthlyPayInputs($current)
{
list($month, $year) = explode('-', $current);
$month_in_number = get_date_time_dynamical_format('n','m',"$month");// refer helper
$get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year);
$from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year");
$to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year");
// $data['monthinputs']
$load_driver_data = $this->driver_model->driverAttendanceForMonthlyPayInputs($from_mysql_date,$to_mysql_date);
// dd($load_driver_data);
$format_month_year = get_date_time_dynamical_format('n-Y','m-Y',"$current");
$monthly_pay_data = $this->driver_model->driverMonthlyPayInputs($format_month_year);
// both foreach refer with chatgpt array data replacement....
$monthly_pay_array = [];
foreach ($monthly_pay_data as $row) {
$monthly_pay_array[$row->driver_id] = $row;
}
for ($i = 0; $i < count((array)$load_driver_data); $i++) {
$driver_id = $load_driver_data[$i]->driver_id;
if (isset($monthly_pay_array[$driver_id])) {
$PF_Rate = $load_driver_data[$i]->PF_Rate;
$ESI_Rate = $load_driver_data[$i]->ESI_Rate;
$basic = isset($load_driver_data[$i]->driver_earnings_amount) ? (int)$load_driver_data[$i]->driver_earnings_amount + (int)$load_driver_data[$i]->shed_amount+(int)$load_driver_data[$i]->diesel_amount : 0;
$load_driver_data[$i]->driver_basic = $basic;
$load_driver_data[$i]->driver_earnings_amount = $monthly_pay_array[$driver_id]->driver_earnings_amount;
// $load_driver_data[$i]->diesel = $monthly_pay_array[$driver_id]->diesel;
// $load_driver_data[$i]->shed_duty_amount = $monthly_pay_array[$driver_id]->shed_duty_amount;
$load_driver_data[$i]->driver_final_payment = $monthly_pay_array[$driver_id]->driver_final_payment;
$load_driver_data[$i]->payroll_id = $monthly_pay_array[$driver_id]->payroll_id;
$load_driver_data[$i]->Festival_Bonus = $monthly_pay_array[$driver_id]->Festival_Bonus;
$load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? $basic * $ESI_Rate / 100 : 0;
$load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? $basic * $PF_Rate / 100 : 0;
$load_driver_data[$i]->basic_worked = $basic * 30 / 100;
$load_driver_data[$i]->hra_worked = $basic * 70 / 100;
}else {
$PF_Rate = $load_driver_data[$i]->PF_Rate;
$ESI_Rate = $load_driver_data[$i]->ESI_Rate;
$basic = isset($load_driver_data[$i]->driver_earnings_amount) ? (int)$load_driver_data[$i]->driver_earnings_amount + (int)$load_driver_data[$i]->shed_amount+(int)$load_driver_data[$i]->diesel_amount : 0;
$load_driver_data[$i]->driver_basic = $basic;
$load_driver_data[$i]->driver_earnings_amount = $load_driver_data[$i]->driver_earnings_amount;
$load_driver_data[$i]->driver_final_payment = $basic;
$load_driver_data[$i]->payroll_id = '';
$load_driver_data[$i]->Festival_Bonus = 0;
$load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? $basic * $ESI_Rate / 100 : 0;
$load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? $basic * $PF_Rate / 100 : 0;
$load_driver_data[$i]->basic_worked = $basic * 30 / 100;
$load_driver_data[$i]->hra_worked = $basic * 70 / 100;
}
}
// dd($load_driver_data);
return $load_driver_data;
}
function changeMonth() function changeMonth()
{ {
@ -857,6 +933,11 @@ class Payslip extends BaseController
$data['esi'] = $esi; $data['esi'] = $esi;
$data['pf'] = $pf; $data['pf'] = $pf;
$data['over_time'] = $ot; $data['over_time'] = $ot;
// dd($data); // dd($data);
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Payroll Monthly Inputs'; $this->global['pageTitle'] = 'Payroll Monthly Inputs';
@ -1002,6 +1083,7 @@ class Payslip extends BaseController
$EmpID = $j['Emp ID']; $EmpID = $j['Emp ID'];
$is_driver = $this->driver_model->getDriverName($EmpID,1);
$DaysWorked = $j['Days Worked']; $DaysWorked = $j['Days Worked'];
$TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ; $TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ;
$ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ; $ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ;
@ -1022,6 +1104,18 @@ class Payslip extends BaseController
$Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00; $Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00;
$Created_By = $this->session->get('userId'); $Created_By = $this->session->get('userId');
$ID = $EmpID ;
$LOAD = $DaysWorked;
$SALARY = $Basic ;
$TOTAL = $Basic ;
$DIESEL = $Festival_Bonus ;
$GRAND = $Estimate;
$CREATED = $this->session->get('userId');
$UPDATED = $this->session->get('userId');
if($is_driver == 0){
$monthlypaydata = array( $monthlypaydata = array(
'Month_Year' => $month, 'Month_Year' => $month,
'EmpID' => $EmpID, 'EmpID' => $EmpID,
@ -1046,6 +1140,26 @@ class Payslip extends BaseController
); );
// print_r($monthlypaydata); die; // print_r($monthlypaydata); die;
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
}else{
$CREATED = $this->session->get('userId');
$UPDATED = $this->session->get('userId');
$drivermonthlypaydata = array(
'month_year' => $month,
'driver_id' =>$EmpID,
'no_of_loads' =>(strpos($TotalCalDays, "(trip)") !== false) ? explode(" ", $TotalCalDays)[0] : 0,
'driver_monthly_salary_amount' => $WorkedSalary,
'Festival_Bonus' => $Festival_Bonus,
'driver_final_payment' =>$Estimate,
'created_by'=>$CREATED,
'updated_by'=>$UPDATED
);
$result = $this->driver_model->saveMonthlyData($drivermonthlypaydata);
}
$total = $total + $result; $total = $total + $result;
} }
} }
@ -1091,6 +1205,7 @@ class Payslip extends BaseController
public function viewGenerator() public function viewGenerator()
{ {
$Data['Payon'] = $this->payroll_model->getPayOn(); $Data['Payon'] = $this->payroll_model->getPayOn();
$this->global['pageTitle'] = 'Payroll Generater'; $this->global['pageTitle'] = 'Payroll Generater';
@ -1112,7 +1227,11 @@ class Payslip extends BaseController
{ {
$id = $this->request->getPost('id1'); $id = $this->request->getPost('id1');
$result = $this->payroll_model->getEmployeelist2($id); $employee = $this->payroll_model->getEmployeelist2($id);
$driver = $this->driver_model->getDriverlist2($id);
$result = array_merge($employee, $driver);
$HTML = ""; $HTML = "";
@ -1120,8 +1239,7 @@ class Payslip extends BaseController
foreach ($result as $list) { foreach ($result as $list) {
$HTML .= "<option value='" . $list->EmpId . "'>" . $list->EmpId . "-" . $list->FullName . "</option>";
$HTML .= "<option value='" . $list->EmpId . "'>" . $list->EmpId . "-" . $list->Fname . "</option>";
} }
} }
echo $HTML; echo $HTML;
@ -1196,6 +1314,24 @@ class Payslip extends BaseController
} }
} else { } else {
$EmpID = $this->request->getPost('Employee'); $EmpID = $this->request->getPost('Employee');
$is_driver = $this->driver_model->getDriverName($EmpID,1);
if($is_driver == "1"){
$Data['PayDetails'] = $this->driver_model->GetPayslipdata($Payon, $EmpID);
$name = $Data['PayDetails'][0]->driver_name;
$filename = 'PayslipFor-' . $EmpID . ' ' . $name . ' ' . $m . ' ' . $y;
$totalsalary = $Data['PayDetails'][0]->driver_final_payment;
$totalsalaryinwords = $this->convertNumberToWords(round($totalsalary));
$Data['amtinwords'] = $totalsalaryinwords;
$currentDayBasic = isset($Data['PayDetails'][0]->driver_monthly_salary_amount) ? $Data['PayDetails'][0]->driver_monthly_salary_amount : 0;
$PF_Rate = $Data['PayDetails'][0]->PF_Rate;
$ESI_Rate = $Data['PayDetails'][0]->ESI_Rate;
$Data['esi_amount'] = ($Data['PayDetails'][0]->esi_applicable == 1) ? $currentDayBasic * $ESI_Rate / 100 : 0;
$Data['pf_amount'] = ($Data['PayDetails'][0]->pf_applicable == 1) ? $currentDayBasic * $PF_Rate / 100 : 0;
$html = view("driverPayslipGeneratePrint", $Data);
}else{
//echo "EmpID" . $EmpID; //echo "EmpID" . $EmpID;
$Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon, $EmpID); $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon, $EmpID);
@ -1211,6 +1347,8 @@ class Payslip extends BaseController
$html = view("payslipgenerateprint", $Data); $html = view("payslipgenerateprint", $Data);
} }
}
$mpdf = new Mpdf([ $mpdf = new Mpdf([
'mode' => 'utf-8', 'mode' => 'utf-8',
@ -1530,11 +1668,25 @@ class Payslip extends BaseController
{ {
$empid = $this->request->getPost('employee'); $empid = $this->request->getPost('employee');
$payon = $this->request->getPost('payon'); $payon = $this->request->getPost('payon');
$is_driver = $this->driver_model->getDriverName($empid,1);
if($is_driver){
$result = $this->driver_model->checkDriverExistPay($empid, $payon);
$data['count'] = count($result);
$data['path'] = "driverPayslip";
echo json_encode($data);
}else{
$result = $this->payroll_model->checkExistPayData($empid, $payon); $result = $this->payroll_model->checkExistPayData($empid, $payon);
echo json_encode(count($result)); $data['count'] = count($result);
$data['path'] = "payslip/callsp";
echo json_encode($data);
} }
}
function convertNumber($amt) function convertNumber($amt)
{ {

View File

@ -21,7 +21,7 @@ class Driver_model extends Model
{ {
$this->table = 't_driver_attendance'; $this->table = 't_driver_attendance';
$this->primaryKey = 'driver_attendance_id'; $this->primaryKey = 'driver_attendance_id';
$this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive']; $this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive','diesel_amount','shed_amount'];
return $this; return $this;
} }
@ -72,18 +72,25 @@ class Driver_model extends Model
return $query->getResult(); return $query->getResult();
} }
function getDriverName($id) function getDriverName($id,$flag)
{ {
$builder = $this->db->table('t_employee_details') $builder = $this->db->table('t_employee_details')
->select('CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) as driver_name') ->select('CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) as driver_name,is_driver')
->where('EmpID', $id); ->where('EmpID', $id);
$query = $builder->get()->getRow(); $query = $builder->get()->getRow();
if ($flag == 0){
$driver_name = $query ? $query->driver_name : null; $driver_name = $query ? $query->driver_name : null;
return $driver_name; return $driver_name;
} }
if ($flag == 1){
$is_driver = $query ? $query->is_driver : null;
return $is_driver;
}
return null;
}
function gatheredCustAndQty($invoice){ function gatheredCustAndQty($invoice){
$builder = $this->db->table('ip_invoices') $builder = $this->db->table('ip_invoices')
@ -94,19 +101,27 @@ class Driver_model extends Model
return $query->getRowArray() ?: []; return $query->getRowArray() ?: [];
} }
function driverAttendanceForMonthlyPayInputs($from,$to){ function driverAttendanceForMonthlyPayInputs($from,$to){
$builder = $this->db->table('t_driver_attendance') $builder = $this->db->table('t_driver_attendance')
->select('t_driver_attendance.driver_id,SUM(t_driver_attendance.salary_amount) as driver_monthly_salary_amount,SUM(t_driver_attendance.food_amount) as driver_monthly_food_amount,t_driver.driver_name, ->select('t_driver_attendance.driver_id,driver_details.FirstName as driver_name,driver_details.is_driver,
DATE_FORMAT(date, "%M-%Y") AS month_year,SUM(salary_amount + food_amount) AS driver_earnings_amount,COUNT(t_driver_attendance.load_type) AS no_of_loads') DATE_FORMAT(date, "%M-%Y") AS month_year,COUNT(t_driver_attendance.load_type) AS no_of_loads,driver_details.*,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate')
->join('t_driver', 't_driver.driver_id = t_driver_attendance.driver_id and t_driver.isactive = 1', 'left') ->select('SUM(t_driver_attendance.salary_amount) as driver_monthly_salary_amount,
SUM(t_driver_attendance.food_amount) as driver_monthly_food_amount,
SUM(salary_amount + food_amount) AS driver_earnings_amount,
diesel_amount,shed_amount,CONCAT_WS(" ", driver_details.FirstName, driver_details.LastName) AS FullName')
->join('t_employee_details as driver_details', 'driver_details.EmpID = t_driver_attendance.driver_id', 'left')
->join('t_emp_pay_data','t_emp_pay_data.EmpID=driver_details.EmpID','Left')
->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"') ->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"')
->groupBy('t_driver.driver_id, DATE_FORMAT(t_driver_attendance.date, "%M-%Y")'); ->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y")');
$query = $builder->get(); $query = $builder->get();
// $last_query = $this->db->getLastQuery();
// echo $last_query;die;
return $query->getResult(); return $query->getResult();
} }
function driverMonthlyPayInputs($monthYear){ function driverMonthlyPayInputs($monthYear){
$builder = $this->db->table('t_driver_monthly_pay_inputs'); $builder = $this->db->table('t_driver_monthly_pay_inputs');
@ -143,13 +158,13 @@ class Driver_model extends Model
if ($count == 0) { if ($count == 0) {
unset($data['updated_by']); unset($data['updated_by']);// we need createdby. thats why updatedby unset
$builder = $this->db->table('t_driver_monthly_pay_inputs'); $builder = $this->db->table('t_driver_monthly_pay_inputs');
$builder->insert($data); $builder->insert($data);
$i = $this->db->affectedRows(); $i = $this->db->affectedRows();
return $i; return $i;
} elseif ($count == 1) { } elseif ($count == 1) {
unset($data['created_by']); unset($data['created_by']); // we need updatedby. thats why createdby unset
$this->db->table('t_driver_monthly_pay_inputs') $this->db->table('t_driver_monthly_pay_inputs')
->where('driver_id', $data['driver_id']) ->where('driver_id', $data['driver_id'])
->where('month_year', $data['month_year']) ->where('month_year', $data['month_year'])
@ -159,7 +174,21 @@ class Driver_model extends Model
return $i; return $i;
} }
} }
function updateDieselAndShedValuesBasedonEmpID($where_arr,$data){
$this->db->table('t_driver_attendance')
->where($where_arr)
->update($data);
$i = $this->db->affectedRows();
return $i;
}
public function getDriverAttendanceTable($input_driver_id,$monthyear){
$builder = $this->db->table('t_driver_attendance')
->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear)
->where('t_driver_attendance.driver_id',$input_driver_id);
$query = $builder->get()->getRow();
// $last_query = $this->db->getLastQuery();
return $query;
}
function getPayOn() function getPayOn()
{ {
$builder = $this->db->table('t_driver_monthly_pay_inputs') $builder = $this->db->table('t_driver_monthly_pay_inputs')
@ -172,8 +201,8 @@ class Driver_model extends Model
function getDriverlist2($Payon = '') function getDriverlist2($Payon = '')
{ {
$builder = $this->db->table('t_driver_monthly_pay_inputs Pay') $builder = $this->db->table('t_driver_monthly_pay_inputs Pay')
->select('Pay.driver_id as driver_id,driver.driver_name as name') ->select('Pay.driver_id,driver.EmpID as EmpId,CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName')
->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); ->join('t_employee_details as driver', 'driver.EmpID = Pay.driver_id and driver.is_driver = 1', 'left');
if ($Payon != '') { if ($Payon != '') {
$builder->where('Pay.month_year', $Payon); $builder->where('Pay.month_year', $Payon);
} }
@ -197,7 +226,8 @@ class Driver_model extends Model
function getMonthlyPayDetails($driver_id, $PayOn) function getMonthlyPayDetails($driver_id, $PayOn)
{ {
$builder = $this->db->table('t_driver_monthly_pay_inputs MonthlyPay ') $builder = $this->db->table('t_driver_monthly_pay_inputs MonthlyPay ')
->select('MonthlyPay.*') ->select('MonthlyPay.*,driver.EmpID as EmpId,CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName')
->join('t_employee_details as driver', 'driver.EmpID = MonthlyPay.driver_id and driver.is_driver = 1', 'left')
->where('MonthlyPay.driver_id', $driver_id) ->where('MonthlyPay.driver_id', $driver_id)
->where('MonthlyPay.month_year', $PayOn); ->where('MonthlyPay.month_year', $PayOn);
@ -231,8 +261,14 @@ class Driver_model extends Model
function GetPayslipdata($PayOn = '', $EmpId = '') function GetPayslipdata($PayOn = '', $EmpId = '')
{ {
//echo "FROM MODEL" . $PayOn . $EmpId; //echo "FROM MODEL" . $PayOn . $EmpId;
$builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*,driver.driver_name as name ') $builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*')
->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); ->select('Emp.EmpID,CONCAT_WS(" ", Emp.FirstName, Emp.LastName) as driver_name,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.BankAccountNo as BankAccountNumber,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.AadharNo,Emp.Designation as Designation,Dep.DepartmentName as DeptName,Emp.esi_applicable,Emp.pf_applicable')
->select('att.diesel_amount , att.shed_amount,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,month.Festival_Bonus')
->join('t_employee_details Emp', 'Pay.driver_id = Emp.EmpID')
->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode')
->join('t_emp_pay_data','t_emp_pay_data.EmpID=Emp.EmpID','Left')
->join('t_driver_attendance att', 'att.driver_id = Emp.EmpID')
->join('t_driver_monthly_pay_inputs month', 'month.driver_id = Emp.EmpID');
if ($PayOn != '') { if ($PayOn != '') {
$builder->where('Pay.PayOn', $PayOn); $builder->where('Pay.PayOn', $PayOn);
} }

View File

@ -39,12 +39,12 @@ class Monthlypay_model extends Model
// $this->db->where('t_employee_details.DateofJoining <=',$lastdate); // $this->db->where('t_employee_details.DateofJoining <=',$lastdate);
// $this->db->where('Month_Year',$current); // $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_loan_master.Monthly_Due,t_payroll.Id $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.Id,t_employee_details.is_driver
from t_monthly_pay_inputs 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_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 left join t_payroll on t_monthly_pay_inputs.EmpID=t_payroll.EmpID
left join t_loan_master on t_monthly_pay_inputs.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1 left join t_loan_master on t_monthly_pay_inputs.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1
where Month_Year = ? where t_employee_details.is_driver = 0 and Month_Year = ?
order by t_employee_details.EmpID asc"; order by t_employee_details.EmpID asc";
$query = $this->db->query($sql, array($lastdate, $current)); $query = $this->db->query($sql, array($lastdate, $current));
@ -64,7 +64,7 @@ class Monthlypay_model extends Model
//$monthyear_val = date('Y-m',strtotime($current)); //$monthyear_val = date('Y-m',strtotime($current));
$lastdate = $year_val . '-' . $month_val . '-' . $date_val; $lastdate = $year_val . '-' . $month_val . '-' . $date_val;
$builder = $this->db->table('t_employee_details') $builder = $this->db->table('t_employee_details')
->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining') ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.is_driver')
//->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left') //->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left')
->where('t_employee_details.IsActive', 1) ->where('t_employee_details.IsActive', 1)
->where('t_employee_details.DateofJoining <=', $lastdate) ->where('t_employee_details.DateofJoining <=', $lastdate)
@ -100,7 +100,7 @@ class Monthlypay_model extends Model
//echo $lastdate; //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(?) //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.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,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_attendance.sunday_count,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.Id,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.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,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_attendance.sunday_count,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.Id,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,t_employee_details.is_driver
from t_emp_pay_data from t_emp_pay_data
left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID 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 = ? left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ?
@ -110,6 +110,7 @@ class Monthlypay_model extends Model
left join t_loan_history on t_loan_history .Loan_ID = t_loan_master.Loan_ID left join t_loan_history on t_loan_history .Loan_ID = t_loan_master.Loan_ID
where t_employee_details.DateofJoining <= ? where t_employee_details.DateofJoining <= ?
and month(t_attendance.Month_Year) = month(?) and year(t_attendance.Month_Year) = year(?) and month(t_attendance.Month_Year) = month(?) and year(t_attendance.Month_Year) = year(?)
and t_employee_details.is_driver = 0
order by t_employee_details.EmpID"; order by t_employee_details.EmpID";
$query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current)); $query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current));

View File

@ -331,9 +331,10 @@ class Payroll_model extends Model
function getEmployeelist2($Payon = '') function getEmployeelist2($Payon = '')
{ {
// CONCAT_WS(' ', Emp.FirstName, Emp.LastName)
$builder = $this->db->table('t_monthly_pay_inputs Pay') $builder = $this->db->table('t_monthly_pay_inputs Pay')
->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname') ->select('Pay.EmpID as EmpId,CONCAT_WS(" ",Emp.FirstName,Emp.LastName) AS FullName')
->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID'); ->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID and Emp.is_driver = 0');
if ($Payon != '') { if ($Payon != '') {
$builder->where('Pay.Month_Year', $Payon); $builder->where('Pay.Month_Year', $Payon);
} }

View File

@ -93,6 +93,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th>Vehicle Number</th> <th>Vehicle Number</th>
<th>Salary Amount</th> <th>Salary Amount</th>
<th>Food Amount</th> <th>Food Amount</th>
<th>Total</th>
<th>Load Type</th> <th>Load Type</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
@ -118,6 +119,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<td><?= esc($record['vehicle_number']) ?></td> <td><?= esc($record['vehicle_number']) ?></td>
<td><?= esc($record['salary_amount']) ?></td> <td><?= esc($record['salary_amount']) ?></td>
<td><?= esc($record['food_amount']) ?></td> <td><?= esc($record['food_amount']) ?></td>
<td><?= esc($record['salary_amount']+$record['food_amount']) ?></td>
<td><?= esc($record['load_type']) ?></td> <td><?= esc($record['load_type']) ?></td>
<td><?php if($record['payroll_id'] == ''){ ?> <td><?php if($record['payroll_id'] == ''){ ?>
<a data-toggle="modal" href="#attendanceModal" data-arr='<?php echo json_encode($record); ?>' data-id='<?= esc($record['driver_attendance_id']) ?>'> <a data-toggle="modal" href="#attendanceModal" data-arr='<?php echo json_encode($record); ?>' data-id='<?= esc($record['driver_attendance_id']) ?>'>
@ -134,6 +136,64 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php } ?> <?php } ?>
<?php endif; ?> <?php endif; ?>
</tbody> </tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Salary Amount</th>
<th></th>
<th></th>
<th></th>
<th id="rowTotalAmount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Diesel</th>
<th><input type="text" class="editable" data-column="diesel_amount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Shed Amount</th>
<th><input type="text" class="editable" data-column="shed_amount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Total</th>
<th id="totalAmount">-</th>
<th></th>
<th></th>
</tr>
</tfoot>
</table> </table>
</div> </div>
@ -303,6 +363,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#gobal_driver_id").val("<?php echo $gobal_driver_id; ?>"); $("#gobal_driver_id").val("<?php echo $gobal_driver_id; ?>");
$("#driver_id").val("<?php echo $gobal_driver_id; ?>"); $("#driver_id").val("<?php echo $gobal_driver_id; ?>");
} }
let gobal_diesel_amount = "<?php echo $gobal_diesel_amount; ?>";
let gobal_shed_amount = "<?php echo $gobal_shed_amount; ?>";
if(gobal_diesel_amount != '' || gobal_shed_amount != ''){
$('input[data-column="diesel_amount"]').val(parseFloat(gobal_diesel_amount) || 0);
$('input[data-column="shed_amount"]').val(parseFloat(gobal_shed_amount) || 0);
calculateTotal();
}
@ -430,8 +498,88 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
next: '<i class="fas fa-angle-right"></i>', // Next button icon next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
} }
},
footerCallback: function (row, data, start, end, display) {
var api = this.api();
var isTableEmpty = api.data().length === 0;
// Hide or show the tfoot based on whether the table is empty
if (isTableEmpty) {
$(this).find('tfoot').hide(); // Hide tfoot if the table is empty
} else {
$(this).find('tfoot').show(); // Show tfoot if the table has data
}
var api = this.api();
var columnIndex = 7;
var sum = api
.column(columnIndex, { page: 'current' })
.data()
.reduce(function (a, b) {
return a + parseFloat(b.replace(/[^\d.-]/g, ''));
}, 0);
$(api.column(columnIndex).footer()).html(sum);
var api = this.api();
var columnIndex = 8;
var sum = api
.column(columnIndex, { page: 'current' })
.data()
.reduce(function (a, b) {
return a + parseFloat(b.replace(/[^\d.-]/g, ''));
}, 0);
$(api.column(columnIndex).footer()).html(sum);
var api = this.api();
var columnIndex = 9;
var sum = api
.column(columnIndex, { page: 'current' })
.data()
.reduce(function (a, b) {
return a + parseFloat(b.replace(/[^\d.-]/g, ''));
}, 0);
$(api.column(columnIndex).footer()).html(sum);
} }
}); });
// Function to calculate the total
function calculateTotal() {
var diesel = parseFloat($('input[data-column="diesel_amount"]').val()) || 0;
var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0;
var row = parseInt($('#rowTotalAmount').text()) || 0;
console.log(row);
var total = row + diesel + shed;
$('#totalAmount').text(total); // Display the total with 2 decimal places
}
// Make the cells editable and calculate the total on input change
$(document).on('input', '.editable', function() {
calculateTotal();
});
$(document).on('blur', '.editable', function() {
var column = $(this).data('column'); // Get the column name (diesel or shed)
var value = $(this).val(); // Get the updated value
let gobal_driver_id = urlParams.get("gobal_driver_id");
let gobal_date = urlParams.get("date");
// Send data to the server using AJAX
$.ajax({
url: "<?php echo base_url(); ?>updateDieselAndShedValuesBasedonEmpID",
method: 'POST',
data: {
column: column,
value: value,
date: gobal_date,
empid:gobal_driver_id
},
success: function(response) {
console.log('Data saved successfully:', response);
},
error: function(xhr, status, error) {
console.error('Error saving data:', error);
}
});
});
// Initial calculation of the total
calculateTotal();
}); });
</script> </script>

View File

@ -63,9 +63,7 @@
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp; <i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a> </a>
<?php $today = date('M-Y'); ?> <?php $today = date('M-Y'); ?>
<a title="Trip Details" style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?gobal_driver_id=' . $record['driver_id'].'&month_year='.$today; ?>">
<i class="fa fa-truck"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -70,12 +70,12 @@ td {
.th-requestedQuantity{ .th-requestedQuantity{
text-align:center !important; text-align:right !important;
width:15%; width:15%;
} }
.th-PoQuantity{ .th-PoQuantity{
text-align:center !important; text-align:right !important;
width:15%; width:15%;
} }
@ -85,7 +85,7 @@ td {
} }
.th-uom{ .th-uom{
text-align:center !important; text-align:left !important;
width:10%; width:10%;
} }
@ -226,9 +226,9 @@ td {
<input type="hidden" name="<?php echo 'te' . $index ?>" id="<?php echo 'tes' . $index ?>" value="<?php echo $record->Quantity; ?>" /> <input type="hidden" name="<?php echo 'te' . $index ?>" id="<?php echo 'tes' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<td align="center"><?php echo $record->MaterialCode; ?></td> <td align="center"><?php echo $record->MaterialCode; ?></td>
<td align="left"><?php echo $record->MaterialName; ?></td> <td align="left"><?php echo $record->MaterialName; ?></td>
<td align="center"><?php echo $record->UOM; ?></td> <td align="left"><?php echo $record->UOM; ?></td>
<td align="center"><?php echo $record->Quantity; ?></td> <td align="right"><?php echo $record->Quantity; ?></td>
<td align="center"><?php echo $record->POQTY; ?></td> <td align="right"><?php echo $record->POQTY; ?></td>
<td align="center"><?php echo $record->StatusName; ?></td> <td align="center"><?php echo $record->StatusName; ?></td>
<input type="hidden" name="<?php echo 'materialdesc' . $index ?>" id="<?php echo 'materialdesc' . $index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : ''; ?>" /> <input type="hidden" name="<?php echo 'materialdesc' . $index ?>" id="<?php echo 'materialdesc' . $index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : ''; ?>" />
<td> <td>
@ -818,9 +818,9 @@ td {
<td align="center">${temp}</td> <td align="center">${temp}</td>
<td align="center">${materialCode}</td> <td align="center">${materialCode}</td>
<td align="left">${materialName}</td> <td align="left">${materialName}</td>
<td align="center">${uom}</td> <td align="left">${uom}</td>
<td align="center">${quantity}</td> <td align="right">${quantity}</td>
<td align="center">0.00</td> <td align="right">0.00</td>
<td align="center">NEW</td> <td align="center">NEW</td>
<td> <td>
<a data-id="${temp}" data-userid="${temp}" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal"> <a data-id="${temp}" data-userid="${temp}" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal">

View File

@ -764,13 +764,13 @@
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-hr"> <div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>employeeListing" class="dropdown-item"><i class="ri-shield-user-line align-middle mr-1"></i> Employee Details</a> <a href="<?php echo base_url(); ?>employeeListing" class="dropdown-item"><i class="ri-shield-user-line align-middle mr-1"></i> Employee Details</a>
<a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Details</a> <!-- <a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Details</a> -->
<a href="<?php echo base_url(); ?>attendance" class="dropdown-item"><i class=" ri-time-line align-middle mr-1"></i> Attendance</a> <a href="<?php echo base_url(); ?>attendance" class="dropdown-item"><i class=" ri-time-line align-middle mr-1"></i> Attendance</a>
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip" <a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-secure-payment-line align-middle mr-1"></i> Employee PaySlip <div class="arrow-down"></div> <i class="ri-secure-payment-line align-middle mr-1"></i> PaySlip <div class="arrow-down"></div>
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-payslip"> <div class="dropdown-menu" aria-labelledby="topnav-payslip">
<a href="<?php echo base_url(); ?>monthlypay" class="dropdown-item">Monthly Pay Information </a> <a href="<?php echo base_url(); ?>monthlypay" class="dropdown-item">Monthly Pay Information </a>
@ -781,7 +781,7 @@
</div> </div>
</div> </div>
<div class="dropdown"> <!-- <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip" <a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-secure-payment-line align-middle mr-1"></i> Driver PaySlip <div class="arrow-down"></div> <i class="ri-secure-payment-line align-middle mr-1"></i> Driver PaySlip <div class="arrow-down"></div>
@ -790,7 +790,7 @@
<a href="<?php echo base_url(); ?>driverMonthlyPayInputs" class="dropdown-item">Monthly Pay Information </a> <a href="<?php echo base_url(); ?>driverMonthlyPayInputs" class="dropdown-item">Monthly Pay Information </a>
<a href="<?php echo base_url(); ?>driverViewPay" class="dropdown-item">PaySlip Generator</a> <a href="<?php echo base_url(); ?>driverViewPay" class="dropdown-item">PaySlip Generator</a>
</div> </div>
</div> </div> -->
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave" <a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"

View File

@ -264,8 +264,6 @@
if (!empty($sample)) { if (!empty($sample)) {
$index = 0;
$i = 0; $i = 0;
foreach ($sample as $i => $record) { foreach ($sample as $i => $record) {
@ -353,7 +351,7 @@
} ?> } ?>
</td> </td>
<td style="max-width:80px;text-align:right;"><?php echo $record->TotalSalary; ?></td> <td id="ttlsalary<?php echo $index ?>" style="max-width:80px;text-align:right;"><?php echo $record->TotalSalary; ?></td>
<td style="max-width:80px;text-align:right;"> <td style="max-width:80px;text-align:right;">
<?php $perDaySalary = $record->TotalSalary / $record->NoofDays; <?php $perDaySalary = $record->TotalSalary / $record->NoofDays;
@ -496,7 +494,8 @@
<input type="hidden" id="duedate<?php echo $index ?>" <input type="hidden" id="duedate<?php echo $index ?>"
value="<?php echo $record->DueDate ?>"> value="<?php echo $record->DueDate ?>">
<input type="hidden" id="is_driver<?php echo $index ?>"
value="<?php echo $record->is_driver ?>">
@ -508,9 +507,146 @@
} }
} }
} }
$inx = $index;
if(!empty($drivermonthinputs)){
foreach ($drivermonthinputs as $i => $record) {
$inx++;
$salary_amount = ($record->driver_basic);
?> ?>
<tr class="lastvalue">
<td style="text-align:right;" style="background-color:blue;">
<?php echo $inx; ?></td>
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
<td style="background-color: #d8d8ea;" >
<?php echo $record->FirstName; ?>
</td>
<td style="max-width: 100px;">
<?php
$date = DateTime::createFromFormat('Y-m-d H:i:s', $record->DateofJoining);
$newDateFormat = $date->format('d-m-Y');
echo $newDateFormat;
?>
</td>
<td style="max-width: 150px;overflow: hidden;text-overflow: ellipsis;">
<?php echo $record->Designation; ?>
</td>
<td style="max-width:80px;text-align:center;"><?php echo $record->no_of_loads." (trip)"; ?></td>
<td id="dayWork<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="lopDay<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="paidLeave<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="otHrsWork<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo number_format($salary_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($salary_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($salary_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php $basicWorked = ($salary_amount) * 70 / 100;
echo number_format($basicWorked, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php $hraWorked = ($salary_amount) * 30 / 100;
echo number_format($hraWorked, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($basicWorked + $hraWorked, 2, '.', ''); ?>
</td>
<td id="esiAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->esi_amount; ?> </td>
<td id="pfAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->pf_amount; ?> </td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);" style="text-align:right;">
<?php
// $totalmonthloan[] = $record->Monthly_Due;
echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="otherDet<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);" style="text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> -->
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
onkeyup="driverchangeInput(event);"
<?php if (empty($record->payroll_id)) {
echo "contenteditable='true';";
} ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;"
<?php } else { ?>style="text-align:right;" <?php } ?>>
<?php if (!empty($record->Festival_Bonus)) {
echo $record->Festival_Bonus;
$totalfestival[] = $record->Festival_Bonus;
} else {
echo number_format(0.00, 2, '.', '');;
} ?>
</td>
<?php $totalfestival[] = isset($Festival_Bonus) ? $Festival_Bonus : []; ?>
<td id="empsal<?php echo $inx ?>"
<?php if (empty($record->payroll_id)) {
echo "contenteditable='false';";
} ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;" <?php }else{ ?>style="text-align:right;" <?php } ?>>
<?php if (!empty($record->driver_final_payment)) {
echo $record->driver_final_payment;
$estTotal[] = $record->driver_final_payment;
} else {
echo $empSalary[$i];
$estTotal[] = $empSalary[$i];
}
?>
</td>
<input type="hidden" id="is_driver<?php echo $inx ?>"
value="<?php echo $record->is_driver ?>">
</tr>
<?php }} ?>
</tbody> </tbody>
<tfoot> <tfoot>
@ -732,7 +868,7 @@ $(document).ready(function () {
if (data) { if (data) {
$('#loader').hide(); $('#loader').hide();
alert(data); // alert(data);
} }
@ -972,6 +1108,44 @@ $(document).ready(function () {
} }
function driverchangeInput(event, k) {
var str = event.target.id;
var sno = str.substr(8);
var driverEarn = parseFloat(document.getElementById('ttlsalary' + sno).textContent);
var Festivals = parseFloat(document.getElementById('Festival' + sno).textContent);
totalfestival[sno] = Festivals;
if (isNaN(driverEarn)) { driverEarn = 0; }
var driverMonthSalary = driverEarn + Festivals
var driverSalary = Math.round(driverMonthSalary);
var cals = (driverSalary).toFixed(0);
document.getElementById("empsal" + sno).innerHTML = cals;
// copied from calculategrandtotal() because we need those two only thats why
var FestivalBonusIndex = 23;
var FestivalBonus = 0;
$('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(FestivalBonusIndex).text();
FestivalBonus += parseFloat(value) || 0;
});
$('#fest').text(FestivalBonus);
var EstimateIndex = 24;
var Estimate = 0;
$('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(EstimateIndex).text();
Estimate += parseFloat(value) || 0;
});
$('#estsal').text(Estimate);
}
function calculategrandtotal() function calculategrandtotal()
{ {
var AutoLoanDueIndex = 21; var AutoLoanDueIndex = 21;

View File

@ -57,16 +57,17 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
}, },
type: "POST", type: "POST",
url: "<?php echo base_url(); ?>payslip/checkExistPay", url: "<?php echo base_url(); ?>payslip/checkExistPay",
dataType: "json",
success: function(result) { success: function(result) {
if (result != 1) {
if (result['count'] != 1) {
$.ajax({ $.ajax({
data: { data: {
payon: payon, payon: payon,
employee: employee employee: employee
}, },
type: "POST", type: "POST",
url: "<?php echo base_url(); ?>payslip/callsp", url: "<?php echo base_url(); ?>".result['path'],
success: function(result) { success: function(result) {
console.log(result); console.log(result);
$('#loader').hide(); $('#loader').hide();
@ -94,11 +95,9 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
}, },
type: "POST", type: "POST",
url: "<?php echo base_url(); ?>payslip/checkExistPay", url: "<?php echo base_url(); ?>payslip/checkExistPay",
dataType: "json",
success: function(result) { success: function(result) {
if (result['count'] == 1) {
if (result == 1) {
$('form#PayslipGenerator').submit(); $('form#PayslipGenerator').submit();
$('#loader').hide(); $('#loader').hide();
@ -111,7 +110,7 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
employee: employee employee: employee
}, },
type: "POST", type: "POST",
url: "<?php echo base_url(); ?>payslip/callsp", url: "<?php echo base_url(); ?>"+result['path'],
success: function(result) { success: function(result) {
$('form#PayslipGenerator').submit(); $('form#PayslipGenerator').submit();
$('#loader').hide(); $('#loader').hide();
@ -185,11 +184,11 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
<option value="-1">Select Employee</option> <option value="-1">Select Employee</option>
</select> </select>
<br /> <br />
<input type="checkbox" name="All" id="All"> Select All<br> <!-- <input type="checkbox" name="All" id="All"> Select All<br> -->
</div> </div>
<div class="col-md-6" align="right"> <div class="col-md-6" align="right">
</div> </div>
<div class="col-md-4 col-md-offset-6" align="right"> <div class="col-md-4 col-md-offset-6" align="right" style="padding-top: 23px;">
<input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay" /> <input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay" />
</div> </div>
<div class="row"> <div class="row">

View File

@ -144,8 +144,8 @@ if (!empty($Emp)) {
<th class="th">Material Code</th> <th class="th">Material Code</th>
<th class="th" style="text-align:left !important;">Material Name</th> <th class="th" style="text-align:left !important;">Material Name</th>
<th class="th">Material Category</th> <th class="th">Material Category</th>
<th class="th">Uom</th> <th class="th" style="text-align:left !important;">Uom</th>
<th class="th">Quantity</th> <th class="th" style="text-align:right !important;">Quantity</th>
<th class="th">Action</th> <th class="th">Action</th>
</tr> </tr>
</thead> </thead>
@ -684,8 +684,8 @@ if (!empty($Emp)) {
<td align="center">${materialCode}</td> <td align="center">${materialCode}</td>
<td align="left">${materialName}</td> <td align="left">${materialName}</td>
<td align="center">${categoryName}</td> <td align="center">${categoryName}</td>
<td align="center">${uom}</td> <td align="left">${uom}</td>
<td align="center">${quantity}</td> <td align="right">${quantity}</td>
<td align="center"> <td align="center">
<a <a
data-id="${temp}" data-id="${temp}"