public function mobile_leave_details() { $leave_type = Leave_left_model::find_by_employee_id_and_leave_type_id($this->input->post('emp_id'), $this->input->post('txtLeaveType')); $leaves = $leave_type->days; $data = array('leave_start' => $this->input->post('leaveStarts'), 'leave_end' => $this->input->post('leaveEnds'), 'days' => Leave_request_model::getLeaveDays($this->input->post('leaveStarts'), $this->input->post('leaveEnds')) - 1, 'employee_id' => $this->input->post('emp_id'), 'leave_left' => $leaves, 'date_approved' => 0, 'leave_status' => 'Pending', 'leave_type' => $this->input->post('txtLeaveType'), 'leave_reason' => $this->input->post('txtReason')); return $data; }
public function updateLeave($id, $leave) { $details = $this->input->post('txtDetails'); $type = Leave_left_model::find_by_leave_type_id_and_employee_id($leave, $id); $days = $type->days; $leaveDays = $days + $this->input->post('txtLeaveType'); $this->reports_model->update_leave($id, $leave, $leaveDays); Leave_history_model::addHistory($id, $leave, $days, 'Acquired', $leaveDays, $details, $this->input->post('txtLeaveType')); $this->session->set_userdata('edited', 1); Audit_trail_model::auditAddLeave($id); redirect("ems/view_details?emp_id={$id}"); }