ria/app/Views/leavereports.php
2025-04-21 15:14:17 +05:30

254 lines
7.7 KiB
PHP
Executable File

<script>
$(document).ready(function() {
$("#emp").select2();
});
</script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
table{
width:auto;
}
.dataTables_filter input {
padding: 4px;
}
.dataTables_filter {
/* width: 50%; */
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
/* float: right; */
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Leave</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title"><b> Reports </b></h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<!-- <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> -->
<div class="card-body">
<form method="post" action="<?php echo base_url("leavereports"); ?>">
<div class="form-group">
<div class="row">
<div class="col-2">
<label for="from_date">
<?php echo 'From Date'; ?>
</label>
<div class="input-group">
<input name="from_date" id="min-date" class="form-control datepicker" autocomplete="off" value="<?php if(isset($from_date)){ echo $from_date; } ?>">
</div>
</div>
<div class="col-2">
<label for="to_date">
<?php echo 'To Date'; ?>
</label>
<div class="input-group">
<input name="to_date" id="max-date" class="form-control datepicker" autocomplete="off" value="<?php if(isset($to_date)){ echo $to_date; } ?>">
</div>
</div>
<div class="col-4">
<label for="emp">
<?php echo 'emp'; ?>
</label>
<select class="form-control" id="emp" name="emp">
<option value="">Select Emplayee</option>
<?php
foreach ($EmpData as $val): { ?>
<option <?php if(isset($EmpID) && ($EmpID == $val['EmpID'])){ echo 'selected'; } ?> value="<?php echo $val['EmpID']; ?>"><?php echo $val['FirstName'].' '.$val['LastName']; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-4">
</div>
<div class="col-md-8"></div>
<div class="col-md-4 text-right">
<input type="button" class="btn btn-danger m-2" value="Reset" onclick="window.location.href='<?= base_url('leavereports') ?>';">
<input type="submit" class="btn btn-success m-2" name="btn_submit" value="View Report">
</div>
</div>
</div>
<div class="form-group has-feedback">
</div>
</form>
<table id="cc" class="table table-bordered table-hover wrap" style="background-color:#fff;width: 100% !important;">
<thead>
<tr>
<th>Emplayee Name</th>
<th align="right">LOP Days</th>
<th align="right">Paid Leaves</th>
<th align="right">Total Leaves</th>
</tr>
</thead>
<tbody>
<?php if (!empty($data)) { foreach ($data as $value) { ?>
<!-- Main invoice row -->
<tr>
<td><?php echo $value['FirstName'].' '.$value['LastName'] ?></td>
<td align="right"><?php echo $value['LOP_Days'] ?></td>
<td align="right"><?php echo $value['Paid_leave'] ?></td>
<td align="right"><?php echo ($value['LOP_Days']+$value['Paid_leave']) ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot width="100%">
<!-- <tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right"><strong><?php {echo number_format(0, 2, '.', ','); }?></strong></td>
<td style="text-align:right"><strong><?php {echo number_format(0, 2, '.', ','); }?></strong></td>
</td>
</tr> -->
</tfoot>
<?php
}
?>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
// Initialize the DataTable
var table = $('#cc').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
ordering : false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
});
$('#mySelect').on('change', function() {
table
.column(4)
.search(this.value)
.draw();
});
$(function() {
var dateFormat = 'mm-yyyy';
// Initialize min-date (Start Date)
var from = $("#min-date").datepicker({
format: dateFormat,
autoclose: true,
todayHighlight: true,
clearBtn: true,
orientation: 'bottom',
minViewMode: 1 // Month view only
}).on('changeDate', function(e) {
to.datepicker('setStartDate', e.date);
});
// Initialize max-date (End Date)
var to = $("#max-date").datepicker({
format: dateFormat,
autoclose: true,
todayHighlight: true,
clearBtn: true,
orientation: 'bottom',
minViewMode: 1 // Month view only
}).on('changeDate', function(e) {
from.datepicker('setEndDate', e.date);
});
});
</script>