From e2b789a5996692bd123c1c5479c0075b67b06fb5 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 22 Dec 2023 17:52:24 +0530 Subject: [PATCH] tracker issues fix : RV --- .../modules/Business/controllers/Business.php | 19 + .../modules/Business/views/add_business.php | 2 +- .../Business/views/add_module_form.php | 2 +- .../modules/Business/views/edit_business.php | 2 +- .../modules/Business/views/edit_modules.php | 2 +- .../Delegation/views/delegation_form.php | 2 +- .../Delegation/views/delegation_list.php | 3 +- .../modules/Employee/views/add_emp.php | 32 +- .../modules/Employee/views/emp_list.php | 36 +- .../modules/Employee/views/expence_form.php | 185 ----- .../modules/Employee/views/expence_list.php | 296 -------- .../modules/Expence/controllers/Expence.php | 92 ++- .../modules/Expence/models/Expence_model.php | 39 +- .../Expence/views/confirmation_popup.php | 3 - .../modules/Expence/views/edit_expence.php | 61 +- .../Expence/views/emp_expence_list.php | 4 + .../Expence/views/emp_expence_list_view.php | 2 +- .../modules/Expence/views/expence_form.php | 643 +++++++++--------- .../modules/Expence/views/expence_list.php | 51 +- .../Expence/views/expence_list_view.php | 8 +- .../views/expence_manager_approvel.php | 5 +- .../modules/Leave/controllers/Leave.php | 6 +- .../modules/Leave/models/Leave_model.php | 7 +- .../modules/Leave/views/apply_leave.php | 94 +-- .../modules/Leave/views/assign_leave.php | 160 ----- .../modules/Leave/views/edit_leave.php | 2 +- .../modules/Leave/views/leave_list.php | 44 +- .../modules/Leave/views/leavehistory.php | 40 +- .../modules/Leave/views/manager_approvel.php | 38 +- application/modules/User/views/user_list.php | 42 +- 30 files changed, 787 insertions(+), 1135 deletions(-) delete mode 100644 application/modules/Employee/views/expence_form.php delete mode 100644 application/modules/Employee/views/expence_list.php delete mode 100644 application/modules/Leave/views/assign_leave.php diff --git a/application/modules/Business/controllers/Business.php b/application/modules/Business/controllers/Business.php index 5933b64..6ddfec8 100644 --- a/application/modules/Business/controllers/Business.php +++ b/application/modules/Business/controllers/Business.php @@ -106,6 +106,25 @@ public function create_business() unset($data['module_id']); $create_business = $this->MY_Model->insert($data,$table); + if($create_business){ + $data1=[ + 'business_id' => $this->input->post('uid'), + 'type'=> 'Permission', + 'days'=> '0', + 'is_active' => '1', + 'code ' => 'permission' + ]; + $data2=[ + 'business_id' => $this->input->post('uid'), + 'type'=> 'Casual Leave', + 'days'=> '0', + 'is_active' => '1', + ]; + $table = "leave_master"; + $leavemaster1 = $this->MY_Model->insert($data1,$table); + $leavemaster2 = $this->MY_Model->insert($data2,$table); + } + // audit history if($create_business) { diff --git a/application/modules/Business/views/add_business.php b/application/modules/Business/views/add_business.php index 3f3ce84..c1cf26a 100644 --- a/application/modules/Business/views/add_business.php +++ b/application/modules/Business/views/add_business.php @@ -253,7 +253,7 @@ class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
- + Cancel
diff --git a/application/modules/Business/views/add_module_form.php b/application/modules/Business/views/add_module_form.php index 1249b76..8da6384 100644 --- a/application/modules/Business/views/add_module_form.php +++ b/application/modules/Business/views/add_module_form.php @@ -32,7 +32,7 @@
- + Cancel
diff --git a/application/modules/Business/views/edit_business.php b/application/modules/Business/views/edit_business.php index 635dc2f..14ffcc6 100644 --- a/application/modules/Business/views/edit_business.php +++ b/application/modules/Business/views/edit_business.php @@ -260,7 +260,7 @@ class="form-control" type="text">
- + Cancel
diff --git a/application/modules/Business/views/edit_modules.php b/application/modules/Business/views/edit_modules.php index 5916a8b..8afc2ee 100644 --- a/application/modules/Business/views/edit_modules.php +++ b/application/modules/Business/views/edit_modules.php @@ -37,7 +37,7 @@
- + Cancel
diff --git a/application/modules/Delegation/views/delegation_form.php b/application/modules/Delegation/views/delegation_form.php index 1895412..ac759c3 100644 --- a/application/modules/Delegation/views/delegation_form.php +++ b/application/modules/Delegation/views/delegation_form.php @@ -90,7 +90,7 @@
- +Cancel
diff --git a/application/modules/Delegation/views/delegation_list.php b/application/modules/Delegation/views/delegation_list.php index 9009e65..d5cbae0 100644 --- a/application/modules/Delegation/views/delegation_list.php +++ b/application/modules/Delegation/views/delegation_list.php @@ -22,7 +22,8 @@ } div.dataTables_wrapper div.dataTables_filter{ - margin-top: -30px !important; //search to up + margin-top: -30px !important; +} diff --git a/application/modules/Employee/views/add_emp.php b/application/modules/Employee/views/add_emp.php index 33a379c..85578c9 100644 --- a/application/modules/Employee/views/add_emp.php +++ b/application/modules/Employee/views/add_emp.php @@ -127,6 +127,10 @@ /* Allow labels to line wrap when menu is artificially narrowed */ white-space: normal; } + +#errMessage { + color: red; +} @@ -274,7 +278,8 @@ class="fa fa-fw fa-eye field-icon toggle-password">
- + +
@@ -445,7 +450,7 @@ class="form-control typeFile" onchange="validateFile(this)"
Cancel - +
@@ -593,5 +598,26 @@ function check_if_exists(id, value, name) { } } }); - } +} + +$('#password').keyup(function() { + if ($('#confirm_password').val() == "") { + $('#errMessage').html('Please Enter confirm password'); + } else { + $('#errMessage').html(''); + } +}); + +$('#confirm_password').keyup(function() { + if ($('#confirm_password').val() == "") { + $('#errMessage').html('Please Enter confirm password'); + } else { + $('#errMessage').html(''); + } +}); + + + + + \ No newline at end of file diff --git a/application/modules/Employee/views/emp_list.php b/application/modules/Employee/views/emp_list.php index bb5b2d4..a0d0b16 100644 --- a/application/modules/Employee/views/emp_list.php +++ b/application/modules/Employee/views/emp_list.php @@ -1,7 +1,7 @@ @@ -109,14 +109,34 @@ diff --git a/application/modules/Employee/views/expence_form.php b/application/modules/Employee/views/expence_form.php deleted file mode 100644 index e137d80..0000000 --- a/application/modules/Employee/views/expence_form.php +++ /dev/null @@ -1,185 +0,0 @@ - - - - - -
-
- -
-

