+
×
@@ -272,6 +316,18 @@ function openModal(itemId) {
}
}
+
diff --git a/application/modules/Layout/views/includes/default_footer.php b/application/modules/Layout/views/includes/default_footer.php
index 44cbcc6..7490d0f 100644
--- a/application/modules/Layout/views/includes/default_footer.php
+++ b/application/modules/Layout/views/includes/default_footer.php
@@ -67,11 +67,7 @@
-
-
-
-
-
+
diff --git a/application/modules/Leave/controllers/Leave.php b/application/modules/Leave/controllers/Leave.php
index eeb475e..9dfe65e 100644
--- a/application/modules/Leave/controllers/Leave.php
+++ b/application/modules/Leave/controllers/Leave.php
@@ -55,21 +55,27 @@ public function leaveList()
$business_id = user()->business_id;
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
+ $leave_type = $this->Leave_model->get_leave_type($business_id);
$decline_dropdown = $this->Leave_model->decline_dropdown($business_id);
$this->layout->set('tableData', $leave_list);
+ $this->layout->set('leave_type', $leave_type);
$this->layout->set('dropdown', $decline_dropdown);
$this->layout->buffer('main_content', 'Leave/leave_list');
$this->layout->render('Employee_Layout');
}
- public function applyLeave()
+ public function applyLeave($update = null)
{
$business_id = user()->business_id;
$user_id = user()->id;
$emp = $this->Emp_model->get_employee(user()->business_id);
+ $leave_master = $this->Leave_model->get_leave_master($business_id);
$leavetype = $this->Leave_model->getLeaveType($business_id);
$this->layout->set('emp', $emp);
+ $this->layout->set('leave_master', $leave_master);
$this->layout->set('leavetype', $leavetype);
+ if($update == null)
+ $this->session->set_flashdata('error', 0);
$this->layout->buffer('main_content', 'Leave/apply_leave');
$this->layout->render('Employee_Layout');
@@ -79,14 +85,25 @@ public function get_emp_leave_count()
{
$business_id = user()->business_id;
$emp_id = $this->input->get('emp_id');
- $emp_leave_count = $this->Leave_model->get_count($emp_id, $business_id);
+ $type_id = $this->input->get('type_id');
+ $emp_leave_count = $this->Leave_model->get_count($emp_id, $business_id, $type_id);
echo json_encode($emp_leave_count);
}
+ public function get_leave_master_count()
+ {
+ $business_id = user()->business_id;
+ $type_id = $this->input->get('type_id');
+ // $year = $this->input->get('fromDate');
+ // $emp_id = $this->input->get('emp_id');
+ $emp_leave_count = $this->Leave_model->get_leave_master_count($type_id, $business_id);
+ echo json_encode($emp_leave_count);
+ }
+
public function get_emp_name()
{
$emp = $this->Leave_model->get_employee(user()->business_id);
- $html = '
';
+ $html = '
';
foreach($emp as $val)
{
if($val->user_id != user()->id)
@@ -99,8 +116,9 @@ public function get_emp_name()
public function createLeave()
{
+ //permission type create part
- if($this->input->post('type') === 'Permission')
+ if($this->input->post('type') === '9')
{
$perm_data = $this->input->post();
if(isset($perm_data['emp_id'])){
@@ -131,11 +149,18 @@ public function createLeave()
$perm_data['created_time'] = date('H:i A');
$table="leave_list";
$create_permission = $this->MY_Model->insert($perm_data,$table);
- $this->session->set_flashdata('Success', 'Submitted for Approval');
+ $this->session->set_flashdata('Success', '1');
redirect('Leave/LeaveHistory');
}
-
+ //end of permission
+
+
+ //Leave create part
$data = $this->input->post();
+ unset($data['perm_date']);
+ unset($data['from_time']);
+ unset($data['to_time']);
+
if(isset($data['emp_id'])){
$emp_id =$this->input->post('emp_id');
}else{
@@ -163,33 +188,78 @@ public function createLeave()
$data['status'] = 'pending';
$data['created_date'] = date('d-m-Y');
$data['created_time'] = date('H:i A');
- $emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days");
+ $leave_year = date('Y', strtotime($this->input->post('from_date')));
+
+ //get employee's leave count
+ $emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
+ $leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
+
+
// count number of days between two dates
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
- $data['no_of_days'] = $days_between + 1;
+ $data['no_of_days'] = $days_between + 1;
$noofdays = $days_between + 1;
+
+
+ //this part is create and update leave data
if (count($emp_leave_count) != 0)
+ {
+
+ if($noofdays > $emp_leave_count[0]->remaining_days)
+ {
+ $this->session->set_flashdata('error', '1');
+ redirect('Leave/applyLeave/'.'update');
+ }
+ else
+ {
+ //this part is update if date inculeded in emp_leave_days table
+ $data['leave_bal'] = $emp_leave_count[0]->remaining_days;
+ $days['remaining_days'] = $emp_leave_count[0]->remaining_days;
+ $this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
+ }
+
+ }
+ else
+ {
+ if($noofdays > $leave_master_count[0]->days && $get_from_date > 0)
+ {
+ $this->session->set_flashdata('error', '1');
+ redirect('Leave/applyLeave/'.'update');
+ }
+ else
+ {
+ $all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
+ $data['leave_bal'] = $all_leave_count[0]->days;
+ $days['remaining_days'] = $all_leave_count[0]->days;
+
+ $days['business_id'] = user()->business_id;
+ $days['emp_id'] = $emp_id;
+ $days['total_days'] = $all_leave_count[0]->days;
+ $days['type'] = $all_leave_count[0]->id;
+ $days['year'] = $leave_year;
+ $this->MY_Model->insert($days,'emp_leave_days');
+
+ }
+ }
+
+ $get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
+ $get_emp_join_date = $this->Leave_model->get_emp_join_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
+ //print_r($get_emp_join_date); die;
+
+
+ if( $get_emp_join_date == 0 && $get_from_date == 0)
{
- $data['leave_bal'] = $emp_leave_count[0]->remaining_days;
- $days['remaining_days'] = $emp_leave_count[0]->remaining_days;
- $this->Leave_model->update($days , $emp_id , 'emp_leave_days');
+ $table="leave_list";
+ $create_leave = $this->MY_Model->insert($data,$table);
}
else
{
- $all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
- $data['leave_bal'] = $all_leave_count[0]->days;
- $days['remaining_days'] = $all_leave_count[0]->days;
-
- $days['business_id'] = user()->business_id;
- $days['emp_id'] = $emp_id;
- $days['total_days'] = $all_leave_count[0]->days;
- $days['type'] = $all_leave_count[0]->id;
- $this->MY_Model->insert($days,'emp_leave_days');
+ $this->session->set_flashdata('error', '1');
+ redirect('Leave/applyLeave/'.'update');
}
- $table="leave_list";
- $create_leave = $this->MY_Model->insert($data,$table);
+
//audit
if($create_leave)
@@ -202,11 +272,28 @@ public function createLeave()
//audit history generation for insert
$test = $this->audit->create_history('insert');
}
- $this->session->set_flashdata('Success', 'Submitted for Approval');
+ $this->session->set_flashdata('Success', '1');
redirect('Leave/LeaveHistory');
}
+ // public function get_from_to_date_count()
+ // { if($this->input->get('emp_id') == "")
+ // {
+ // $emp_id = user()->id;
+ // }
+ // else
+ // {
+ // $emp_id = $this->input->get('emp_id');
+ // }
+ // //$emp_id = $this->input->get('emp_id');
+ // $fromDate = $this->input->get('fromDate');
+ // $toDate = $this->input->get('toDate');
+ // $get_from_date = $this->Leave_model->get_from_date($emp_id, $fromDate, $toDate);
+
+ // print_r($get_from_date); die();
+ // }
+
@@ -228,7 +315,8 @@ public function edit_leave_function()
public function editleave()
{
- if($this->input->post('type') === 'Permission')
+
+ if($this->input->post('type') === '9')
{
$action = $this->input->post();
unset($action['from_date']);
@@ -253,7 +341,7 @@ public function editleave()
$action['created_time'] = date('H:i A');
$table="leave_list";
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
- $this->session->set_flashdata('Success', 'Permission Updated Sucessfully');
+ $this->session->set_flashdata('update', '0');
redirect('Leave/LeaveHistory');
}
@@ -269,71 +357,117 @@ public function editleave()
$action['emp_id'] = $emp_id;
$action['business_id'] = user()->business_id;
$action['status'] = 'pending';
- $emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days");
+ $leave_year = date('Y', strtotime($this->input->post('from_date')));
+ $emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
+ $leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
+
// count number of days between two dates
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
$action['no_of_days'] = $days_between + 1;
$noofdays = $days_between + 1;
-
- if (count($emp_leave_count) != 0)
+ $leave_id = $this->input->post('id');
+ if (count($emp_leave_count) != 0)
+ {
+ if($noofdays > $emp_leave_count[0]->remaining_days)
+ {
+ $this->session->set_flashdata('error', '1');
+ redirect('Leave/edit_leave_function?id='.md5($leave_id));
+ }
+ else
+ {
+ //this part is update if date inculeded in emp_leave_days table
+ $action['leave_bal'] = $emp_leave_count[0]->remaining_days;
+ $days['remaining_days'] = $emp_leave_count[0]->remaining_days;
+ $this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
+ }
+ }
+ else
+ {
+ if($noofdays > $leave_master_count[0]->days)
+ { $this->session->set_flashdata('error', '1');
+ redirect('Leave/edit_leave_function?id='.md5($leave_id));
+ }
+ else
+ {
+ $all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
+ $data['leave_bal'] = $all_leave_count[0]->days;
+ $days['remaining_days'] = $all_leave_count[0]->days;
+
+ $days['business_id'] = user()->business_id;
+ $days['emp_id'] = $emp_id;
+ $days['total_days'] = $all_leave_count[0]->days;
+ $days['type'] = $all_leave_count[0]->id;
+ $days['year'] = $leave_year;
+ $this->MY_Model->insert($days,'emp_leave_days');
+
+ }
+ }
+
+ $get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
+ // echo "
";
+ // print_r($get_from_date); die();
+
+ if($get_from_date == 0)
{
- $action['leave_bal'] = $emp_leave_count[0]->remaining_days;
- $days['remaining_days'] = $emp_leave_count[0]->remaining_days;
- $this->Leave_model->update($days , $emp_id , 'emp_leave_days');
+ $table="leave_list";
+ $update_leave = $this->MY_Model->edit_option($action,$id,$table);
+ $this->session->set_flashdata('update', '0');
+ redirect('Leave/LeaveHistory');
}
else
{
- $all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
- $action['leave_bal'] = $all_leave_count[0]->days;
- $days['remaining_days'] = $all_leave_count[0]->days;
-
- $days['business_id'] = user()->business_id;
- $days['emp_id'] = $emp_id;
- $days['total_days'] = $all_leave_count[0]->days;
- $days['type'] = $all_leave_count[0]->id;
- $this->MY_Model->update($days,'emp_leave_days');
+ $this->session->set_flashdata('error', '1');
+ redirect('Leave/applyLeave/'.'update');
}
- $table="leave_list";
- $update_leave = $this->MY_Model->edit_option($action,$id,$table);
- $this->session->set_flashdata('Success', 'Leave Updated Successfully');
- redirect('Leave/LeaveHistory');
+
}
- public function get_leave_count($id)
+ public function get_leave_count()
{
- $str = $id;
- $res = preg_split('~[_]+~', $str, 0, PREG_SPLIT_NO_EMPTY);
-
-
- $emp_leave_count = $this->Leave_model->get_leave_based_on_tpye($res[0] , $res[1] , user()->business_id , "emp_leave_days");
+ $id = $this->input->get('id');
+ $type_id = $this->input->get('type_id');
+ $year = date('Y');
+ $emp_leave_count = $this->Leave_model->get_leave_based_on_tpye($id, $type_id, user()->business_id, "emp_leave_days", $year);
echo json_encode($emp_leave_count);
+
+
}
- public function get_all_leave_count($id)
+ public function get_all_leave_count()
{
-
+ $id = $this->input->get('type_id');
$all_leave_count = $this->Leave_model->get_id( $id , user()->business_id , "leave_master");
echo json_encode($all_leave_count);
}
-
- public function ApproveLeave()
+ public function getDeleteConfirmationPopup()
{
- $id=$this->input->get('id');
- $emp_id = $this->Leave_model->get_emp_id($id);
- $no_of_days = $this->Leave_model->get_Leave_nodays($emp_id);
- $remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id);
- $balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
+ $data = array();
+ $htmlPage = $this->load->view('confirmation_popup.php',$data,true);
+ echo json_encode($htmlPage);
+ }
+
+ public function ApproveLeave()
+ {
+ $id=$this->input->post('id');
+ $business_id = user()->business_id;
+ $emp_id = $this->Leave_model->get_emp_id($id);
+ $no_of_days = $this->Leave_model->get_Leave_nodays($id,);
+ $leave_year = date('Y', strtotime($no_of_days->from_date));
+ //print_r($no_of_days); die('approveleave');
+
+
+ $remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
+ $balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
-
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
- $this->Leave_model->emp_leave_days_update($emp_id, $days);
-
+ $this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
+
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
@@ -342,24 +476,32 @@ public function ApproveLeave()
redirect('Leave/leaveList');
}
+ public function getManagerConfirmationPopup()
+ {
+ $data = array();
+ $htmlPage = $this->load->view('confirmation_popup.php',$data,true);
+ echo json_encode($htmlPage);
+ }
public function ManagerLeaveApprove()
{
- $id=$this->input->get('id');
+ $id=$this->input->post('id');
+ $business_id = user()->business_id;
$emp_id = $this->Leave_model->get_emp_id($id);
- $no_of_days = $this->Leave_model->get_Leave_nodays($emp_id);
- $remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id);
- $balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
+ $no_of_days = $this->Leave_model->get_Leave_nodays($id,);
+ $leave_year = date('Y', strtotime($no_of_days->from_date));
+
+ $remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
+ $balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
-
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
- $this->Leave_model->emp_leave_days_update($emp_id, $days);
-
+ $this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
+
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
$data['approved_at'] = date('d-m-Y H:i:s');
- $this->Leave_model->LeaveApprove($id, $data);
+ $this->Leave_model->LeaveApprove($id, $data);
redirect('Leave/manager_approvel');
}
@@ -385,9 +527,12 @@ public function cancled()
}
public function LeaveHistory()
- {
+ {
+ $business_id = user()->business_id;
$leave_list = $this->Leave_model->get_leave_with_emp_name(user()->business_id);
+ $leave_type = $this->Leave_model->get_leave_type($business_id);
$this->layout->set('tableData', $leave_list);
+ $this->layout->set('leave_type', $leave_type);
$this->layout->buffer('main_content', 'Leave/leavehistory');
$this->layout->render('Employee_Layout');
}
@@ -401,7 +546,9 @@ public function manager_approvel()
$get_delegation = $this->Leave_model->Get_delegation_id($business_id);
$decline_dropdown = $this->Leave_model->decline_dropdown($business_id);
$leave_list = $this->Leave_model->get_with_emp_name(user()->business_id);
+ $leave_type = $this->Leave_model->get_leave_type($business_id);
$this->layout->set('tableData', $leave_list);
+ $this->layout->set('leave_type', $leave_type);
$this->layout->set('dropdown', $decline_dropdown);
$this->layout->set('get_delegation', $get_delegation);
$this->layout->set('manager', $manager);
diff --git a/application/modules/Leave/models/Leave_model.php b/application/modules/Leave/models/Leave_model.php
index 3b9ca0e..ee189e6 100644
--- a/application/modules/Leave/models/Leave_model.php
+++ b/application/modules/Leave/models/Leave_model.php
@@ -7,11 +7,12 @@ public function get_leave_with_emp_name($business_id)
$this->db->from('leave_list A');
$this->db->join('users', 'users.id = A.emp_id', 'left');
$this->db->where('A.business_id', $business_id);
- $this->db->order_by('id','DESC');
+ $this->db->order_by('A.id','DESC');
$this->db->where('A.is_active', 1);
$query = $this->db->get();
- $query = $query->result();
+ $query = $query->result();
return $query;
+
}
public function get_with_emp_name($business_id, )
@@ -27,12 +28,13 @@ public function get_with_emp_name($business_id, )
return $query;
}
- public function get_count($emp_id, $business_id)
+ public function get_count($emp_id, $business_id, $type_id)
{
$this->db->select('*');
$this->db->from('emp_leave_days');
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $emp_id);
+ $this->db->where('type', $type_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
@@ -40,18 +42,34 @@ public function get_count($emp_id, $business_id)
}
- public function remaining_days($emp_id, $business_id)
+ public function remaining_days($emp_id, $business_id, $leave_year, $type)
{
- $this->db->select('remaining_days');
+ $this->db->select('*');
$this->db->from('emp_leave_days');
$this->db->where('emp_id', $emp_id);
$this->db->where('business_id', $business_id);
+ $this->db->where('year', $leave_year);
+ $this->db->where('type', $type);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
return $query;
}
+ // public function remaining_days_2($emp_id, $business_id, $next_year, $type)
+ // {
+ // $this->db->select('*');
+ // $this->db->from('emp_leave_days');
+ // $this->db->where('emp_id', $emp_id);
+ // $this->db->where('business_id', $business_id);
+ // $this->db->where('year', $next_year);
+ // $this->db->where('type', $type);
+ // $this->db->where('is_active', 1);
+ // $query = $this->db->get();
+ // $query = $query->row();
+ // return $query;
+ // }
+
function get_id($id,$business_id,$table)
{
$this->db->select('*');
@@ -68,7 +86,7 @@ function get_by_type($type,$business_id,$table)
{
$this->db->select();
$this->db->from($table);
- $this->db->where('type', $type);
+ $this->db->where('id', $type);
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
@@ -94,26 +112,28 @@ public function get_employee($business_id)
}
}
- public function get_leave($id , $business_id , $table)
- {
- $this->db->select('*');
- $this->db->from($table);
- $this->db->where('business_id', $business_id);
- $this->db->where('emp_id', $id);
- $this->db->order_by('id','DESC');
- $this->db->where('is_active', 1);
- $query = $this->db->get();
- $query = $query->result();
- return $query;
- }
-
- public function get_leave_based_on_tpye($id , $type , $business_id , $table)
+ public function get_leave($id , $business_id , $table, $leave_year, $type)
{
$this->db->select('*');
$this->db->from($table);
$this->db->where('business_id', $business_id);
$this->db->where('emp_id', $id);
$this->db->where('type', $type);
+ $this->db->where('year', $leave_year);
+ $this->db->where('is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result();
+ return $query;
+ }
+
+ public function get_leave_based_on_tpye($id , $type , $business_id , $table, $year)
+ {
+ $this->db->select('*');
+ $this->db->from($table);
+ $this->db->where('business_id', $business_id);
+ $this->db->where('emp_id', $id);
+ $this->db->where('type', $type);
+ $this->db->where('year', $year);
$this->db->order_by('id','DESC');
$this->db->where('is_active', 1);
$query = $this->db->get();
@@ -133,8 +153,10 @@ public function get_leave_by_md5_id($id,$business_id,$table)
return $query;
}
- function update($action,$id,$table){
+ function update_leave($action,$id,$table,$current_year,$type_id){
$this->db->where('emp_id',$id);
+ $this->db->where('type', $type_id);
+ $this->db->where('year', $current_year);
$this->db->update($table,$action);
return;
}
@@ -182,18 +204,30 @@ public function get_Leave_nodays($id)
{
$this->db->select('*');
$this->db->from('leave_list');
- $this->db->where('emp_id',$id);
+ $this->db->where('id',$id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->row();
return $query;
}
- public function emp_leave_days_update($id, $days)
+ public function emp_leave_days_update($id, $days, $current_year, $business_id, $type)
{
$this->db->where('emp_id',$id);
+ $this->db->where('year', $current_year);
+ $this->db->where('business_id', $business_id);
+ $this->db->where('type', $type);
$this->db->update('emp_leave_days', $days);
}
+
+ // public function emp_leave_days_update_2($id, $days, $next_year, $business_id, $type)
+ // {
+ // $this->db->where('emp_id',$id);
+ // $this->db->where('year', $next_year);
+ // $this->db->where('business_id', $business_id);
+ // $this->db->where('type', $type);
+ // $this->db->update('emp_leave_days', $days);
+ // }
public function get_emp_id($id)
{
@@ -273,4 +307,73 @@ public function get_emp_leave_count($type_id, $emp_id)
return $query->result();
}
+
+ public function get_leave_master($business_id)
+ {
+ $this->db->select('*');
+ $this->db->from('leave_master');
+ $this->db->where('business_id', $business_id);
+ $this->db->where('is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result();
+ return $query;
+ }
+
+ public function get_leave_master_count($type_id, $business_id)
+ {
+ $this->db->select('*');
+ $this->db->from('leave_master');
+ $this->db->where('business_id', $business_id);
+ $this->db->where('id', $type_id);
+ $this->db->where('is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result();
+ return $query;
+ }
+
+ public function get_emp_joing_year_month($emp_id, $business_id)
+ {
+ $this->db->select('A.*, name', 'users.name');
+ $this->db->from('employees A');
+ $this->db->join('users', 'users.id = A.user_id', 'left');
+ $this->db->where('A.business_id', $business_id);
+ $this->db->where('A.user_id', $emp_id);
+ $this->db->where('A.is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result();
+ return $query;
+ }
+
+ public function get_leave_type($business_id)
+ {
+ $this->db->select('*');
+ $this->db->from('leave_master');
+ $this->db->where('business_id', $business_id);
+ $this->db->where('is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result();
+ return $query;
+ }
+
+ public function get_from_date($emp_id, $from_date, $to_date)
+ {
+
+ $this->db->select('*');
+ $this->db->from('leave_list');
+ $this->db->where('emp_id', $emp_id);
+ $this->db->where('from_date >=', $from_date);
+ $this->db->where('to_date <=', $to_date);
+ $query = $this->db->count_all_results();
+ return $query;
+ }
+
+ public function get_emp_join_date($emp_id, $from_date, $to_date)
+ {
+ $this->db->select('*');
+ $this->db->from('employees');
+ $this->db->where('user_id', $emp_id);
+ $this->db->where('j_date >=', $from_date);
+ $query = $this->db->count_all_results();
+ return $query;
+ }
}
\ No newline at end of file
diff --git a/application/modules/Leave/views/apply_leave.php b/application/modules/Leave/views/apply_leave.php
index ac76d30..da6905a 100644
--- a/application/modules/Leave/views/apply_leave.php
+++ b/application/modules/Leave/views/apply_leave.php
@@ -31,7 +31,7 @@
+
+
+ session->unset_userdata('error');?>
+
+
-
+
@@ -152,7 +167,7 @@
$value) { ?>
-
+
@@ -163,31 +178,13 @@
-