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 '
';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 ''; print_r($data); echo '
';die;
if($data->isApproved)
$options1 = '' . lang('Approved') .' ';
else
$options1 = '' . lang('Approve') .' ';
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);
}
}