tracker issue and leave mster
This commit is contained in:
parent
702ba6dd05
commit
3dac74521d
@ -110,10 +110,11 @@ public function rise_expence_request()
|
|||||||
'manager_id' => $manager,
|
'manager_id' => $manager,
|
||||||
'status' => 'Draft',
|
'status' => 'Draft',
|
||||||
// 'date_of_expense'=> $this->input->post('date_of_expence')[$i],
|
// '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],
|
'amount' => $this->input->post('amount')[$i],
|
||||||
'description' => $this->input->post('description')[$i],
|
'description' => $this->input->post('description')[$i],
|
||||||
);
|
);
|
||||||
|
// print_r($data2);die;
|
||||||
$this->load->library('upload');
|
$this->load->library('upload');
|
||||||
|
|
||||||
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
|
$config['upload_path'] = APPPATH. '../assets/uploads/Expence_Bill/';
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
.alert-success {
|
.alert-success {
|
||||||
background-color: #dff0d8;
|
background-color: #dff0d8;
|
||||||
color: #3c763d;
|
color: #3c763d;
|
||||||
border-color: #d6e9c6;
|
border-color: #d6e9c6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flash-message {
|
.flash-message {
|
||||||
@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hide-arrow {
|
.hide-arrow {
|
||||||
|
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
@ -76,7 +76,7 @@
|
|||||||
text: 'Only change and Update',
|
text: 'Only change and Update',
|
||||||
styling: 'bootstrap3'
|
styling: 'bootstrap3'
|
||||||
});">Success</button>
|
});">Success</button>
|
||||||
<input type="hidden" id="error" value="<?php echo $this->session->userdata('remove_row');?>" >
|
<input type="hidden" id="error" value="<?php echo $this->session->userdata('remove_row');?>" >
|
||||||
<?php $this->session->unset_userdata('remove_row');?>
|
<?php $this->session->unset_userdata('remove_row');?>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@ -93,12 +93,12 @@
|
|||||||
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-primary" style="margin-top: 20px; font-size: small;">Back</a>
|
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-primary" style="margin-top: 20px; font-size: small;">Back</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
|
|
||||||
<?php if($expense_data[0]->status == 'Draft') { ?>
|
<?php if($expense_data[0]->status == 'Draft') { ?>
|
||||||
|
|
||||||
Edit Expense - <?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>
|
Edit Expense - <?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>
|
||||||
|
|
||||||
<?php } else { echo $expense_data[0]->expense_name; } ?>
|
<?php } else { echo $expense_data[0]->expense_name; } ?>
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
@ -109,20 +109,20 @@
|
|||||||
<br />
|
<br />
|
||||||
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Expence/edit_rise_expence_request" enctype="multipart/form-data">
|
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Expence/edit_rise_expence_request" enctype="multipart/form-data">
|
||||||
|
|
||||||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||||||
|
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="item form-group">
|
<div class="item form-group">
|
||||||
|
|
||||||
<label class="control-label col-md-2 col-sm-2" for="last-name">Expense Requisted For</label>
|
<label class="control-label col-md-2 col-sm-2" for="last-name">Expense Requested For</label>
|
||||||
<div class="col-md-4 col-sm-4 ">
|
<div class="col-md-4 col-sm-4 ">
|
||||||
|
|
||||||
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
|
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
|
||||||
|
|
||||||
<input type="radio" name="created_by" value="<?php echo user()->name;?> (<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
|
<input type="radio" name="created_by" value="<?php echo user()->name;?> (<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Employee Name <a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Employee Name <a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control manager" > </select>
|
<select id="user_dropdown" name="emp_id" style="margin-top: 10px;padding-bottom: 10px;" class="form-control manager" > </select>
|
||||||
@ -139,18 +139,18 @@
|
|||||||
<input type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' required />
|
<input type='text' class="form-control" name="expense_name" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->expense_name; } ?>" autocomplete='off' required />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="first-name">Business Reason</label>
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Business Reason</label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>" autocomplete='off'/>
|
<input type='text' class="form-control" name="business_reason" value="<?php if(isset($expense_data[0]->id)){echo $expense_data[0]->business_reason; } ?>" autocomplete='off'/>
|
||||||
|
|
||||||
<input type="hidden" id="expense_id" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
<input type="hidden" id="expense_id" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -158,7 +158,7 @@
|
|||||||
|
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="x_title">
|
<div class="x_title">
|
||||||
<!-- <ul class="nav navbar-right panel_toolbox">
|
<!-- <ul class="nav navbar-right panel_toolbox">
|
||||||
<button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-info" style="font-size:small;" >Add</button>
|
<button type="button" id="add-button" onclick="createAndAppendFormGroup()" class="btn btn-info" style="font-size:small;" >Add</button>
|
||||||
</ul> -->
|
</ul> -->
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
@ -182,18 +182,18 @@
|
|||||||
else if($value->status == "Cancelled")
|
else if($value->status == "Cancelled")
|
||||||
{
|
{
|
||||||
echo $value->status.' at '.date('d-m-Y h:i:s', strtotime($value->cancelled_at));
|
echo $value->status.' at '.date('d-m-Y h:i:s', strtotime($value->cancelled_at));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo $value->status;
|
echo $value->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
">
|
">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -202,9 +202,14 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence[]" value="<?php echo $value->date_of_expense_new ?>" autocomplete='off'/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
<?php
|
||||||
|
// Assuming $leave->perm_date_new is in the 'Y-m-d' format
|
||||||
|
$formatted_date = date('d-m-y', strtotime($value->date_of_expense_new));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<input type='text' id="ExpenseDate<?php echo $i;?>" class="form-control date" placeholder="DD-MM-YYYY" required name="date_of_expence_new[]" value="<?php echo $formatted_date ?>" autocomplete='off'/><i class="fa fa-calendar" style=" position: absolute; right: 25px; top: 12px;z-index: 0;"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="first-name">Amount<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Amount<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5">
|
<div class="col-md-5 col-sm-5">
|
||||||
@ -220,14 +225,14 @@
|
|||||||
<textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ><?php echo $value->description ?></textarea>
|
<textarea id="comments" name="description[]" value="" class="form-control" style="height:50px !important;" type="text" ><?php echo $value->description ?></textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1" required for="first-name">Recipt</label>
|
<label class="control-label col-md-1 col-sm-1" required for="first-name">Recipt</label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple><br>
|
<input id="formFile" name="bill[]" onchange="validateFile(this)" class="typeFile" type="file" value="<?php echo $value->bill ?>" multiple><br>
|
||||||
|
|
||||||
<a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $value->bill; ?>)</b></a></div>
|
<a href="<?php echo base_url(); ?>assets/uploads/Expence_Bill/<?php echo $value->bill; ?>" target="_blank" class="float-right" style="font-size: x-small; color: darkblue; margin-top: 7px;"><b>View Recipt(<?php echo $value->bill; ?>)</b></a></div>
|
||||||
|
|
||||||
<?php if($expense_data[0]->status == 'Draft') { ?>
|
<?php if($expense_data[0]->status == 'Draft') { ?>
|
||||||
|
|
||||||
<div class="col-12"><button type="button" class="float-right btn btn-danger deleteexpense hidebtn" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo $value->id;?>"><i class="fa fa-trash"></i></button>
|
<div class="col-12"><button type="button" class="float-right btn btn-danger deleteexpense hidebtn" data-toggle="modal" data-target=".bs-example-modal-sm" id="<?php echo $value->id;?>"><i class="fa fa-trash"></i></button>
|
||||||
|
|
||||||
@ -242,13 +247,13 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
flatpickr($('#ExpenseDate'+<?php echo $i;?>), {
|
flatpickr($('#ExpenseDate'+<?php echo $i;?>), {
|
||||||
dateFormat: 'd-m-Y',
|
dateFormat: 'd-m-Y',
|
||||||
changeYear: true,
|
changeYear: true,
|
||||||
yearRange: '2000:' + new Date().getFullYear(),
|
yearRange: '2000:' + new Date().getFullYear(),
|
||||||
maxDate: new Date(),
|
maxDate: new Date(),
|
||||||
autoclose:true,
|
autoclose:true,
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
|
|
||||||
onChange: function(selectedDates, dateStr) {
|
onChange: function(selectedDates, dateStr) {
|
||||||
console.log('Selected date: ', dateStr);
|
console.log('Selected date: ', dateStr);
|
||||||
instance._input.removeAttribute("readonly");
|
instance._input.removeAttribute("readonly");
|
||||||
@ -267,7 +272,7 @@
|
|||||||
<div class="ln_solid"></div>
|
<div class="ln_solid"></div>
|
||||||
<div class="item form-group">
|
<div class="item form-group">
|
||||||
<div class=" offset-md-8">
|
<div class=" offset-md-8">
|
||||||
<?php if($expense_data[0]->status == 'Draft') { ?>
|
<?php if($expense_data[0]->status == 'Draft') { ?>
|
||||||
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-secondary">Cancel</a>
|
<a href="<?php echo base_url();?>Expence/emp_expence_list" class="btn btn-secondary">Cancel</a>
|
||||||
<button type="submit" class="btn btn-success" name="update" value="update">Update</button>
|
<button type="submit" class="btn btn-success" name="update" value="update">Update</button>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -278,8 +283,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -295,10 +300,10 @@
|
|||||||
<!-- /Body page content -->
|
<!-- /Body page content -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// hide the dropdown arrow
|
// hide the dropdown arrow
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#user_dropdown").addClass("hide-arrow");
|
$("#user_dropdown").addClass("hide-arrow");
|
||||||
$("input[name='created_by']").on("change", function() {
|
$("input[name='created_by']").on("change", function() {
|
||||||
@ -327,16 +332,16 @@
|
|||||||
// console.log(datepickerInput);
|
// console.log(datepickerInput);
|
||||||
|
|
||||||
// flatpickr(datepickerInput, {
|
// flatpickr(datepickerInput, {
|
||||||
// dateFormat: 'd-m-Y',
|
// dateFormat: 'd-m-Y',
|
||||||
// maxDate: new Date(),
|
// maxDate: new Date(),
|
||||||
|
|
||||||
// onChange: function(selectedDates, dateStr) {
|
// onChange: function(selectedDates, dateStr) {
|
||||||
// console.log('Selected date: ', dateStr);
|
// console.log('Selected date: ', dateStr);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
function validateFile(input) {
|
function validateFile(input) {
|
||||||
const file = input.files[0];
|
const file = input.files[0];
|
||||||
@ -370,17 +375,17 @@ function matchnum(event)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
var currentUserName = '<?php echo user()->name; ?>';
|
var currentUserName = '<?php echo user()->name; ?>';
|
||||||
var currentUserId = '<?php echo user()->id; ?>';
|
var currentUserId = '<?php echo user()->id; ?>';
|
||||||
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
$('#user_dropdown').append('<option value="' + currentUserId + '">' +
|
||||||
currentUserName + '</option>');
|
currentUserName + '</option>');
|
||||||
$('#user_dropdown').prop('disabled', true);
|
$('#user_dropdown').prop('disabled', true);
|
||||||
|
|
||||||
$('#user_dropdown').on('change',function() {
|
$('#user_dropdown').on('change',function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[type="radio"][name="created_by"]').change(function() {
|
$('input[type="radio"][name="created_by"]').change(function() {
|
||||||
@ -392,7 +397,7 @@ function matchnum(event)
|
|||||||
$userDropdown.empty();
|
$userDropdown.empty();
|
||||||
|
|
||||||
if (selectedValue === 'self (<?php echo user()->id;?>)') {
|
if (selectedValue === 'self (<?php echo user()->id;?>)') {
|
||||||
|
|
||||||
var currentUserName = '<?php echo user()->name; ?>';
|
var currentUserName = '<?php echo user()->name; ?>';
|
||||||
var currentUserId = '<?php echo user()->id; ?>';
|
var currentUserId = '<?php echo user()->id; ?>';
|
||||||
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
|
$userDropdown.append('<option value="' + currentUserId + '">' + currentUserName + '</option>');
|
||||||
@ -400,7 +405,7 @@ function matchnum(event)
|
|||||||
} else if (selectedValue === '<?php echo user()->name; ?> (<?php echo user()->id;?>)') {
|
} else if (selectedValue === '<?php echo user()->name; ?> (<?php echo user()->id;?>)') {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
|
url: '<?php echo base_url('Expence/get_emp_name/')?>"',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
@ -414,13 +419,13 @@ function matchnum(event)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
//get manager id from the dropdown employee assign the value to $("#manager_id") input field
|
//get manager id from the dropdown employee assign the value to $("#manager_id") input field
|
||||||
|
|
||||||
$("#user_dropdown").on("change", function(){
|
$("#user_dropdown").on("change", function(){
|
||||||
@ -430,7 +435,7 @@ function matchnum(event)
|
|||||||
|
|
||||||
$("#manager_id").val(manager_id);
|
$("#manager_id").val(manager_id);
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -463,10 +468,10 @@ function createAndAppendFormGroup() {
|
|||||||
//formContainer.innerHTML += html1;
|
//formContainer.innerHTML += html1;
|
||||||
formContainer.insertAdjacentHTML('beforeend', html1);
|
formContainer.insertAdjacentHTML('beforeend', html1);
|
||||||
|
|
||||||
|
|
||||||
const datepickerInput = document.getElementById('datepicker'+i);
|
const datepickerInput = document.getElementById('datepicker'+i);
|
||||||
flatpickr(datepickerInput, {
|
flatpickr(datepickerInput, {
|
||||||
dateFormat: 'd-m-Y',
|
dateFormat: 'd-m-Y',
|
||||||
maxDate: new Date(),
|
maxDate: new Date(),
|
||||||
autoclose:true,
|
autoclose:true,
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
@ -474,9 +479,9 @@ function createAndAppendFormGroup() {
|
|||||||
onChange: function(selectedDates, dateStr) {
|
onChange: function(selectedDates, dateStr) {
|
||||||
console.log('Selected date: ', dateStr);
|
console.log('Selected date: ', dateStr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removebutton(index) {
|
function removebutton(index) {
|
||||||
@ -496,14 +501,14 @@ function removebutton(index) {
|
|||||||
var expence_id = document.getElementById('expense_id').value;
|
var expence_id = document.getElementById('expense_id').value;
|
||||||
var url = "<?php echo base_url()?>Expence/remove_row";
|
var url = "<?php echo base_url()?>Expence/remove_row";
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
url: "<?php echo base_url()?>Expence/getCancelConfirmationPopup",
|
||||||
type:"GET",
|
type:"GET",
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$('#popup').html(JSON.parse(data));
|
$('#popup').html(JSON.parse(data));
|
||||||
$('.delete_id').attr('value',id);
|
$('.delete_id').attr('value',id);
|
||||||
$('.expence_id').attr('value',expence_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;
|
// var id = document.getElementById('expense_id').value;
|
||||||
// alert(id)
|
// alert(id)
|
||||||
|
|
||||||
// $('.hidebtn').disable()
|
// $('.hidebtn').disable()
|
||||||
|
|
||||||
// // $.ajax({
|
// // $.ajax({
|
||||||
// // data:{id : id},
|
// // data:{id : id},
|
||||||
// // url: "<?php echo base_url()?>Expence/get_expense_child_count",
|
// // url: "<?php echo base_url()?>Expence/get_expense_child_count",
|
||||||
// // type:"GET",
|
// // type:"GET",
|
||||||
// // success:function(data){
|
// // success:function(data){
|
||||||
// // $('#popup').html(JSON.parse(data));
|
// // $('#popup').html(JSON.parse(data));
|
||||||
// // $('.delete_id').attr('value',id);
|
// // $('.delete_id').attr('value',id);
|
||||||
// // $('.expence_id').attr('value',expence_id);
|
// // $('.expence_id').attr('value',expence_id);
|
||||||
// // $('.delete_url').attr('action',url);
|
// // $('.delete_url').attr('action',url);
|
||||||
// // }
|
// // }
|
||||||
// // });
|
// // });
|
||||||
// });
|
// });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -144,7 +144,12 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
<label class="control-label col-md-1 col-sm-1 label-align" for="first-name"> Date of Expense<a style="color:red;">*</a></label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence_new[]" value="<?php echo $value->date_of_expense ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
|
<?php
|
||||||
|
// Assuming $leave->perm_date_new is in the 'Y-m-d' format
|
||||||
|
$formatted_date = date('d-m-y', strtotime($value->date_of_expense_new));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<input type='date' id='ExpenseDate' class="form-control" placeholder="DD-MM-YYYY" required name="date_of_expence_new[]" value="<?php echo $formatted_date ?>" autocomplete='off' /><i class="fa fa-calendar"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
<input type="hidden" name="expense_pid" value="<?php echo $expense_data[0]->id; ?>">
|
||||||
|
|||||||
@ -198,7 +198,7 @@
|
|||||||
<tr class="even pointer">
|
<tr class="even pointer">
|
||||||
<td hidden><?php echo $value->id; ?></td>
|
<td hidden><?php echo $value->id; ?></td>
|
||||||
<td><?php echo date('d-m-Y', strtotime($value->created_on));?></td>
|
<td><?php echo date('d-m-Y', strtotime($value->created_on));?></td>
|
||||||
<td class=" "><?php echo date('d-m-Y', strtotime($value->date_of_expense)) ?></td>
|
<td class=" "><?php echo date('d-m-Y', strtotime($value->date_of_expense_new)) ?></td>
|
||||||
<td class=" "><?php echo $value->amount; ?></td>
|
<td class=" "><?php echo $value->amount; ?></td>
|
||||||
<td class=" "><?php echo $value->description; ?></td>
|
<td class=" "><?php echo $value->description; ?></td>
|
||||||
<?php if($value->status == 'pending'){ ?>
|
<?php if($value->status == 'pending'){ ?>
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public function leave_list_report()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array_values($resultArray);
|
$result = array_values($resultArray);
|
||||||
// echo json_encode( $result, JSON_PRETTY_PRINT);die;
|
// echo json_encode( $result, JSON_PRETTY_PRINT);die;
|
||||||
$this->layout->set('leave_list', $result);
|
$this->layout->set('leave_list', $result);
|
||||||
@ -165,19 +165,20 @@ public function createLeave()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$manager = employee()->manager;
|
$manager = employee()->manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$manager = $this->input->post('manager');
|
$manager = $this->input->post('manager');
|
||||||
}
|
}
|
||||||
$perm_data['manager'] = $manager;
|
$perm_data['manager'] = $manager;
|
||||||
$perm_data['business_id'] = user()->business_id;
|
$perm_data['business_id'] = user()->business_id;
|
||||||
$perm_data['status'] = 'pending';
|
$perm_data['status'] = 'pending';
|
||||||
// $perm_data['created_date'] = date('d-m-Y');
|
// $perm_data['created_date'] = date('d-m-Y');
|
||||||
$perm_data['created_date_new'] = date('d-m-Y');
|
$perm_data['created_date_new'] = date('Y-m-d');
|
||||||
|
|
||||||
$perm_data['created_time'] = date('H:i A');
|
$perm_data['created_time'] = date('H:i A');
|
||||||
unset($perm_data['from_date']);
|
unset($perm_data['from_date']);
|
||||||
unset($perm_data['to_date']);
|
unset($perm_data['to_date']);
|
||||||
@ -185,35 +186,36 @@ public function createLeave()
|
|||||||
unset($perm_data['to_date_new']);
|
unset($perm_data['to_date_new']);
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$perm_data['perm_date_new'] = date("Y-m-d", strtotime( $this->input->post('perm_date_new') ));
|
$perm_data['perm_date_new'] = date("Y-m-d", strtotime( $this->input->post('perm_date_new') ));
|
||||||
|
|
||||||
$create_permission = $this->MY_Model->insert($perm_data,$table);
|
$create_permission = $this->MY_Model->insert($perm_data,$table);
|
||||||
|
|
||||||
//for notification
|
//for notification
|
||||||
if($create_permission){
|
if($create_permission){
|
||||||
$code = 'LEAVE_PERMISSION';
|
$code = 'LEAVE_PERMISSION';
|
||||||
$type = 'Email';
|
$type = 'Email';
|
||||||
$this->notification->sendNotification($create_permission, $code, $type);
|
$this->notification->sendNotification($create_permission, $code, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->session->set_flashdata('Success', '1');
|
$this->session->set_flashdata('Success', '1');
|
||||||
redirect('Leave/LeaveHistory');
|
redirect('Leave/LeaveHistory');
|
||||||
}
|
}
|
||||||
//end of permission
|
//end of permission
|
||||||
|
|
||||||
|
|
||||||
//Leave create part
|
//Leave create part
|
||||||
$data = $this->input->post();
|
$data = $this->input->post();
|
||||||
unset($data['perm_date']);
|
unset($data['perm_date']);
|
||||||
unset($data['perm_date_new']);
|
unset($data['perm_date_new']);
|
||||||
unset($data['from_time']);
|
unset($data['from_time']);
|
||||||
unset($data['to_time']);
|
unset($data['to_time']);
|
||||||
|
|
||||||
if(isset($data['emp_id'])){
|
if(isset($data['emp_id'])){
|
||||||
$emp_id =$this->input->post('emp_id');
|
$emp_id =$this->input->post('emp_id');
|
||||||
}else{
|
}else{
|
||||||
$emp_id = user()->id;
|
$emp_id = user()->id;
|
||||||
}
|
}
|
||||||
$data['emp_id'] = $emp_id;
|
$data['emp_id'] = $emp_id;
|
||||||
|
|
||||||
if($data['manager']==""){
|
if($data['manager']==""){
|
||||||
if(employee()->manager == null)
|
if(employee()->manager == null)
|
||||||
{
|
{
|
||||||
@ -221,12 +223,12 @@ public function createLeave()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$manager = employee()->manager;
|
$manager = employee()->manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$manager = $this->input->post('manager');
|
$manager = $this->input->post('manager');
|
||||||
}
|
}
|
||||||
$data['manager'] = $manager;
|
$data['manager'] = $manager;
|
||||||
@ -236,23 +238,23 @@ public function createLeave()
|
|||||||
$perm_data['created_date_new'] = date('d-m-Y');
|
$perm_data['created_date_new'] = date('d-m-Y');
|
||||||
$data['created_time'] = date('H:i A');
|
$data['created_time'] = date('H:i A');
|
||||||
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
||||||
|
|
||||||
//get employee's leave count
|
//get employee's leave count
|
||||||
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
||||||
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// count number of days between two dates
|
// count number of days between two dates
|
||||||
$days_between = ceil(abs(strtotime($this->input->post('to_date_new')) - strtotime($this->input->post('from_date_new'))) / 86400);
|
$days_between = ceil(abs(strtotime($this->input->post('to_date_new')) - strtotime($this->input->post('from_date_new'))) / 86400);
|
||||||
$data['no_of_days'] = $days_between + 1;
|
$data['no_of_days'] = $days_between + 1;
|
||||||
$noofdays = $days_between + 1;
|
$noofdays = $days_between + 1;
|
||||||
|
|
||||||
|
|
||||||
//this part is create and update leave data
|
//this part is create and update leave data
|
||||||
if (count($emp_leave_count) != 0)
|
if (count($emp_leave_count) != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($noofdays > $emp_leave_count[0]->remaining_days)
|
if($noofdays > $emp_leave_count[0]->remaining_days)
|
||||||
{
|
{
|
||||||
$this->session->set_flashdata('error', '1');
|
$this->session->set_flashdata('error', '1');
|
||||||
@ -265,7 +267,7 @@ public function createLeave()
|
|||||||
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
||||||
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -279,26 +281,26 @@ public function createLeave()
|
|||||||
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||||
$data['leave_bal'] = $all_leave_count[0]->days;
|
$data['leave_bal'] = $all_leave_count[0]->days;
|
||||||
$days['remaining_days'] = $all_leave_count[0]->days;
|
$days['remaining_days'] = $all_leave_count[0]->days;
|
||||||
|
|
||||||
$days['business_id'] = user()->business_id;
|
$days['business_id'] = user()->business_id;
|
||||||
$days['emp_id'] = $emp_id;
|
$days['emp_id'] = $emp_id;
|
||||||
$days['total_days'] = $all_leave_count[0]->days;
|
$days['total_days'] = $all_leave_count[0]->days;
|
||||||
$days['type'] = $all_leave_count[0]->id;
|
$days['type'] = $all_leave_count[0]->id;
|
||||||
$days['year'] = $leave_year;
|
$days['year'] = $leave_year;
|
||||||
$this->MY_Model->insert($days,'emp_leave_days');
|
$this->MY_Model->insert($days,'emp_leave_days');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$get_emp_data = $this->Leave_model->get_emp_data_by_emp_id($emp_id);
|
$get_emp_data = $this->Leave_model->get_emp_data_by_emp_id($emp_id);
|
||||||
// echo json_encode( $get_emp_data);die;
|
// echo json_encode( $get_emp_data);die;
|
||||||
// print_r($get_emp_data[0]->j_date); die;
|
// print_r($get_emp_data[0]->j_date); die;
|
||||||
|
|
||||||
$from_date = new DateTime($this->input->post('from_date_new'));
|
$from_date = new DateTime($this->input->post('from_date_new'));
|
||||||
$j_date = new DateTime($get_emp_data[0]->j_date);
|
$j_date = new DateTime($get_emp_data[0]->j_date);
|
||||||
$to_date = new DateTime($this->input->post('to_date_new'));
|
$to_date = new DateTime($this->input->post('to_date_new'));
|
||||||
|
|
||||||
|
|
||||||
if ($from_date >= $j_date && $from_date <= $to_date) {
|
if ($from_date >= $j_date && $from_date <= $to_date) {
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$data['from_date_new'] = date("Y-m-d", strtotime( $this->input->post('from_date_new') ));
|
$data['from_date_new'] = date("Y-m-d", strtotime( $this->input->post('from_date_new') ));
|
||||||
@ -308,15 +310,15 @@ public function createLeave()
|
|||||||
} else {
|
} else {
|
||||||
$this->session->set_flashdata('error', '1');
|
$this->session->set_flashdata('error', '1');
|
||||||
redirect('Leave/applyLeave/'.'update');
|
redirect('Leave/applyLeave/'.'update');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($create_leave){
|
if($create_leave){
|
||||||
$code = 'APPLY_LEAVE';
|
$code = 'APPLY_LEAVE';
|
||||||
$type = 'Email';
|
$type = 'Email';
|
||||||
$mailres = $this->notification->sendNotification($create_leave, $code, $type);
|
$mailres = $this->notification->sendNotification($create_leave, $code, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//audit
|
//audit
|
||||||
if($create_leave)
|
if($create_leave)
|
||||||
{
|
{
|
||||||
@ -334,8 +336,8 @@ public function createLeave()
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "An error occurred: " . $e->getMessage();
|
echo "An error occurred: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -351,7 +353,7 @@ public function edit_leave_function()
|
|||||||
// print_r($leavetype);
|
// print_r($leavetype);
|
||||||
// print_r($id);
|
// print_r($id);
|
||||||
// print_r($editleave);
|
// print_r($editleave);
|
||||||
// // // print_r($emp);
|
// print_r($emp);
|
||||||
// die;
|
// die;
|
||||||
$this->layout->set('emp', $emp);
|
$this->layout->set('emp', $emp);
|
||||||
$this->layout->set('editleave', $editleave);
|
$this->layout->set('editleave', $editleave);
|
||||||
@ -367,8 +369,8 @@ public function editleave()
|
|||||||
if($this->input->post('type') === '1')
|
if($this->input->post('type') === '1')
|
||||||
{
|
{
|
||||||
$action = $this->input->post();
|
$action = $this->input->post();
|
||||||
unset($action['from_date']);
|
unset($action['from_date_new']);
|
||||||
unset($action['to_date']);
|
unset($action['to_date_new']);
|
||||||
$id = $this->input->post('id');
|
$id = $this->input->post('id');
|
||||||
|
|
||||||
if(isset($action['emp_id'])){
|
if(isset($action['emp_id'])){
|
||||||
@ -385,10 +387,13 @@ public function editleave()
|
|||||||
$action['manager'] = $manager;
|
$action['manager'] = $manager;
|
||||||
$action['business_id'] = user()->business_id;
|
$action['business_id'] = user()->business_id;
|
||||||
$action['status'] = 'pending';
|
$action['status'] = 'pending';
|
||||||
|
$action['perm_date_new'] = date('Y-m-d', strtotime($this->input->post('perm_date_new')));
|
||||||
|
|
||||||
$action['created_date'] = date('d-m-Y');
|
$action['created_date'] = date('d-m-Y');
|
||||||
$action['created_time'] = date('H:i A');
|
$action['created_time'] = date('H:i A');
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
|
$create_permission = $this->MY_Model->edit_option($action, $id, $table);
|
||||||
|
|
||||||
$this->session->set_flashdata('update', '0');
|
$this->session->set_flashdata('update', '0');
|
||||||
redirect('Leave/LeaveHistory');
|
redirect('Leave/LeaveHistory');
|
||||||
}
|
}
|
||||||
@ -405,27 +410,37 @@ public function editleave()
|
|||||||
$action['emp_id'] = $emp_id;
|
$action['emp_id'] = $emp_id;
|
||||||
$action['business_id'] = user()->business_id;
|
$action['business_id'] = user()->business_id;
|
||||||
$action['status'] = 'pending';
|
$action['status'] = 'pending';
|
||||||
$leave_year = date('Y', strtotime($this->input->post('from_date')));
|
$action['from_date_new'] = date('Y-m-d', strtotime($this->input->post('from_date_new')));
|
||||||
|
$action['to_date_new'] = date('Y-m-d', strtotime($this->input->post('to_date_new')));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
||||||
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
$emp_leave_count = $this->Leave_model->get_leave( $emp_id , user()->business_id , "emp_leave_days", $leave_year, $this->input->post('type'));
|
||||||
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
$leave_master_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||||
|
|
||||||
|
|
||||||
// count number of days between two dates
|
// count number of days between two dates
|
||||||
$days_between = ceil(abs(strtotime($this->input->post('to_date')) - strtotime($this->input->post('from_date'))) / 86400);
|
$days_between = ceil(abs(strtotime(date('Y-m-d', strtotime($this->input->post('to_date_new')))) - strtotime(date('Y-m-d', strtotime($this->input->post('from_date_new'))))) / 86400);
|
||||||
|
|
||||||
$action['no_of_days'] = $days_between + 1;
|
$action['no_of_days'] = $days_between + 1;
|
||||||
$noofdays = $days_between + 1;
|
$noofdays = $days_between + 1;
|
||||||
$leave_id = $this->input->post('id');
|
$leave_id = $this->input->post('id');
|
||||||
if (count($emp_leave_count) != 0)
|
if (count($emp_leave_count) != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($noofdays > $emp_leave_count[0]->remaining_days)
|
if($noofdays > $emp_leave_count[0]->remaining_days)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->session->set_flashdata('error', '1');
|
$this->session->set_flashdata('error', '1');
|
||||||
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
//this part is update if date inculeded in emp_leave_days table
|
//this part is update if date inculeded in emp_leave_days table
|
||||||
$action['leave_bal'] = $emp_leave_count[0]->remaining_days;
|
$action['leave_bal'] = $emp_leave_count[0]->remaining_days;
|
||||||
|
|
||||||
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
$days['remaining_days'] = $emp_leave_count[0]->remaining_days;
|
||||||
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
$this->Leave_model->update_leave($days, $emp_id , 'emp_leave_days', $leave_year, $this->input->post('type'));
|
||||||
}
|
}
|
||||||
@ -433,11 +448,15 @@ public function editleave()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($noofdays > $leave_master_count[0]->days)
|
if($noofdays > $leave_master_count[0]->days)
|
||||||
{ $this->session->set_flashdata('error', '1');
|
{
|
||||||
|
|
||||||
|
$this->session->set_flashdata('error', '1');
|
||||||
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
redirect('Leave/edit_leave_function?id='.md5($leave_id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
echo "else stss";
|
||||||
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
$all_leave_count = $this->Leave_model->get_by_type( $this->input->post('type') , user()->business_id , "leave_master");
|
||||||
$data['leave_bal'] = $all_leave_count[0]->days;
|
$data['leave_bal'] = $all_leave_count[0]->days;
|
||||||
$days['remaining_days'] = $all_leave_count[0]->days;
|
$days['remaining_days'] = $all_leave_count[0]->days;
|
||||||
@ -452,14 +471,16 @@ public function editleave()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date'), $this->input->post('to_date'));
|
$get_from_date = $this->Leave_model->get_from_date($emp_id, $this->input->post('from_date_new'), $this->input->post('to_date_new'));
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
// print_r($get_from_date); die();
|
|
||||||
|
|
||||||
if($get_from_date == 0)
|
if($get_from_date == 0)
|
||||||
{
|
{
|
||||||
|
echo"update fun:";
|
||||||
$table="leave_list";
|
$table="leave_list";
|
||||||
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
|
$update_leave = $this->MY_Model->edit_option($action,$id,$table);
|
||||||
|
|
||||||
$this->session->set_flashdata('update', '0');
|
$this->session->set_flashdata('update', '0');
|
||||||
redirect('Leave/LeaveHistory');
|
redirect('Leave/LeaveHistory');
|
||||||
}
|
}
|
||||||
@ -488,6 +509,7 @@ public function get_all_leave_count()
|
|||||||
{
|
{
|
||||||
$id = $this->input->get('type_id');
|
$id = $this->input->get('type_id');
|
||||||
$all_leave_count = $this->Leave_model->get_id( $id , user()->business_id , "leave_master");
|
$all_leave_count = $this->Leave_model->get_id( $id , user()->business_id , "leave_master");
|
||||||
|
|
||||||
echo json_encode($all_leave_count);
|
echo json_encode($all_leave_count);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -512,14 +534,16 @@ public function ApproveLeave()
|
|||||||
$business_id = user()->business_id;
|
$business_id = user()->business_id;
|
||||||
$emp_id = $this->Leave_model->get_emp_id($id);
|
$emp_id = $this->Leave_model->get_emp_id($id);
|
||||||
$no_of_days = $this->Leave_model->get_Leave_nodays($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);
|
$leave_type = $this->Leave_model->get_leave_data_using_leave_id($id);
|
||||||
|
|
||||||
|
// print_r($leave_year);
|
||||||
|
|
||||||
if($leave_type->leave_code !== 'permission')
|
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;
|
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
|
||||||
|
// print_r($balance_days);die;
|
||||||
$data['leave_bal'] = $balance_days;
|
$data['leave_bal'] = $balance_days;
|
||||||
$days['remaining_days'] = $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);
|
$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;
|
$business_id = user()->business_id;
|
||||||
$emp_id = $this->Leave_model->get_emp_id($id);
|
$emp_id = $this->Leave_model->get_emp_id($id);
|
||||||
$no_of_days = $this->Leave_model->get_Leave_nodays($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);
|
$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);
|
$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;
|
$business_id = user()->business_id;
|
||||||
$emp_id = $this->Leave_model->get_emp_id($id);
|
$emp_id = $this->Leave_model->get_emp_id($id);
|
||||||
$no_of_days = $this->Leave_model->get_Leave_nodays($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);
|
$leave_type = $this->Leave_model->get_leave_data_using_leave_id($id);
|
||||||
|
|
||||||
if($leave_type->leave_code !== 'permission')
|
if($leave_type->leave_code !== 'permission')
|
||||||
@ -730,7 +754,7 @@ public function ApprovewithdrawLeave()
|
|||||||
|
|
||||||
// Update leave balance
|
// Update leave balance
|
||||||
$emp_id = $this->Leave_model->get_emp_id($id);
|
$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);
|
$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;
|
$balance_days = $remaining_days[0]->remaining_days + $leave_data->no_of_days;
|
||||||
|
|
||||||
|
|||||||
@ -180,6 +180,7 @@ public function remaining_days($emp_id, $business_id, $leave_year, $type)
|
|||||||
$this->db->where('is_active', 1);
|
$this->db->where('is_active', 1);
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
$query = $query->result();
|
$query = $query->result();
|
||||||
|
// print_r($this->db->last_query());
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,8 +512,8 @@ public function get_from_date($emp_id, $from_date, $to_date)
|
|||||||
$this->db->select('*');
|
$this->db->select('*');
|
||||||
$this->db->from('leave_list');
|
$this->db->from('leave_list');
|
||||||
$this->db->where('emp_id', $emp_id);
|
$this->db->where('emp_id', $emp_id);
|
||||||
$this->db->where('from_date >=', $from_date);
|
$this->db->where('from_date_new >=', $from_date);
|
||||||
$this->db->where('to_date <=', $to_date);
|
$this->db->where('to_date_new <=', $to_date);
|
||||||
$query = $this->db->count_all_results();
|
$query = $this->db->count_all_results();
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
@ -544,8 +545,8 @@ public function get_approved_leaves_cur_week()
|
|||||||
$this->db->from('leave_list');
|
$this->db->from('leave_list');
|
||||||
$this->db->join('users', 'users.id = leave_list.emp_id', 'left');
|
$this->db->join('users', 'users.id = leave_list.emp_id', 'left');
|
||||||
$this->db->group_start();
|
$this->db->group_start();
|
||||||
$this->db->where("STR_TO_DATE(from_date, '%d-%m-%Y') <= '$currentWeekEnd'");
|
$this->db->where("STR_TO_DATE(from_date_new, '%d-%m-%Y') <= '$currentWeekEnd'");
|
||||||
$this->db->where("STR_TO_DATE(to_date, '%d-%m-%Y') >= '$currentWeekStart'");
|
$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') <= '$currentWeekEnd'");
|
||||||
$this->db->or_where("STR_TO_DATE(perm_date, '%d-%m-%Y') >= '$currentWeekStart'");
|
$this->db->or_where("STR_TO_DATE(perm_date, '%d-%m-%Y') >= '$currentWeekStart'");
|
||||||
$this->db->group_end();
|
$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
|
// Organize approved leave records into columns based on days of the week
|
||||||
$weekData = [];
|
$weekData = [];
|
||||||
foreach ($approvedLeaveRecords as $leave) {
|
foreach ($approvedLeaveRecords as $leave) {
|
||||||
$leaveStartDate = ($leave->from_date) ? date('Y-m-d', strtotime($leave->from_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) ? date('Y-m-d', strtotime($leave->to_date)) : 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
|
// Use from_time and to_time if available
|
||||||
$fromTime = ($leave->from_time) ? ' ' . $leave->from_time : '';
|
$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'));
|
$startOfWeek = date('Y-m-d', strtotime('monday this week'));
|
||||||
$endOfWeek = date('Y-m-d', strtotime('sunday this week'));
|
$endOfWeek = date('Y-m-d', strtotime('sunday this week'));
|
||||||
|
|
||||||
// Query to get leave records for the specified employee within the current 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->select('A.*, U1.name as employee_name');
|
||||||
$this->db->from('leave_list A');
|
$this->db->from('leave_list A');
|
||||||
@ -606,7 +607,7 @@ public function get_week_leave_count($business_id)
|
|||||||
'friday' => [],
|
'friday' => [],
|
||||||
'saturday' => []
|
'saturday' => []
|
||||||
);
|
);
|
||||||
|
|
||||||
// Iterate over the leave records to count leaves for each day of the week
|
// Iterate over the leave records to count leaves for each day of the week
|
||||||
foreach ($leaveRecords as $key => $record) {
|
foreach ($leaveRecords as $key => $record) {
|
||||||
if($record->from_date_new < $startOfWeek)
|
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
|
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 the array with leave counts for each day of the week
|
||||||
return $weeklyLeaveCounts;
|
return $weeklyLeaveCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Balance</label>
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Balance</label>
|
||||||
<div class="col-md-1 col-sm-1 ">
|
<div class="col-md-1 col-sm-1 ">
|
||||||
<input type="text" id="leave_bal" name="" value="" style="width:90px;" class="form-control " readonly>
|
<input type="text" id="leave_bal" name="" value="<?php echo $leave->leave_bal; ?>" style="width:90px;" class="form-control " readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -154,7 +154,7 @@
|
|||||||
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-2 col-sm-2 " for="first-name"> From Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-2 col-sm-2 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<div class='input-group date'>
|
<div class='input-group date'>
|
||||||
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date" value="<?php echo dateFormat('d-m-Y', $leave->from_date); ?>" required />
|
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="fromdate" name="from_date_new" value="<?php echo dateFormat('d-m-Y', $leave->from_date_new); ?>" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -162,14 +162,14 @@
|
|||||||
<label class="control-label col-md-1 col-sm-1" for="last-name">To Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-1 col-sm-1" for="last-name">To Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-2 col-sm-2 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<div class='input-group date' >
|
<div class='input-group date' >
|
||||||
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date" value="<?php echo dateFormat('d-m-Y', $leave->to_date); ?>" required />
|
<input type='text' class="form-control" placeholder="DD-MM-YYYY" id="todate" name= "to_date_new" value="<?php echo dateFormat('d-m-Y', $leave->to_date_new); ?>" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<label class="control-label col-md-1 col-sm-1 " for="last-name"></label>
|
<label class="control-label col-md-1 col-sm-1 " for="last-name"></label>
|
||||||
<div class="col-md-2 col-sm-2 ">
|
<div class="col-md-2 col-sm-2 ">
|
||||||
<input id="dateDifference" value="" readonly class="form-control" style="width:90px;" type="text" >
|
<input id="dateDifference" value="<?php echo $leave->no_of_days; ?>days" readonly class="form-control" style="width:90px;" type="text" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -179,7 +179,12 @@
|
|||||||
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
|
<label class="control-label col-md-2 col-sm-2 " for="first-name">Date<a style="color:red;">*</a> </label>
|
||||||
<div class="col-md-5 col-sm-5 ">
|
<div class="col-md-5 col-sm-5 ">
|
||||||
<div class='input-group date'>
|
<div class='input-group date'>
|
||||||
<input type='text' class="form-control" required name="perm_date" placeholder="DD-MM-YYYY" value="<?php echo $leave->perm_date; ?>" id='myDatepicker'/></div>
|
<?php
|
||||||
|
// Assuming $leave->perm_date_new is in the 'Y-m-d' format
|
||||||
|
$formatted_date = date('d-m-y', strtotime($leave->perm_date_new));
|
||||||
|
?>
|
||||||
|
<input type='text' class="form-control" required name="perm_date_new" placeholder="DD-MM-YYYY" value="<?php echo $formatted_date; ?>" id='myDatepicker' />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@
|
|||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Withdraw-declined'){ ?>
|
else if($value->status == 'Withdraw-declined'){ ?>
|
||||||
<td style="color:red;"><?php echo $value->status; ?> By
|
<td style="color:red;"><?php echo $value->status; ?> By
|
||||||
<?php echo $value->declined_by; ?> <br>" <?php echo $value->DReason; ?> "</td></td>
|
<?php echo $value->DeclineBy; ?> <br>" <?php echo $value->DReason; ?> "</td></td>
|
||||||
<?php }
|
<?php }
|
||||||
else if($value->status == 'Withdraw-Approved'){ ?>
|
else if($value->status == 'Withdraw-Approved'){ ?>
|
||||||
<td style="color:green"><?php echo $value->status; ?> By
|
<td style="color:green"><?php echo $value->status; ?> By
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user