Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
ea5f7b3680
@ -2033,20 +2033,34 @@ class Payslip extends BaseController
|
||||
|
||||
public function leaveReport()
|
||||
{
|
||||
$fyr = get_financial_year();
|
||||
if ($this->request->getMethod() == 'POST') {
|
||||
$fyr = $this->request->getPost('fyr');
|
||||
}
|
||||
// $fiscalYears = get_financial_year_list();
|
||||
$fiscalYears = get_financial_year_list(date('Y'), 8);
|
||||
|
||||
$report = [];
|
||||
|
||||
if ($this->request->getMethod(true) === 'POST' && $this->request->getPost('btn_submit')) {
|
||||
|
||||
|
||||
$data['from_date'] = $this->request->getPost('from_date');
|
||||
$data['to_date'] = $this->request->getPost('to_date');
|
||||
$data['EmpID'] = $this->request->getPost('emp');
|
||||
|
||||
|
||||
|
||||
$report = $this->monthlypay_model->leave_report($data['from_date'], $data['to_date'], $data['EmpID']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$data['EmpData'] = $this->monthlypay_model->getActiveEmployee();
|
||||
|
||||
|
||||
$data['data'] = $report;
|
||||
// dd($data);
|
||||
// Load the view
|
||||
|
||||
$data['fiscalyears'] = $fiscalYears;
|
||||
$data['selectedfiscalyears'] = $fyr;
|
||||
$data['leaverecords'] = $this->payroll_model->getEmpDetailsforLeave($fyr);
|
||||
// echo '<script type="text/javascript">alert("' . $fyr . '")</script>';
|
||||
$this->global['pageTitle'] = 'Leave Reports';
|
||||
$this->loadViews("leavereports", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
function monthwiseLeaveReport($param1,$param2)
|
||||
{
|
||||
$EmployeeID = $param1;
|
||||
|
||||
@ -663,5 +663,45 @@ where Month_Year = ? and att.EmpID in (select EmpID from t_attendance)";
|
||||
// return [$current];
|
||||
}
|
||||
|
||||
function getActiveEmployee()
|
||||
{
|
||||
$array = $this->db->table('t_employee_details')
|
||||
->select("FirstName,LastName,Gender,EmpID")
|
||||
->where('IsActive', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $array;
|
||||
|
||||
}
|
||||
|
||||
function leave_report($from_date, $to_date, $empID)
|
||||
{
|
||||
$builder = $this->db->table('t_monthly_pay_inputs MPI');
|
||||
$builder->selectSum('MPI.LOP_Days');
|
||||
$builder->selectSum('MPI.Paid_leave');
|
||||
$builder->selectSum('MPI.OT_Hrs_Worked');
|
||||
$builder->selectSum('MPI.OTSalary');
|
||||
$builder->select('MPI.EmpID, ED.FirstName , ED.LastName');
|
||||
$builder->join('t_employee_details ED', 'MPI.EmpID = ED.EmpID', 'left');
|
||||
|
||||
// Filter by EmpID if set
|
||||
if (!empty($empID)) {
|
||||
$builder->where('MPI.EmpID', $empID);
|
||||
}
|
||||
|
||||
// Filter by date range if both dates are provided
|
||||
if (!empty($from_date) && !empty($to_date)) {
|
||||
$builder->where("MPI.Month_Year >=", $from_date);
|
||||
$builder->where("MPI.Month_Year <=", $to_date);
|
||||
}
|
||||
|
||||
$builder->groupBy('MPI.EmpID');
|
||||
|
||||
$query = $builder->get();
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,17 +1,37 @@
|
||||
<script src="<?php echo base_url() ?>public/assets/tabletoexport/jquery.tableexport.v2.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
|
||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
<style type="text/css">
|
||||
.num {
|
||||
<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;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.dataTables_empty {
|
||||
text-align: center !important;
|
||||
|
||||
.dataTables_paginate {
|
||||
width: 50%;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.dt-buttons {
|
||||
position: relative;
|
||||
/* float: right; */
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -22,97 +42,132 @@
|
||||
<!-- start page title -->
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb mt-2 mb-2.5">
|
||||
<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"><a href="javascript: void(0);">Leave</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title">
|
||||
<center>Leave Report <?php if (!empty($selectedfiscalyears)) {
|
||||
echo " ( " . $selectedfiscalyears . " )";
|
||||
} ?></center>
|
||||
</h4>
|
||||
<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 action="<?php echo base_url() ?>leavereports" method="POST" id="searchList">
|
||||
<div class="row" style="padding: 18px 26px;">
|
||||
<div class="col-md-3" style="margin: 10px 0px;">
|
||||
<?php if (!empty($fiscalyears)) {
|
||||
foreach ($fiscalyears as $fy):
|
||||
$options[$fy] = $fy;
|
||||
endforeach;
|
||||
}
|
||||
echo form_dropdown('fyr', $options, set_value('fyr', $selectedfiscalyears), 'id="fyr"', 'class="form-control select2"'); ?>
|
||||
</div>
|
||||
<!-- <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> -->
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<input type="button" value="View Report" class="btn btn-success" id="report">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="card-body">
|
||||
<table id="leavelistings" class="table dt-responsive nowrap w-100">
|
||||
|
||||
<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>S.No</th>
|
||||
<th>Employee Name</th>
|
||||
<!-- <th>Total Work in Days</th> -->
|
||||
<th>Leave Taken</th>
|
||||
<th>Paid Leave Taken</th>
|
||||
|
||||
<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
|
||||
$base = base_url();
|
||||
if (!empty($leaverecords)) {
|
||||
$index = 0;
|
||||
foreach ($leaverecords as $rec) {
|
||||
$index++;
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $index; ?></td>
|
||||
<?php if ((int)$rec->NoofAbsentDays != 0) { ?>
|
||||
<td><?php echo '<a title="View Monthwise Details" href="' . $base . 'leavemonthlyreports/' . $rec->EmpID . '/' . $selectedfiscalyears . '">' . $rec->EmpID . '-' . $rec->FullName . '</a>'; ?></td>
|
||||
<?php } else { ?>
|
||||
<td><?php echo $rec->EmpID . '-' . $rec->FullName; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (!empty($data)) { foreach ($data as $value) { ?>
|
||||
<!-- Main invoice row -->
|
||||
<tr>
|
||||
|
||||
<!-- <td style="text-align:right;"><?php // if (!empty($rec->NoofWorkedDays)) { echo number_format((int)$rec->NoofWorkedDays, 0, '.', ''); } else { echo "0"; }
|
||||
?></td> -->
|
||||
<td style="text-align:left;"><?php if (!empty($rec->NoofAbsentDays)) {
|
||||
echo number_format((int)$rec->NoofAbsentDays, 0, '.', '');
|
||||
} else {
|
||||
echo "0";
|
||||
} ?></td>
|
||||
<td style="text-align:left;"><?php if (!empty($rec->NoofPaidLeaveDays)) {
|
||||
echo number_format((int)$rec->NoofPaidLeaveDays, 0, '.', '');
|
||||
} else {
|
||||
echo "0";
|
||||
} ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} // else {
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td colspan="4" style="text-align:center;">No data found</td>
|
||||
</tr> -->
|
||||
<?php
|
||||
// }
|
||||
?>
|
||||
<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 -->
|
||||
@ -122,47 +177,78 @@
|
||||
</div> <!-- container -->
|
||||
</div> <!-- content -->
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#leavelistings').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"aaSorting": [
|
||||
[0, "asc"]
|
||||
|
||||
|
||||
<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
|
||||
],
|
||||
"info": true,
|
||||
"autoWidth": true,
|
||||
"language": {
|
||||
"emptyTable": "No data found"
|
||||
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
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#report').click(function() {
|
||||
$("#searchList").submit();
|
||||
|
||||
$('#mySelect').on('change', function() {
|
||||
|
||||
table
|
||||
.column(4)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#fyr').addClass('form-control');
|
||||
})
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// var name = "<?php // echo 'Leave Report for ' . $selectedfiscalyears;
|
||||
?>";
|
||||
// $("#leavelistings").tableExport({
|
||||
// bootstrap: true,
|
||||
// separator: ",",
|
||||
// headings: true,
|
||||
// buttonContent: "Export",
|
||||
// addClass: "",
|
||||
// defaultClass: "btn",
|
||||
// defaultTheme: "btn-default",
|
||||
// type: "csv",
|
||||
// fileName: name,
|
||||
// position: "bottom",
|
||||
// stripQuotes: true
|
||||
// });
|
||||
$(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>
|
||||
Loading…
Reference in New Issue
Block a user