Expence Request

-
- - -
-
-
-
-
-
- - -
-
-
-
-
- - - - -
- - -
- -
- - -
- - Self - - Others - -
-
-
- -
- -
-
- - - -
- - -
-
-
- - -
  • -
    -
    -
    - -
    -
    - -
    - - -
    - -
    -
    - - - -
    - -
    - - - - -
    -
    - - -
    - - -
    - -
    - -
    - - -
    -
    -
    - - - -
    -
    - -
    -
    -
    -
    - - -
    -
    - - - - - - \ No newline at end of file diff --git a/application/modules/Employee/views/expence_list.php b/application/modules/Employee/views/expence_list.php deleted file mode 100644 index 238e230..0000000 --- a/application/modules/Employee/views/expence_list.php +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - -
    -
    -
    -

    Expence List

    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - $value) { ?> - - - - - - - - - - - status == 'pending'){ ?> - - status == 'Approved'){ ?> - - status == 'Declined'){ ?> - - status == 'canceled'){ ?> - - - - - - -
    Creadted DateEmployee IdEmployee NameExpence DateExpence Raised ByExpence Cost(₹)Expence BillComments Status Action
    created_at; ?> emp_id; ?> name; ?> date_of_expence; ?>created_by; ?>amount; ?> - invoice - comments; ?>status; ?>status; ?>By approved_by; ?>
    approved_at;?>
    status; ?>
    DReason; ?>
    status; ?> - - status == 'pending') { ?> - -   - - -   - - -
    -
    -
    -
    -
    -
    - -
    -
    - X -

    Decline Reason

    - - - $value) { ?> - - - - - - -
    -
    - -
    - - - - - - - - - - - - - - - diff --git a/application/modules/Expence/controllers/Expence.php b/application/modules/Expence/controllers/Expence.php index f4db902..f376adc 100644 --- a/application/modules/Expence/controllers/Expence.php +++ b/application/modules/Expence/controllers/Expence.php @@ -156,7 +156,7 @@ public function edit_expence($id) public function edit_rise_expence_request() - { + { $id = $this->input->post('expense_pid'); $data = $this->input->post('emp_id'); if(!empty($data)){ @@ -283,6 +283,7 @@ 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(); + // $get_business_admin = $this->Expence_model->get_business_admin(); $this->layout->set('count_amount', $get_count_amount); $this->layout->set('tableData', $expence_list); $this->layout->buffer('main_content', 'Expence/expence_list'); @@ -343,18 +344,83 @@ public function Approve_Expence() $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'); + $this->session->set_flashdata('Create', '1'); redirect('Expence/expence_list'); } public function Approve_Child_Expence() - { - $id=$this->input->post('id'); - $action['status'] = 'Approved'; - $action['approved_by']= user()->name; - $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')); + { + if($this->input->get('reason')) + { + $id=$this->input->get('id'); + $expense_id=$this->input->get('expence_id'); + $decline_action['status'] = 'Declined'; + $decline_action['decline_by'] = user()->name; + $decline_action['decline_reason'] = $this->input->get('reason'); + $is_decline = $this->Expence_model->approve_child_expense_2($decline_action, $id); + + if($is_decline == true) + { + $count = $this->Expence_model->get_status_update($expense_id); + $table = "expense"; + if($count->pending_count >= 1) + { + $status_update['status'] = 'pending'; + $this->MY_Model->edit_option($status_update, $expense_id, $table); + } + else if($count->approve_count >= 1 && $count->declined_count >= 1) + { + $status_update['status'] = 'Partially approved'; + return $this->MY_Model->edit_option($status_update, $expense_id, $table); + } + else if($count->declined_count >= 1 && $count->approve_count == 0 && $count->pending_count == 0) + { + + $status_update['status'] = 'Declined'; + $status_update['decline_by'] = user()->name; + return $this->MY_Model->edit_option($status_update, $expense_id, $table); + } + } + + } + else + { + $id=$this->input->post('id'); + $expense_id=$this->input->post('expence_id'); + $action['status'] = 'Approved'; + $action['approved_at'] = date('Y-m-d h:i:s'); + $action['approved_by']= user()->name; + $is_approve = $this->Expence_model->approve_child_expense_2($action, $id); + if($is_approve == true) + { + $count = $this->Expence_model->get_status_update($expense_id); + $table = "expense"; + if($count->pending_count >= 1) + { + $status_update['status'] = 'pending'; + $this->MY_Model->edit_option($status_update, $expense_id, $table); + } + else if($count->approve_count >= 1 && $count->declined_count >= 1) + { + $status_update['status'] = 'Partially approved'; + $this->MY_Model->edit_option($status_update, $expense_id, $table); + } + else if($count->approve_count >= 1 && $count->declined_count == 0 && $count->pending_count == 0) + { + + $status_update['status'] = 'Approved'; + $action['approved_at'] = date('Y-m-d h:i:s'); + $status_update['approved_by'] = user()->name; + $this->MY_Model->edit_option($status_update, $expense_id, $table); + + } + } + + redirect('Expence/expence_list_view/'.$this->input->post('expence_id')); + } + + + } public function Decline_expence() @@ -368,14 +434,6 @@ public function Decline_expence() 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() { diff --git a/application/modules/Expence/models/Expence_model.php b/application/modules/Expence/models/Expence_model.php index 5752283..227efe6 100644 --- a/application/modules/Expence/models/Expence_model.php +++ b/application/modules/Expence/models/Expence_model.php @@ -29,6 +29,7 @@ public function get_expence_list($business_id) $this->db->where('A.status', 'pending'); $this->db->or_where('A.status', 'Approved'); $this->db->or_where('A.status', 'Declined'); + $this->db->or_where('A.status', 'Partially approved'); $this->db->order_by('A.id', 'DESC'); $query = $this->db->get(); $query = $query->result(); @@ -125,25 +126,10 @@ public function approve_child_expense_2($action, $id) { $this->db->where('id', $id); $this->db->where('status','pending'); - $this->db->update('expense_child',$action); + return $this->db->update('expense_child',$action); + } - public function decline_dropdown($business_id) - - { - - $this->db->select('*'); - $this->db->from('enum'); - $this->db->where('enum_type', 'decline'); - $this->db->where('business_id', $business_id); - $query = $this->db->get(); - if ($query->num_rows() > 0) { - return $query->result(); - } else { - return; - } - - } public function get_expence_list_by_id($id) { @@ -230,7 +216,9 @@ public function update_to_submit_all($id, $data) $this->db->update('expense_child', $data); return; } - // get the value from expense and expense_child sum of the value and count data + + + // 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'); @@ -238,4 +226,19 @@ public function get_count_amount() return $query; } + public function get_status_update($id) + { + $query = $this->db->query('SELECT expense_id, + COUNT(CASE WHEN status = "Approved" THEN 1 ELSE NULL END) AS approve_count, + COUNT(CASE WHEN status = "Declined" THEN 1 ELSE NULL END) AS declined_count, + COUNT(CASE WHEN status = "pending" THEN 1 ELSE NULL END) AS pending_count + FROM expense_child + WHERE expense_id = ? + GROUP BY expense_id', $id); + + $result = $query->row(); + return $result; + + } + } \ 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 0644e0a..01fde49 100644 --- a/application/modules/Expence/views/confirmation_popup.php +++ b/application/modules/Expence/views/confirmation_popup.php @@ -1,6 +1,3 @@ - - - @@ -217,15 +217,15 @@
    - +
    @@ -248,7 +248,7 @@
    - +Cancel
    @@ -387,44 +387,41 @@ function get_all_count(id) { - @@ -450,7 +447,7 @@ function permission() { $('#leave_bal').val(''); $('#type').val(''); - }) +}) @@ -511,6 +508,7 @@ function filterTimeSlots(startingTime, numberOfHours) { var dateFormat = "dd-mm-yy"; var fromDateInput = $("#fromdate"); var toDateInput = $("#todate"); + var permissionDate = $("#perm_id"); fromDateInput.datepicker({ dateFormat: dateFormat, @@ -533,6 +531,15 @@ function filterTimeSlots(startingTime, numberOfHours) { } }); + permissionDate.datepicker({ + dateFormat: dateFormat, + changeYear: true, + changeMonth: true, + onSelect: function (dateText, inst) { + DateValidate(); + } + }); + function calculateDateDifference() { var fromDate = fromDateInput.datepicker("getDate"); var toDate = toDateInput.datepicker("getDate"); @@ -557,10 +564,15 @@ function calculateDateDifference() { -$('#subimt').click(function() { - let val = $('#user_dropdown').val() - console.log(val); -}); +// $(document).ready(function() { +// $('#submit').click(function() { +// let selectedValue = $('#user_dropdown').val(); +// alert(selectedValue); +// if(selectedValue = ""){ + +// } +// }); +// }); diff --git a/application/modules/Leave/views/assign_leave.php b/application/modules/Leave/views/assign_leave.php deleted file mode 100644 index aea4e4c..0000000 --- a/application/modules/Leave/views/assign_leave.php +++ /dev/null @@ -1,160 +0,0 @@ - - - - - -
    -
    - -
    -

    Assign Leave

    -
    - - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - -
    - - -
    - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    - -
    - - -
    - -
    - -
    - -
    -
    -
    - - - -
    -
    - -
    -
    -
    -
    - - - - - - - - -
    -
    - - diff --git a/application/modules/Leave/views/edit_leave.php b/application/modules/Leave/views/edit_leave.php index aad5d23..6d4eb26 100644 --- a/application/modules/Leave/views/edit_leave.php +++ b/application/modules/Leave/views/edit_leave.php @@ -214,7 +214,7 @@
    - +Cancel
    diff --git a/application/modules/Leave/views/leave_list.php b/application/modules/Leave/views/leave_list.php index d58042f..ce12a2f 100644 --- a/application/modules/Leave/views/leave_list.php +++ b/application/modules/Leave/views/leave_list.php @@ -92,7 +92,7 @@ type; ?> - Risedby; ?> + Risedby == ''){echo 'self'; }else{echo $value->Risedby; }; ?> no_of_days == 0){ ?> --- @@ -118,7 +118,7 @@ status == 'pending') { ?> -   +     @@ -229,18 +229,38 @@ function submitCustomPrompt() { } diff --git a/application/modules/Leave/views/manager_approvel.php b/application/modules/Leave/views/manager_approvel.php index 93ef286..c149716 100644 --- a/application/modules/Leave/views/manager_approvel.php +++ b/application/modules/Leave/views/manager_approvel.php @@ -118,7 +118,7 @@ status == 'pending') { ?> -   +     @@ -256,16 +256,36 @@ function submitCustomPrompt() { diff --git a/application/modules/User/views/user_list.php b/application/modules/User/views/user_list.php index ee46dca..65aab3d 100644 --- a/application/modules/User/views/user_list.php +++ b/application/modules/User/views/user_list.php @@ -1,5 +1,9 @@ + + + +
    @@ -35,7 +43,7 @@
    - +
    @@ -124,4 +132,36 @@ }); }); +
    Name