diff --git a/.gitignore b/.gitignore index f821c84..6d3cd46 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ application/logs/* !application/logs/.htaccess vendor assets/uploads +assets/uploads/Expence_Bill + diff --git a/application/modules/Business/views/add_module_form.php b/application/modules/Business/views/add_module_form.php index 47647a9..3996bef 100644 --- a/application/modules/Business/views/add_module_form.php +++ b/application/modules/Business/views/add_module_form.php @@ -9,9 +9,7 @@ -
-
diff --git a/application/modules/Employee/controllers/Employee.php b/application/modules/Employee/controllers/Employee.php index 9a8d122..9c8e752 100644 --- a/application/modules/Employee/controllers/Employee.php +++ b/application/modules/Employee/controllers/Employee.php @@ -96,7 +96,6 @@ public function add_employee_education() public function add_employee_history() { - $id = $this->input->post('id'); if ($id) { $data = $this->input->post(); @@ -119,7 +118,7 @@ public function add_employee_history() public function createEmp() { - //insert in users table + //insert in users table $data = array( 'business_id' => user()->business_id, @@ -207,6 +206,9 @@ public function createEmp() } } + if(!empty($this->input->post('group_id'))) + { + if($create_user == true) { for($i=0;$iinput->post('group_id'));$i++) @@ -220,6 +222,8 @@ public function createEmp() } } + } + @@ -290,6 +294,7 @@ public function editEmployee($id) $empData = $this->Emp_model->get_emp_by_md5_id($id,user()->business_id); $manager_name = $this->Emp_model->get_manager_name($empData->manager); $manager = $this->Emp_model->get_employee(user()->business_id); + $data = array( 'submit_button_title' => 'update' , @@ -425,14 +430,18 @@ public function editEmployees() } } else - { for($i=0;$iinput->post('group_id'));$i++) + { + if(!empty($this->input->post('group_id'))) + { + for($i=0;$iinput->post('group_id'));$i++) { $group['emp_id']=$this->input->post('user_id'); $group['business_id']=user()->business_id; $group['group_id']=$this->input->post('group_id')[$i]; $group['is_active']=1; $this->MY_Model->insert($group,'group_membership'); - } + } + } } diff --git a/application/modules/Employee/views/edit_emp.php b/application/modules/Employee/views/edit_emp.php index 1706315..90a950e 100644 --- a/application/modules/Employee/views/edit_emp.php +++ b/application/modules/Employee/views/edit_emp.php @@ -1,4 +1,5 @@ + @@ -207,11 +208,21 @@
diff --git a/application/modules/Expence/controllers/Expence.php b/application/modules/Expence/controllers/Expence.php index a333096..f4db902 100644 --- a/application/modules/Expence/controllers/Expence.php +++ b/application/modules/Expence/controllers/Expence.php @@ -41,14 +41,17 @@ public function __construct() } - public function expence_form() + public function expence_form() { - + $id = $this->input->get('id'); + $expense_data = $this->Expence_model->get_expense_data($id); + $expense_child_data = $this->Expence_model->get_expense_child_data($id); + $this->layout->set('expense_child_data', $expense_child_data); $this->layout->buffer('main_content', 'Expence/expence_form'); $this->layout->render('Employee_Layout'); } - public function get_emp_name() + public function get_emp_name() { $emp = $this->Expence_model->get_employee_name(user()->business_id); $html = ''; @@ -63,75 +66,90 @@ public function get_emp_name() } public function rise_expence_request() - { - $data = $this->input->post(); - unset($data['bill']); + { - - //file upload confic - $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; - $config['allowed_types'] = 'jpg|png|jpeg|pdf'; - $config['file_name'] = time(); - $config['max_size'] = 80000; - //upload - $this->load->library('upload', $config); - $this->upload->initialize($config); - $this->upload->do_upload('bill'); - if ( ! $this->upload->do_upload('bill')) - { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); - - } else{ - $upload_image = $this->upload->data(); - $data['bill'] = $upload_image['file_name']; - - } - - - if(isset($data['emp_id'])){ + $data = $this->input->post('emp_id'); + if(!empty($data)){ $emp_id =$this->input->post('emp_id'); }else{ $emp_id = user()->id; - } - $data['emp_id'] = $emp_id; - - if($data['manager']==""){ - if(employee()->manager == null) - { - $manager = 0; - } - else - { - - $manager = employee()->manager; - } - + } + $get_manager_id = $this->Expence_model->get_manager_id($emp_id); + + if($get_manager_id[0]->manager == null){ + + $manager = 0; }else{ - - $manager = $this->input->post('manager'); + + $manager = $get_manager_id[0]->manager; } - $data['manager'] = $manager; - $data['business_id'] = user()->business_id; - $data['status'] = 'pending'; - $data['created_date'] = date('d-m-Y'); - $data['created_time'] = date('H:i A'); - $data['is_active'] = 1; - - - $table="expence_list"; - $create_leave = $this->MY_Model->insert($data,$table); - + + $data1 = array( + 'created_by'=>user()->id, + 'requested_for'=>$emp_id , + 'expense_name'=>$this->input->post('expense_name'), + 'business_reason'=>$this->input->post('business_reason'), + 'manager_id' => $manager, + 'business_id' => user()->business_id, + 'status'=>'Draft', + ); + $table="expense"; + $create_Expence = $this->MY_Model->insert($data1,$table); + + $count = count($this->input->post('date_of_expence')); + for($i=0;$i<$count;$i++) + { + + $data2 = array( + 'expense_id' => $create_Expence, + 'emp_id'=>$emp_id , + 'business_id' => user()->business_id, + 'manager_id' => $manager, + 'status' => 'Draft', + 'date_of_expense'=> $this->input->post('date_of_expence')[$i], + 'amount' => $this->input->post('amount')[$i], + 'description' => $this->input->post('description')[$i], + ); + $this->load->library('upload'); + + $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; + $config['allowed_types'] = 'jpg|png|jpeg|pdf'; + $config['max_size'] = 80000; + $config['file_name'] = time(). '_' . $_FILES['bill']['name'][$i]; + + $_FILES['userfile']['name'] = $_FILES['bill']['name'][$i]; + $_FILES['userfile']['type'] = $_FILES['bill']['type'][$i]; + $_FILES['userfile']['tmp_name'] = $_FILES['bill']['tmp_name'][$i]; + $_FILES['userfile']['error'] = $_FILES['bill']['error'][$i]; + $_FILES['userfile']['size'] = $_FILES['bill']['size'][$i]; + + $this->upload->initialize($config); + if ($this->upload->do_upload('userfile')) + { + $upload_image = $this->upload->data(); + $data2['bill'] = $upload_image['file_name']; + } + else + { + $error = $this->upload->display_errors(); + } + + $table="expense_child"; + $create_expence_list = $this->MY_Model->insert($data2,$table); + } + + $this->session->set_flashdata('Create', '1'); redirect('Expence/Emp_Expence_List'); } - public function edit_expence() + public function edit_expence($id) { - $id = $this->input->get('id'); - $get_expence = $this->Expence_model->get_expence_list_by_id($id); - $this->layout->set('get_expence', $get_expence); + $expense_data = $this->Expence_model->get_expense_data($id); + $expense_child_data = $this->Expence_model->get_expense_child_data($id); + $this->layout->set('expense_data', $expense_data); + $this->layout->set('expense_child_data', $expense_child_data); $this->layout->buffer('main_content', 'Expence/edit_expence'); $this->layout->render('Employee_Layout'); } @@ -139,63 +157,175 @@ public function edit_expence() public function edit_rise_expence_request() { - - $action = $this->input->post(); - unset($action['bill']); - unset($action['id']); - $id = $this->input->post('id'); - - - //file upload confic - $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; - $config['allowed_types'] = 'jpg|png|jpeg|pdf'; - $config['file_name'] = time(); - $config['max_size'] = 80000; - //upload - $this->load->library('upload', $config); - $this->upload->initialize($config); - $this->upload->do_upload('bill'); - if ( ! $this->upload->do_upload('bill')) - { - $error = array('error' => $this->upload->display_errors()); - //print_r($error); - - } else{ - $upload_image = $this->upload->data(); - $action['bill'] = $upload_image['file_name']; - - } - - - if(isset($data['emp_id'])){ + $id = $this->input->post('expense_pid'); + $data = $this->input->post('emp_id'); + if(!empty($data)){ $emp_id =$this->input->post('emp_id'); }else{ $emp_id = user()->id; + } + $get_manager_id = $this->Expence_model->get_manager_id($emp_id); + + if($get_manager_id[0]->manager == null){ + + $manager = 0; + }else{ + + $manager = $get_manager_id[0]->manager; } - $action['emp_id'] = $emp_id; - $action['business_id'] = user()->business_id; - $action['status'] = 'pending'; - $action['updated_at'] = date('d-m-Y H:i:s'); - $action['updated_by'] = user()->id; - $action['is_active'] = 1; - - $table="expence_list"; - $create_leave = $this->MY_Model->edit_option($action, $id, $table); - $this->session->set_flashdata('update', 'Claim Request Updated Successfully'); - redirect('Expence/Emp_Expence_List'); + + + $data1 = array( + 'created_by'=>user()->id, + 'requested_for'=>$emp_id , + 'expense_name'=>$this->input->post('expense_name'), + 'business_reason'=>$this->input->post('business_reason'), + 'manager_id' => $manager, + 'business_id' => user()->business_id, + 'status'=>'Draft', + ); + $table="expense"; + $create_Expence = $this->MY_Model->edit_option($data1, $id, $table); + + $count = count($this->input->post('date_of_expence')); + for($i=0;$i<$count;$i++) + { + $expense_child_id = $this->input->post('expense_child_id')[$i]; + $data2 = array( + 'date_of_expense'=> $this->input->post('date_of_expence')[$i], + 'amount' => $this->input->post('amount')[$i], + 'description' => $this->input->post('description')[$i], + ); + $this->load->library('upload'); + + $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; + $config['allowed_types'] = 'jpg|png|jpeg|pdf'; + $config['max_size'] = 80000; + $config['file_name'] = time(). '_' . $_FILES['bill']['name'][$i]; + + $_FILES['userfile']['name'] = $_FILES['bill']['name'][$i]; + $_FILES['userfile']['type'] = $_FILES['bill']['type'][$i]; + $_FILES['userfile']['tmp_name'] = $_FILES['bill']['tmp_name'][$i]; + $_FILES['userfile']['error'] = $_FILES['bill']['error'][$i]; + $_FILES['userfile']['size'] = $_FILES['bill']['size'][$i]; + + $this->upload->initialize($config); + if ($this->upload->do_upload('userfile')) + { + $upload_image = $this->upload->data(); + $data2['bill'] = $upload_image['file_name']; + } + else + { + $error = $this->upload->display_errors(); + } + + + $table="expense_child"; + $update_expence_list = $this->MY_Model->edit_option($data2, $expense_child_id, $table); + + } + + if($this->input->post('date_of_expence2')) + { + + $count = count($this->input->post('date_of_expence2')); + for($i=0;$i<$count;$i++) + { + + $data2 = array( + 'expense_id' => $this->input->post('expense_pid'), + 'emp_id'=>$emp_id , + 'business_id' => user()->business_id, + 'manager_id' => $manager, + 'status' => 'Draft', + 'date_of_expense'=> $this->input->post('date_of_expence2')[$i], + 'amount' => $this->input->post('amount2')[$i], + 'description' => $this->input->post('description2')[$i], + ); + $this->load->library('upload'); + + $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; + $config['allowed_types'] = 'jpg|png|jpeg|pdf'; + $config['max_size'] = 80000; + $config['file_name'] = time(). '_' . $_FILES['bill2']['name'][$i]; + + $_FILES['userfile']['name'] = $_FILES['bill2']['name'][$i]; + $_FILES['userfile']['type'] = $_FILES['bill2']['type'][$i]; + $_FILES['userfile']['tmp_name'] = $_FILES['bill2']['tmp_name'][$i]; + $_FILES['userfile']['error'] = $_FILES['bill2']['error'][$i]; + $_FILES['userfile']['size'] = $_FILES['bill2']['size'][$i]; + + $this->upload->initialize($config); + if ($this->upload->do_upload('userfile')) + { + $upload_image = $this->upload->data(); + $data2['bill'] = $upload_image['file_name']; + } + else + { + $error = $this->upload->display_errors(); + } + + $table="expense_child"; + $create_expence_list = $this->MY_Model->insert($data2,$table); + //print_r($this->db->last_query()); die; + } + + } + + redirect('Expence/Emp_Expence_List'); } - public function expence_list() - { + { $business_id = user()->business_id; $expence_list = $this->Expence_model->get_expence_list($business_id); + $get_count_amount = $this->Expence_model->get_count_amount(); + $this->layout->set('count_amount', $get_count_amount); $this->layout->set('tableData', $expence_list); $this->layout->buffer('main_content', 'Expence/expence_list'); $this->layout->render('Employee_Layout'); } + public function expence_list_view($id) + { + $expence_list = $this->Expence_model->get_expense_child_data2($id); + $get_expense_name = $this->Expence_model->get_expense_data_not_md5($id); + $this->layout->set('tableData', $expence_list); + $this->layout->set('expense_name', $get_expense_name); + $this->layout->buffer('main_content', 'Expence/expence_list_view'); + $this->layout->render('Employee_Layout'); + } + + public function expence_list2() + { + $id = $this->input->get('id'); + $expence_list2 = $this->Expence_model->get_expence_child_list($id); + echo json_encode($expence_list2); + } + + public function Emp_Expence_List() + { + $business_id = user()->business_id; + $expence_list = $this->Expence_model->get_expence_list_all($business_id); + $get_count_amount = $this->Expence_model->get_count_amount(); + $this->layout->set('count_amount', $get_count_amount); + $this->layout->set('tableData', $expence_list); + $this->layout->buffer('main_content', 'Expence/emp_expence_list'); + $this->layout->render('Employee_Layout'); + } + + public function Emp_Expence_List_view($id) + { + $expence_list = $this->Expence_model->get_expense_child_data2($id); + $get_expense_name = $this->Expence_model->get_expense_data_not_md5($id); + $this->layout->set('tableData', $expence_list); + $this->layout->set('expense_name', $get_expense_name); + $this->layout->buffer('main_content', 'Expence/emp_expence_list_view'); + $this->layout->render('Employee_Layout'); + } public function getDeleteConfirmationPopup() { @@ -204,73 +334,94 @@ public function getDeleteConfirmationPopup() echo json_encode($htmlPage); } - public function Approve_Expence() + public function Approve_Expence() { $id=$this->input->post('id'); $action['status'] = 'Approved'; $action['approved_by']= user()->name; - $action['approved_at'] = date('d-m-Y H:i:s'); - $table = "expence_list"; + $action['approved_at'] = date('Y-m-d h:i:s'); + $table = "expense"; $this->MY_Model->edit_option($action, $id, $table); + $this->Expence_model->approve_child_expense($action, $id); $this->session->set_flashdata('approve', 'Claim Request Approved'); redirect('Expence/expence_list'); } - public function manager_approvel_list() - { - $business_id = user()->business_id; - $user_id = user()->id; - $expence_list = $this->Expence_model->get_expence_list($business_id); - $get_delegation = $this->Expence_model->Get_delegation_id($business_id); - //print_r($expence_list); die(); - $this->layout->set('get_delegation', $get_delegation); - $this->layout->set('tableData', $expence_list); - $this->layout->buffer('main_content', 'Expence/expence_manager_approvel'); - $this->layout->render('Employee_Layout'); - } - - public function Manager_Approvel() + public function Approve_Child_Expence() { - $id=$this->input->post('id'); + $id=$this->input->post('id'); $action['status'] = 'Approved'; $action['approved_by']= user()->name; - $action['approved_at'] = date('d-m-Y H:i:s'); - $table = "expence_list"; - $this->MY_Model->edit_option($action, $id, $table); - $this->session->set_flashdata('manager_approve', 'Claim Request Approved'); - redirect('Expence/manager_approvel_list'); + $action['approved_at'] = date('Y-m-d h:i:s'); + $this->Expence_model->approve_child_expense_2($action, $id); + redirect('Expence/expence_list_view/'.$this->input->post('expence_id')); } - public function Emp_Expence_List() - { - $Emp_Expence_List = $this->Expence_model->get_expence_list(user()->business_id); - $this->layout->set('tableData', $Emp_Expence_List); - $this->layout->buffer('main_content', 'Expence/emp_expence_list'); - $this->layout->render('Employee_Layout'); - } - - - public function Decline_expence() { $id=$this->input->get('id'); $data['status'] = 'Declined'; - $data['declined_at'] = date('d-m-Y H:i:s'); - $data['DReason'] = $this->input->get('reason'); + $data['decline_by'] = user()->name; + $data['decline_reason'] = $this->input->get('reason'); $this->Expence_model->ExpenceDecline($id, $data); + $this->Expence_model->Expence_Decline_Child($id, $data); return true; } + public function Decline_Child_Expence() + { + $id=$this->input->get('id'); + $action['status'] = 'Declined'; + $action['decline_by'] = user()->name; + $action['decline_reason'] = $this->input->get('reason'); + return $this->Expence_model->approve_child_expense_2($action, $id); + } + + public function getCancelConfirmationPopup() + { + $data = array(); + $htmlPage = $this->load->view('confirmation_popup.php',$data,true); + echo json_encode($htmlPage); + } + public function cancled_expence() { - $id=$this->input->get('id'); - $data['status'] = 'canceled'; - $data['canceled_at'] = date('d-m-Y H:i:s'); - $this->Expence_model->Expencecancle($id, $data); - $this->session->set_flashdata('cancel', 'Claim Request Canceled.... '); + $id=$this->input->post('id'); + $data['status'] = 'Cancelled'; + $data['cancelled_at'] = date('Y-m-d h:i:s'); + $first = $this->Expence_model->Expencecancle($id, $data); + $second = $this->Expence_model->Expencecancle_child($id, $data); redirect('Expence/emp_expence_list'); } + public function remove_row() + { + $get_count_from_child = $this->Expence_model->get_expense_child_data(md5($this->input->post('expence_id'))); + $count = count($get_count_from_child); + if($count === 1) + { + $this->session->set_flashdata('remove_row', '1'); + redirect('Expence/edit_expence/'.md5($this->input->post('expence_id'))); + } + else + { + $id = $this->input->post('id'); + $delete = $this->Expence_model->remove_row($id); + redirect('Expence/edit_expence/'.md5($this->input->post('expence_id'))); + } + + } + + public function submit() + { + $id = $this->input->post('id'); + $table1 = 'expense'; + $data['status'] = "pending"; + $data['updated_on'] = date('Y-m-d h:i:s'); + $this->MY_Model->edit_option($data, $id, $table1); + $this->Expence_model->update_to_submit_all($id, $data); + redirect('Expence/emp_expence_list'); + } } diff --git a/application/modules/Expence/models/Expence_model.php b/application/modules/Expence/models/Expence_model.php index 63f8b93..5752283 100644 --- a/application/modules/Expence/models/Expence_model.php +++ b/application/modules/Expence/models/Expence_model.php @@ -21,19 +21,113 @@ public function get_employee_name($business_id) public function get_expence_list($business_id) { - $this->db->select('A.* , name', 'users.name'); - $this->db->from('expence_list A'); - $this->db->join('users', 'users.id = A.emp_id', 'left'); - //$this->db->join('delegation', 'delegation.emp_id = users.id', 'left'); + $this->db->select('A.*, u1.name as requested_name, u2.name as created_name'); + $this->db->from('expense A'); + $this->db->join('users u1', 'u1.id = A.requested_for', 'left'); + $this->db->join('users u2', 'u2.id = A.created_by', 'left'); $this->db->where('A.business_id', $business_id); - $this->db->order_by('id','DESC'); - $this->db->where('A.is_active', 1); + $this->db->where('A.status', 'pending'); + $this->db->or_where('A.status', 'Approved'); + $this->db->or_where('A.status', 'Declined'); + $this->db->order_by('A.id', 'DESC'); $query = $this->db->get(); $query = $query->result(); return $query; } + public function get_expence_list_all($business_id) + { + + $this->db->select('A.*, u1.name as requested_name, u2.name as created_name'); + $this->db->from('expense A'); + $this->db->join('users u1', 'u1.id = A.requested_for', 'left'); + $this->db->join('users u2', 'u2.id = A.created_by', 'left'); + $this->db->where('A.business_id', $business_id); + $this->db->order_by('A.id','DESC'); + $query = $this->db->get(); + $query = $query->result(); + return $query; + + } + + public function get_expense_data($id) + { + $this->db->select('*'); + $this->db->from('expense'); + $this->db->where('md5(id)', $id); + $query = $this->db->get(); + return $query->result(); + if ($query->num_rows() > 0) { + return $query->result(); + } else { + return; + } + } + + public function get_expense_data_not_md5($id) + { + $this->db->select('A.*, u1.name as requested_name, u2.name as created_name'); + $this->db->from('expense A'); + $this->db->join('users u1', 'u1.id = A.requested_for', 'left'); + $this->db->join('users u2', 'u2.id = A.created_by', 'left'); + $this->db->where('A.id', $id); + $query = $this->db->get(); + return $query->result(); + if ($query->num_rows() > 0) { + return $query->result(); + } else { + return; + } + } + + public function get_expense_child_data($id) + { + $this->db->select('*'); + $this->db->from('expense_child'); + $this->db->where('md5(expense_id)', $id); + $query = $this->db->get(); + return $query->result(); + + } + + + + public function get_expense_child_data2($id) + { + $this->db->select('*'); + $this->db->from('expense_child'); + $this->db->where('expense_id', $id); + $query = $this->db->get(); + return $query->result(); + + } + + + public function get_expence_child_list($expense_id) + { + $this->db->select('*'); + $this->db->from('expense_child'); + $this->db->where('expense_id', $expense_id); + $this->db->order_by('id', 'DESC'); + $query = $this->db->get(); + return $query->result(); + } + + public function approve_child_expense($action, $id) + { + $this->db->where('expense_id', $id); + $this->db->where('status','pending'); + $this->db->update('expense_child',$action); + } + + public function approve_child_expense_2($action, $id) + { + $this->db->where('id', $id); + $this->db->where('status','pending'); + $this->db->update('expense_child',$action); + } + public function decline_dropdown($business_id) { @@ -66,21 +160,36 @@ public function get_expence_list_by_id($id) } - public function ExpenceDecline($id, $data) { $this->db->where('id',$id); $this->db->where('status', 'pending'); - $this->db->update('expence_list', $data); + $this->db->update('expense', $data); + return; + } + + public function Expence_Decline_Child($id, $data) + { + $this->db->where('expense_id',$id); + $this->db->where('status', 'pending'); + $this->db->update('expense_child', $data); return; } public function Expencecancle($id, $data) { $this->db->where('md5(id)',$id); - $this->db->where('status', 'pending'); - $this->db->update('expence_list', $data); - return; + $this->db->where('status', 'Draft'); + $this->db->update('expense', $data); + return $this->db->last_query(); + } + + public function Expencecancle_child($id, $data) + { + $this->db->where('md5(expense_id)',$id); + $this->db->where('status', 'Draft'); + $this->db->update('expense_child', $data); + return $this->db->last_query(); } public function Get_delegation_id($business_id) @@ -94,4 +203,39 @@ public function Get_delegation_id($business_id) return $query->result(); } + public function get_manager_id($user_id) + { + $this->db->select('manager'); + $this->db->from('employees'); + $this->db->where('user_id', $user_id); + $query = $this->db->get(); + if ($query->num_rows() > 0) { + return $query->result(); + } else { + return; + } + } + + public function remove_row($id) + { + $this->db->where("id", $id); + $this->db->delete("expense_child"); + return true; + } + + public function update_to_submit_all($id, $data) + { + $this->db->where('expense_id',$id); + $this->db->where('status', 'Draft'); + $this->db->update('expense_child', $data); + return; + } + // get the value from expense and expense_child sum of the value and count data + public function get_count_amount() + { + $query = $this->db->query('SELECT expense.id, (SELECT SUM(amount) FROM expense_child WHERE expense_child.expense_id = expense.id) as amount, (SELECT COUNT(expense_id) FROM expense_child WHERE expense_child.expense_id = expense.id) as count FROM expense'); + $query = $query->result(); + return $query; + } + } \ No newline at end of file diff --git a/application/modules/Expence/views/confirmation_popup.php b/application/modules/Expence/views/confirmation_popup.php index 7b39a98..0644e0a 100644 --- a/application/modules/Expence/views/confirmation_popup.php +++ b/application/modules/Expence/views/confirmation_popup.php @@ -5,8 +5,8 @@ +
+ + + + + + + -
+ + + + - \ No newline at end of file + + html1 += '
' + html1 += '' + html1 += '
' + + html1 += '' + html1 += '
' + html1 += '
' + html1 += '
' + + + var formContainer = document.getElementById('formContainer'); + //formContainer.innerHTML += html1; + formContainer.insertAdjacentHTML('beforeend', html1); + + + const datepickerInput = document.getElementById('datepicker'+i); + flatpickr(datepickerInput, { + dateFormat: 'd-m-Y', + maxDate: new Date(), + autoclose:true, + + onChange: function(selectedDates, dateStr) { + console.log('Selected date: ', dateStr); + } + }); + + +} + + function removebutton(index) { + //console.log(index) + var element = document.getElementById('removeChild'+ index); + //console.log(element) + if (element) { + element.remove(); + } +} + + + \ No newline at end of file diff --git a/application/modules/Expence/views/emp_expence_list.php b/application/modules/Expence/views/emp_expence_list.php index 3cc8bcd..ff05e60 100644 --- a/application/modules/Expence/views/emp_expence_list.php +++ b/application/modules/Expence/views/emp_expence_list.php @@ -6,7 +6,7 @@ .modal { display: none; /* Hide the modal by default */ position: fixed; - z-index: 1; +/* z-index: 1;*/ left: 0; top: 0; width: 100%; @@ -82,7 +82,7 @@ New Claim role == null) { ?> - My Approval + My Approval @@ -90,62 +90,84 @@ -

Expense Claims

+

Expense Claims

- +
+
- - - - - - - + + + + + + + + $value) { ?> - id == $value->emp_id) { ?> + id == $value->requested_for) { ?> - - - - - - status == 'pending'){ ?> - - status == 'Approved'){ ?> - - status == 'Declined'){ ?> - - status == 'canceled'){ ?> - - id; ?> + + + $count_value) { ?> - }?> + id == $count_value->id) { ?> + + + + + + + status == 'pending'){ ?> + + status == 'Approved'){ ?> + + status == 'Declined'){ ?> + + status == 'Cancelled'){ ?> + + status == 'Draft'){?> + + + +
Claim Date DesriptionExpense DateExpense Cost(₹)Status Action Claim DateExpense NameBusiness ReasonTotal Amount(₹)No of ListStatus Action
created_date; ?>
created_time;?>
comments; ?> date_of_expence);?>amount; ?>status; ?>status; ?> By approved_by; ?>
approved_at; ?>
status; ?>
Dreason; ?>
status; ?>created_on));?> + expense_name; ?>business_reason; ?>amount ?>count ?>status; ?>status; ?> By approved_by; ?>
approved_at));?>
status; ?> by decline_by; ?>
decline_reason; ?>
status; ?> at
cancelled_at));?>
status; ?> - bill)) { ?> + + + status != 'Draft') { ?> + +   - status == 'pending') { ?> + status == 'Draft') { ?> -   +   + +   + +   + + -   @@ -154,6 +176,7 @@
+
@@ -172,23 +195,19 @@ + + diff --git a/application/modules/Expence/views/emp_expence_list_view.php b/application/modules/Expence/views/emp_expence_list_view.php new file mode 100644 index 0000000..aa02f21 --- /dev/null +++ b/application/modules/Expence/views/emp_expence_list_view.php @@ -0,0 +1,201 @@ + + + + + + + + +
+
+
+ + + + session->unset_userdata('Create');?> + + + + +

List of Expense - expense_name; ?>

+
+
+
+
+
+ + + + + + + + + + + + + + + $value) { ?> + + + + + + + status == 'pending'){ ?> + + status == 'Approved'){ ?> + + status == 'Declined'){ ?> + + status == 'Cancelled'){ ?> + + status == 'Draft'){?> + + + + + + + + +
Claim DateDate of ExpenseAmountDescriptionStatus Action
created_on));?> + date_of_expense)) ?>amount; ?>description; ?>status; ?>status; ?> By approved_by; ?>
approved_at;?>
status; ?> by decline_by; ?>
decline_reason; ?>
status; ?> at
cancelled_at; ?>
status; ?> + + + + + + + status == 'Draft' || $value->status == 'Draft') { ?> + + + + + + + + + + +
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + diff --git a/application/modules/Expence/views/expence_form.php b/application/modules/Expence/views/expence_form.php index f4a875d..423a8b3 100644 --- a/application/modules/Expence/views/expence_form.php +++ b/application/modules/Expence/views/expence_form.php @@ -1,22 +1,10 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + +
+
+
+ +

Expense Approval List

+ +
+ + +
+ + +
+
+ +
+
+ + +
+
+ +
+ +
+
+ + +
+ + +
+
+ +
+
+ + + + +
+
+ +
+ +
+
+ + +
+ + +
+
+ status .' By '. $expense_name[0]->approved_by .' - '. date('d-m-Y h:i:s', strtotime($expense_name[0]->approved_at)); + } + else if($expense_name[0]->status == "Declined") + { + echo $expense_name[0]->status .' By '. $expense_name[0]->decline_by; + } + else + { + echo $expense_name[0]->status; + } + } + ?>" + + autocomplete='off' required /> +
+
+ + +
+
+ +
+ +
+
+ + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + $value) { ?> + + + + + + + status == 'pending'){ ?> + + status == 'Approved'){ ?> + + status == 'Declined'){ ?> + + status == 'Cancelled'){ ?> + + status == 'Draft'){?> + + + + + + + + + +
Claim DateDate of ExpenseAmountDescriptionStatus Action
created_on));?>date_of_expense)) ?>amount; ?>description; ?>status; ?>status; ?> By approved_by; ?>
approved_at)) ?>
status; ?> by decline_by; ?>
decline_reason; ?>
status; ?> at
cancelled_at; ?>
status; ?> + +
+ + status == 'pending') { ?> + +   + + +   + + +
+
+
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/application/modules/Expence/views/expence_manager_approvel.php b/application/modules/Expence/views/expence_manager_approvel.php index a47d785..81ae35c 100644 --- a/application/modules/Expence/views/expence_manager_approvel.php +++ b/application/modules/Expence/views/expence_manager_approvel.php @@ -1,17 +1,17 @@ - + + - +
-
- - - - - - - - - - - - - - - +
Claim DateEmployee NameDescription Expense DateExpense Cost(₹)Claim Raised ByStatus Action
+ + + + + + + + + + + + + + + $value) { ?> + + id == $value->manager_id){ ?> - $value) { ?> - - id == $value->manager){ ?> + + + + + + + + status == 'pending'){ ?> + + status == 'Approved'){ ?> + + status == 'Declined'){ ?> + + status == 'Cancelled'){ ?> + + status == 'Draft'){?> + + + + - - - - - - - - - status == 'pending'){ ?> - - status == 'Approved'){ ?> - - status == 'Declined'){ ?> - - status == 'canceled'){ ?> - - - }?> - - - - - $val) { ?> - - id == $val->delegated_to && date('d-m-Y') >= $val->from_date && date('d-m-Y') <= $val->to_date && $value->created_date >= $val->from_date && $value->created_date <= $val->to_date) { ?> - - - - - - - - - - status == 'pending'){ ?> - - status == 'Approved'){ ?> - - status == 'Declined'){ ?> - - status == 'canceled'){ ?> - - - - - - - -
Claim DateCreated ByRequested ForExpense NameBusiness ReasonStatus Action
created_on));?> + created_name; ?>requested_name; ?>expense_name; ?>business_reason; ?>status; ?>status; ?> By approved_by; ?>
approved_at;?>
status; ?> by decline_by; ?>
decline_reason; ?>
status; ?> at
cancelled_at; ?>
status; ?>
created_date; ?>
created_time;?>
name; ?> (emp_id; ?>)comments; ?>date_of_expence; ?>amount; ?>created_by; ?>status; ?>status; ?> By approved_by; ?>
approved_at;?>
status; ?>
Dreason; ?>
status; ?> - - bill)) { ?> + + + + +   -
- + status == 'pending') { ?> - status == 'pending') { ?> +   -   + +   - -   - - - - -
created_date; ?>
created_time;?>
name; ?> (emp_id; ?>)comments; ?>date_of_expence; ?>amount; ?>created_by; ?>status; ?>status; ?> By approved_by; ?>
approved_at;?>
status; ?>
Dreason; ?>
status; ?> - - bill)) { ?> - - -
- - - status == 'pending') { ?> - -   - - -   - - - - -
+ + + + + +
-