diff --git a/application/modules/Expence/controllers/Expence.php b/application/modules/Expence/controllers/Expence.php index 964ebb2..20de4e0 100644 --- a/application/modules/Expence/controllers/Expence.php +++ b/application/modules/Expence/controllers/Expence.php @@ -110,10 +110,11 @@ public function rise_expence_request() 'manager_id' => $manager, 'status' => 'Draft', // 'date_of_expense'=> $this->input->post('date_of_expence')[$i], - 'date_of_expense_new'=> $this->input->post('date_of_expence_new')[$i], + 'date_of_expense_new' => date('Y-m-d', strtotime($this->input->post('date_of_expence_new')[$i])), 'amount' => $this->input->post('amount')[$i], 'description' => $this->input->post('description')[$i], ); + // print_r($data2);die; $this->load->library('upload'); $config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/'; diff --git a/application/modules/Expence/views/edit_expence.php b/application/modules/Expence/views/edit_expence.php index e259a81..2658c91 100644 --- a/application/modules/Expence/views/edit_expence.php +++ b/application/modules/Expence/views/edit_expence.php @@ -11,7 +11,7 @@ .alert-success { background-color: #dff0d8; color: #3c763d; - border-color: #d6e9c6; + border-color: #d6e9c6; } .flash-message { @@ -22,7 +22,7 @@ } .hide-arrow { - + -webkit-appearance: none; -moz-appearance: none; appearance: none; @@ -76,7 +76,7 @@ text: 'Only change and Update', styling: 'bootstrap3' });">Success - + session->unset_userdata('remove_row');?> @@ -463,10 +468,10 @@ function createAndAppendFormGroup() { //formContainer.innerHTML += html1; formContainer.insertAdjacentHTML('beforeend', html1); - + const datepickerInput = document.getElementById('datepicker'+i); flatpickr(datepickerInput, { - dateFormat: 'd-m-Y', + dateFormat: 'd-m-Y', maxDate: new Date(), autoclose:true, allowInput: false, @@ -474,9 +479,9 @@ function createAndAppendFormGroup() { onChange: function(selectedDates, dateStr) { console.log('Selected date: ', dateStr); } - }); + }); + - } function removebutton(index) { @@ -496,14 +501,14 @@ function removebutton(index) { var expence_id = document.getElementById('expense_id').value; var url = "Expence/remove_row"; - $.ajax({ + $.ajax({ url: "Expence/getCancelConfirmationPopup", type:"GET", success:function(data){ $('#popup').html(JSON.parse(data)); $('.delete_id').attr('value',id); $('.expence_id').attr('value',expence_id); - $('.delete_url').attr('action',url); + $('.delete_url').attr('action',url); } }); }); @@ -513,19 +518,19 @@ function removebutton(index) { // var id = document.getElementById('expense_id').value; // alert(id) - + // $('.hidebtn').disable() -// // $.ajax({ -// // data:{id : id}, +// // $.ajax({ +// // data:{id : id}, // // url: "Expence/get_expense_child_count", // // type:"GET", // // success:function(data){ // // $('#popup').html(JSON.parse(data)); // // $('.delete_id').attr('value',id); // // $('.expence_id').attr('value',expence_id); -// // $('.delete_url').attr('action',url); +// // $('.delete_url').attr('action',url); // // } // // }); // }); - \ No newline at end of file + diff --git a/application/modules/Expence/views/expence_form.php b/application/modules/Expence/views/expence_form.php index ffea43c..4858953 100644 --- a/application/modules/Expence/views/expence_form.php +++ b/application/modules/Expence/views/expence_form.php @@ -144,7 +144,12 @@
";
- // print_r($get_from_date); die();
+
if($get_from_date == 0)
{
+ echo"update fun:";
$table="leave_list";
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
+
$this->session->set_flashdata('update', '0');
redirect('Leave/LeaveHistory');
}
@@ -488,6 +509,7 @@ 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);
}
@@ -512,14 +534,16 @@ public function ApproveLeave()
$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));
+ $leave_year = date('Y', strtotime($no_of_days->from_date_new));
$leave_type = $this->Leave_model->get_leave_data_using_leave_id($id);
+// print_r($leave_year);
+
if($leave_type->leave_code !== 'permission')
{
- $remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
+ $remaining_days = $this->Leave_model->remaining_days($emp_id,$business_id, $leave_year, $no_of_days->type);
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
-
+ // print_r($balance_days);die;
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
@@ -556,7 +580,7 @@ public function ManagerLeaveApprove()
$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));
+ $leave_year = date('Y', strtotime($no_of_days->from_date_new));
$leave_type = $this->Leave_model->get_leave_data_using_leave_id($id);
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
@@ -691,7 +715,7 @@ public function DeclinewithdrawLeave()
$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));
+ $leave_year = date('Y', strtotime($no_of_days->from_date_new));
$leave_type = $this->Leave_model->get_leave_data_using_leave_id($id);
if($leave_type->leave_code !== 'permission')
@@ -730,7 +754,7 @@ public function ApprovewithdrawLeave()
// Update leave balance
$emp_id = $this->Leave_model->get_emp_id($id);
- $leave_year = date('Y', strtotime($leave_data->from_date));
+ $leave_year = date('Y', strtotime($leave_data->from_date_new));
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $leave_data->type);
$balance_days = $remaining_days[0]->remaining_days + $leave_data->no_of_days;
diff --git a/application/modules/Leave/models/Leave_model.php b/application/modules/Leave/models/Leave_model.php
index 3ce8051..6760aa9 100644
--- a/application/modules/Leave/models/Leave_model.php
+++ b/application/modules/Leave/models/Leave_model.php
@@ -180,6 +180,7 @@ public function remaining_days($emp_id, $business_id, $leave_year, $type)
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->result();
+ // print_r($this->db->last_query());
return $query;
}
@@ -511,8 +512,8 @@ 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);
+ $this->db->where('from_date_new >=', $from_date);
+ $this->db->where('to_date_new <=', $to_date);
$query = $this->db->count_all_results();
return $query;
}
@@ -544,8 +545,8 @@ public function get_approved_leaves_cur_week()
$this->db->from('leave_list');
$this->db->join('users', 'users.id = leave_list.emp_id', 'left');
$this->db->group_start();
- $this->db->where("STR_TO_DATE(from_date, '%d-%m-%Y') <= '$currentWeekEnd'");
- $this->db->where("STR_TO_DATE(to_date, '%d-%m-%Y') >= '$currentWeekStart'");
+ $this->db->where("STR_TO_DATE(from_date_new, '%d-%m-%Y') <= '$currentWeekEnd'");
+ $this->db->where("STR_TO_DATE(to_date_new, '%d-%m-%Y') >= '$currentWeekStart'");
$this->db->or_where("STR_TO_DATE(perm_date, '%d-%m-%Y') <= '$currentWeekEnd'");
$this->db->or_where("STR_TO_DATE(perm_date, '%d-%m-%Y') >= '$currentWeekStart'");
$this->db->group_end();
@@ -556,8 +557,8 @@ public function get_approved_leaves_cur_week()
// Organize approved leave records into columns based on days of the week
$weekData = [];
foreach ($approvedLeaveRecords as $leave) {
- $leaveStartDate = ($leave->from_date) ? date('Y-m-d', strtotime($leave->from_date)) : date('Y-m-d', strtotime($leave->perm_date));
- $leaveEndDate = ($leave->to_date) ? date('Y-m-d', strtotime($leave->to_date)) : date('Y-m-d', strtotime($leave->perm_date));
+ $leaveStartDate = ($leave->from_date_new) ? date('Y-m-d', strtotime($leave->from_date_new)) : date('Y-m-d', strtotime($leave->perm_date));
+ $leaveEndDate = ($leave->to_date_new) ? date('Y-m-d', strtotime($leave->to_date_new)) : date('Y-m-d', strtotime($leave->perm_date));
// Use from_time and to_time if available
$fromTime = ($leave->from_time) ? ' ' . $leave->from_time : '';
@@ -586,7 +587,7 @@ public function get_week_leave_count($business_id)
{
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
$endOfWeek = date('Y-m-d', strtotime('sunday this week'));
-
+
// Query to get leave records for the specified employee within the current week
$this->db->select('A.*, U1.name as employee_name');
$this->db->from('leave_list A');
@@ -606,7 +607,7 @@ public function get_week_leave_count($business_id)
'friday' => [],
'saturday' => []
);
-
+
// Iterate over the leave records to count leaves for each day of the week
foreach ($leaveRecords as $key => $record) {
if($record->from_date_new < $startOfWeek)
@@ -628,10 +629,10 @@ public function get_week_leave_count($business_id)
}
array_push($weeklyLeaveCounts[strtolower($startDate)], $record->employee_name); // Increment for the last day
}
-
+
// Return the array with leave counts for each day of the week
return $weeklyLeaveCounts;
}
-
+
}
diff --git a/application/modules/Leave/views/edit_leave.php b/application/modules/Leave/views/edit_leave.php
index d311407..216a3ca 100644
--- a/application/modules/Leave/views/edit_leave.php
+++ b/application/modules/Leave/views/edit_leave.php
@@ -143,7 +143,7 @@
-
+
@@ -154,7 +154,7 @@
-
+
@@ -162,14 +162,14 @@
-
+
-
+
@@ -179,7 +179,12 @@
-
+ perm_date_new is in the 'Y-m-d' format
+ $formatted_date = date('d-m-y', strtotime($leave->perm_date_new));
+ ?>
+
+
diff --git a/application/modules/Leave/views/leave_list.php b/application/modules/Leave/views/leave_list.php
index 950941d..295870d 100644
--- a/application/modules/Leave/views/leave_list.php
+++ b/application/modules/Leave/views/leave_list.php
@@ -117,7 +117,7 @@
status == 'Withdraw-declined'){ ?>
status; ?> By
- declined_by; ?>
" DReason; ?> "
+ DeclineBy; ?>
" DReason; ?> "
status == 'Withdraw-Approved'){ ?>
status; ?> By