108 lines
3.8 KiB
PHP
Executable File
108 lines
3.8 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Payroll_timesheet extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->library('session');
|
|
$this->load->model('Payroll_timesheet_model');
|
|
if (!$this->ion_auth->in_group(array('admin'))) {
|
|
if(!$this->ion_auth->coordinator_permission('payroll_timesheet')){
|
|
redirect('home/permission');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public function index() {
|
|
//die;
|
|
$data = array();
|
|
$this->load->model('Payroll_timesheet_model');
|
|
$data['data'] = $this->Payroll_timesheet_model->name_list();
|
|
//echo '<pre>';print_r($data);die;
|
|
$this->load->view('home/dashboard',$data); // just the header file
|
|
$this->load->view('namelist',$data);
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
|
|
public function getList()
|
|
{
|
|
//$this->load->model('Payroll_timesheet_model');
|
|
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
if (!empty($search)) {
|
|
$data['patient_name'] = $this->Payroll_timesheet_model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType);
|
|
} else {
|
|
$data['patient_name'] = $this->Payroll_timesheet_model->getNameByLimit($limit, $start, $orderColumn, $orderType);
|
|
}
|
|
|
|
$listCount = sizeof($data['patient_name']);
|
|
foreach ($data['patient_name'] as $data) {
|
|
//echo '<pre>'; print_r($data); echo '</pre>';die;
|
|
if($data->isApproved)
|
|
$options1 = '<span class="btn btn-success"></i>' . lang('Approved') .' </span>';
|
|
else
|
|
$options1 = '<a class="btn btn-primary" title="' . lang('Approve') .'" href="approve_timesheet/approvalDetails/'. $data->id .'" ><i class="la la-edit"></i>' . lang('Approve') .' </a>';
|
|
static $slno = 1;
|
|
$caregiverName = $data->caregiver_fname." ".$data->caregiver_lname;
|
|
$from_time = strtotime($data->timeIn);
|
|
$to_time = strtotime($data->timeOut);
|
|
$dateDiff = round(abs($to_time - $from_time) / 60,2);
|
|
$hours = intval($dateDiff/60);
|
|
$minutes = $dateDiff%60;
|
|
|
|
$period = $hours."Hrs ".$minutes."Mins";
|
|
$info[] = array(
|
|
$slno,
|
|
$caregiverName,
|
|
$data->patient_name,
|
|
$data->date,
|
|
$data->timeIn,
|
|
$data->timeOut,
|
|
$period,
|
|
$options1
|
|
// $switch,
|
|
//$options1 . ' ' . $options2
|
|
);
|
|
$slno++;
|
|
}
|
|
|
|
$csrf_name = $this->security->get_csrf_token_name();
|
|
$csrf_hash = $this->security->get_csrf_hash();
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => count($this->Payroll_timesheet_model->name_list()),
|
|
"recordsFiltered" => count($this->Payroll_timesheet_model->name_list()),
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
$output[$csrf_name] = $csrf_hash;
|
|
}
|
|
|
|
|
|
echo json_encode($output);
|
|
}
|
|
|
|
|
|
}
|
|
|