diff --git a/application/modules/Expence/controllers/Expence.php b/application/modules/Expence/controllers/Expence.php index 4b2fedc..a94e75c 100644 --- a/application/modules/Expence/controllers/Expence.php +++ b/application/modules/Expence/controllers/Expence.php @@ -202,7 +202,7 @@ public function edit_rise_expence_request() } // Details gathering from JavaScript new entries - $second = $this->input->post('date_of_expence2'); + $second = $this->input->post('date_of_expence_new2'); $additional_count = (gettype($second) == 'array') ? count($second) : 0; if ($additional_count > 0) { for ($j = 0; $j < $additional_count; $j++) { @@ -212,7 +212,8 @@ public function edit_rise_expence_request() 'business_id' => user()->business_id, 'manager_id' => $manager_id, 'status' => 'Draft', - 'date_of_expense' => $this->input->post('date_of_expence2')[$j], + 'date_of_expense' => date('d-m-Y', strtotime($this->input->post('date_of_expence_new2')[$j])), + 'date_of_expense_new' => date('Y-m-d', strtotime($this->input->post('date_of_expence_new2')[$j])), 'amount' => $this->input->post('amount2')[$j], 'description' => $this->input->post('description2')[$j], ); @@ -318,7 +319,8 @@ public function Emp_Expence_List_view($id) public function getDeleteConfirmationPopup() { - $data = array(); + $title = $this->input->get('title'); + $data['title'] = $title ? $title : "Are you sure to Approve this Action"; $htmlPage = $this->load->view('confirmation_popup.php',$data,true); echo json_encode($htmlPage); } @@ -342,6 +344,24 @@ public function Approve_Expence() redirect('Expence/expence_list'); } + public function Reimbursed_Expence() + { + $id=$this->input->post('id'); + $action['status'] = 'Reimbursed'; + $action['reimbursed_by']= user()->name; + $action['reimbursed_at'] = date('Y-m-d h:i:s'); + $table = "expense"; + $expence_id = $this->MY_Model->edit_option($action, $id, $table); + $this->Expence_model->approve_child_expense($action, $id); + if($expence_id){ + $code = 'REIMBURSED_EXPENCE'; + $type = 'Email'; + $this->notification->sendNotificationForExpense($id, $code, $type); + } + $this->session->set_flashdata('Create', '3'); + redirect('Expence/expence_list'); + } + public function Approve_Child_Expence() { if($this->input->post('declinedata')) @@ -466,7 +486,8 @@ public function Decline_expence() public function getCancelConfirmationPopup() { - $data = array(); + $title = $this->input->get('title'); + $data['title'] = $title ? $title : "Are you sure to Approve this Action"; $htmlPage = $this->load->view('confirmation_popup.php',$data,true); echo json_encode($htmlPage); } diff --git a/application/modules/Expence/models/Expence_model.php b/application/modules/Expence/models/Expence_model.php index eab16ac..68c787a 100644 --- a/application/modules/Expence/models/Expence_model.php +++ b/application/modules/Expence/models/Expence_model.php @@ -30,6 +30,7 @@ public function get_expence_list($business_id) $this->db->or_where('A.status', 'Approved'); $this->db->or_where('A.status', 'Declined'); $this->db->or_where('A.status', 'Partially approved'); + $this->db->or_where('A.status', 'Reimbursed'); $this->db->order_by('A.id', 'DESC'); $query = $this->db->get(); $query = $query->result(); diff --git a/application/modules/Expence/views/confirmation_popup.php b/application/modules/Expence/views/confirmation_popup.php index 01fde49..60bb091 100644 --- a/application/modules/Expence/views/confirmation_popup.php +++ b/application/modules/Expence/views/confirmation_popup.php @@ -2,7 +2,7 @@