63 lines
2.1 KiB
PHP
Executable File
63 lines
2.1 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Approve_timesheet extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->library('session');
|
|
$this->load->model('Approve_timesheet_model');
|
|
$this->load->model('caregivers/Caregiver_model');
|
|
if (!$this->ion_auth->in_group(array('admin','Coordinator'))) {
|
|
// if(!$this->ion_auth->coordinator_permission('approve_timesheet')){
|
|
redirect('home/permission');
|
|
//}
|
|
}
|
|
}
|
|
function index(){
|
|
//die('xyz');
|
|
}
|
|
|
|
function approvalDetails($id) {
|
|
// die($id);
|
|
$data = array();
|
|
$data['data']=$this->Approve_timesheet_model->get_data($id);
|
|
//echo '<pre>'; print_r($data); echo '</pre>';die;
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
$this->load->view('add_new', $data);
|
|
$this->load->view('home/footer'); // just the footer file
|
|
}
|
|
|
|
public function addNew() {
|
|
|
|
$caregiverData =$this->Caregiver_model->getNurseById($_POST['caregiver_id']);
|
|
$patient= $this->Approve_timesheet_model->getPatient($_POST);
|
|
//echo '<pre>'; print_r($patient); echo '</pre>';die;
|
|
$this->Approve_timesheet_model->submitApproval($_POST);
|
|
$name=$caregiverData->fname." ".$caregiverData->lname;
|
|
$from = array(
|
|
'name' => 'HMS Admin',
|
|
'email' => 'admin@hms.com',
|
|
|
|
);
|
|
$subject ='Timesheet has been approved';
|
|
$emaildata['emaildata'] = array(
|
|
'name' =>$name,
|
|
'patient_name' =>$patient->first_name." ".$patient->last_name
|
|
);
|
|
$to = $caregiverData->email;
|
|
$message= $this->load->view('email_template_management/timesheet_approved',$emaildata,TRUE);
|
|
send_email($from,$to,$subject,$message);
|
|
$this->session->set_flashdata('feedback', 'Inserted');
|
|
|
|
// Loading View
|
|
redirect('payroll_timesheet');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|