403 lines
19 KiB
PHP
Executable File
403 lines
19 KiB
PHP
Executable File
<style>
|
|
.celda_encabezado_general {
|
|
background-color: #00a65a;
|
|
border: 1px solid #ccc;
|
|
color: #ffffff;
|
|
font-weight: bold;
|
|
padding: 2px 4px;
|
|
text-align: center;
|
|
}
|
|
|
|
.fht-table th:nth-child(1),
|
|
.fht-table th:nth-child(2),
|
|
.fht-table th:nth-child(3) {
|
|
position: sticky;
|
|
left: 0;
|
|
top: 0;
|
|
background-color: #00a65a;
|
|
z-index: 7 !important;
|
|
border-right: 2px solid #ddd;
|
|
color: #ffffff;
|
|
}
|
|
|
|
|
|
.fht-table td:nth-child(1),
|
|
.fht-table td:nth-child(2),
|
|
.fht-table td:nth-child(3) {
|
|
position: sticky;
|
|
left: 0;
|
|
background-color: #ffffff;
|
|
z-index: 2;
|
|
border-right: 2px solid #ddd;
|
|
color: #0e0b0b;
|
|
}
|
|
|
|
.table-responsive {
|
|
overflow-y: auto;
|
|
max-height: 450px;
|
|
}
|
|
|
|
.fht-table thead th {
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 5 !important;
|
|
}
|
|
</style>
|
|
<?php
|
|
|
|
$sample = $fresh;
|
|
|
|
$ex = explode('-', $dropdownvalue);
|
|
|
|
if (strlen($ex[0]) == '2') {
|
|
if ($ex[0] < 10) {
|
|
$ex1 = substr($ex[0], 1);
|
|
} else {
|
|
$ex1 = $ex[0];
|
|
}
|
|
} else {
|
|
$ex1 = $ex[0];
|
|
}
|
|
|
|
$drop = $ex1 . '-' . $ex[1];
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
$('html').bind('keypress', function(e) {
|
|
//alert('Key Pressed');
|
|
if (e.keyCode == 13) {
|
|
return false;
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
.num {
|
|
text-align: right;
|
|
}
|
|
</style>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center></center>
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
|
|
<input type="hidden" id="paydate" value="<?php echo $drop; ?>" />
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
|
|
<div class="content-page">
|
|
<div class="content">
|
|
<!-- Start Content-->
|
|
<div class="container-fluid">
|
|
<!-- start page title -->
|
|
<div>
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb mt-2 mb-2.5">
|
|
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
|
|
<li class="breadcrumb-item"><a href="javascript: void(0);">PaySlip</a></li>
|
|
<li class="breadcrumb-item active">
|
|
<h4 class="page-title">Overtime Details</h4>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card" id="fullscreenDiv">
|
|
<div class="card-body">
|
|
<div id="successMessage" style="display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);background: green; color: white; padding: 10px; border-radius: 5px; z-index: 1000;"></div>
|
|
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools"></div>
|
|
<!--</h3></center>-->
|
|
|
|
</div><!-- /.b o x-h e a d e r -->
|
|
<?php
|
|
|
|
$year = date("Y");
|
|
$current = date("m-Y");
|
|
$month = date("m");
|
|
if ($month < 10) {
|
|
$month = substr($month, 1);
|
|
}
|
|
$currentselection = $month . "-" . $year;
|
|
$options = array();
|
|
$monthsoptions = array("1" => "Jan", "2" => "Feb", "3" => "Mar", "4" => "Apr", "5" => "May", "6" => "June", "7" => "July", "8" => "Aug", "9" => "Sep", "10" => "Oct", "11" => "Nov", "12" => "Dec");
|
|
|
|
$currentmontharray = array(array($month . "-" . $year => $monthsoptions[$month] . "-" . $year));
|
|
// For find out Next and previous month and year from current year
|
|
$aftersix = array();
|
|
for ($i = 0; $i < 3; $i++) {
|
|
|
|
$month++;
|
|
if ($month > 12) {
|
|
$month = 1;
|
|
$year = $year + 1;
|
|
}
|
|
|
|
$aftersix[] = array($month . "-" . $year => $monthsoptions[$month] . "-" . $year);
|
|
}
|
|
|
|
$year = date("Y");
|
|
$month = date("m");
|
|
|
|
$beforesix = array();
|
|
for ($i = 3; $i > 0; $i--) {
|
|
|
|
$month--;
|
|
if ($month < 1) {
|
|
$month = 12;
|
|
$year = $year - 1;
|
|
}
|
|
|
|
$beforesix[] = array($month . "-" . $year => $monthsoptions[$month] . "-" . $year);
|
|
}
|
|
|
|
$beforesix = array_reverse($beforesix);
|
|
|
|
|
|
$options = array_merge($options, $beforesix);
|
|
//echo count($options);
|
|
|
|
$options = array_merge($options, $currentmontharray);
|
|
$options = array_merge($options, $aftersix);
|
|
|
|
$ot = array();
|
|
foreach ($options as $o) {
|
|
|
|
foreach ($o as $key => $value) {
|
|
|
|
$ot[$key] = $value;
|
|
}
|
|
}
|
|
?>
|
|
<div class="box-body">
|
|
<div class="row" style="margin-bottom:10px">
|
|
<div class="col-md-3">
|
|
<form id="formid">
|
|
<?php echo form_dropdown('monthyear', $ot, set_value('monthyear', $currentselection), 'id="monthyear"', 'class="form-control select2'); ?>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="col-3"></div>
|
|
<div class="col-3"></div>
|
|
<div class="col-3"></div>
|
|
</div>
|
|
|
|
<div class="table-responsive" id="table-responsive" style="overflow-x:scroll;">
|
|
<table id="monthlylistings" class="table table-bordered table-hover fht-table"
|
|
style="background-color:#fff;font-size:12px;white-space: nowrap;">
|
|
<thead style="background-color: #ddd;">
|
|
<tr>
|
|
<th class="celda_encabezado_general">S.No</th>
|
|
<th class="celda_encabezado_general">Emp ID </th>
|
|
<th class="celda_encabezado_general">Employee </th>
|
|
<th class="celda_encabezado_general">Salary</th>
|
|
<th class="celda_encabezado_general">Per Day Salary</th>
|
|
<th class="celda_encabezado_general">Per hr Salary</th>
|
|
<th class="celda_encabezado_general">Over Time Hrs</th>
|
|
<th class="celda_encabezado_general">Over Time Amount</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
|
|
if (!empty($fresh)) {
|
|
foreach ($fresh as $i => $record) {
|
|
// print_r($record);
|
|
?>
|
|
|
|
<tr class="lastvalue">
|
|
<td style="text-align:right;" style="background-color:blue;"><?php echo $i+1; ?></td>
|
|
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
|
|
<td><?php echo $record->FirstName; ?></td>
|
|
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php echo $record->TotalSalary;
|
|
$totalsalary[] = $record->TotalSalary; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php $perDaySalary = $record->TotalSalary / $record->NoofDays;
|
|
echo number_format($perDaySalary, 2, '.', '');
|
|
$totalperdaySalary[] = $perDaySalary; ?>
|
|
</td>
|
|
|
|
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php $perHrSalary = $perDaySalary / 8;
|
|
echo number_format($perHrSalary, 2);
|
|
$totalperhrSalary[] = $perHrSalary; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php $OT = $record->OT_Hrs_Worked;
|
|
echo $OT;
|
|
$totalOThrs[] = $record->OT_Hrs_Worked;
|
|
?>
|
|
</td>
|
|
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php
|
|
// $NoofDays = $record->NoofDays;
|
|
// $HRA_Amount = $record->HRA_Amount;
|
|
// $Basic_Pay = $record->Basic_Pay;
|
|
// $OT_Hrs_Worked = $record->OT_Hrs_Worked;
|
|
// $dayBasic = $Basic_Pay / $NoofDays;
|
|
// $dayHra = $HRA_Amount / $NoofDays;
|
|
// $oneHoursSalary = ($dayBasic + $dayHra) / 8;
|
|
// $OTSalary = ($OT_Hrs_Worked != 0) ? $OT_Hrs_Worked * $oneHoursSalary : 0;
|
|
$OTSalary = $OT * $perHrSalary;
|
|
echo number_format($OTSalary, 2);
|
|
$totalOTsalary[] = $OTSalary;
|
|
|
|
?>
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
|
|
}
|
|
}?>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;color: #000000;">Total</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalsalary) ? number_format(array_sum($totalsalary), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalperdaySalary) ? number_format(array_sum($totalperdaySalary), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalperhrSalary) ? number_format(array_sum($totalperhrSalary), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalOThrs) ? number_format(array_sum($totalOThrs), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalOTsalary) ? number_format(array_sum($totalOTsalary), 2) : ''; ?>
|
|
</th>
|
|
</tr>
|
|
</tfoot>
|
|
|
|
</table>
|
|
</div>
|
|
<p> </p>
|
|
|
|
</div><!-- /.b o x-b o d y -->
|
|
</div><!-- /.b o x -->
|
|
</div> <!--/. c a r d b o d y-->
|
|
</div> <!-- /. e n d c a r d -->
|
|
</div><!--/. e n d c o l-->
|
|
</div>
|
|
</div>
|
|
</div> <!--/. c o n t a i n e r -->
|
|
</div> <!-- c o n t e n t -->
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
|
|
$('#monthyear').attr('class', 'form-control');
|
|
|
|
var estTotal = [];
|
|
|
|
var totalotherDet = [];
|
|
var totalmonthloan = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#monthyear").change(function() {
|
|
|
|
$s = $('#monthyear').val();
|
|
|
|
$("#formid").attr("method", "post");
|
|
|
|
$("#formid").attr("action", "<?php echo base_url() ?>overTimeDetails");
|
|
|
|
$('#formid').submit();
|
|
|
|
|
|
});
|
|
|
|
function toggleDivFullscreen() {
|
|
let div = document.getElementById("fullscreenDiv");
|
|
let tableResponsive = document.getElementById("table-responsive"); // Select the table container inside div
|
|
|
|
|
|
|
|
if (!document.fullscreenElement) {
|
|
div.requestFullscreen().then(() => {
|
|
div.style.width = "100vw"; // Full viewport width
|
|
div.style.height = "100vh"; // Full viewport height
|
|
|
|
// If .table-responsive exists, set its height to 90vh
|
|
if (tableResponsive) {
|
|
tableResponsive.style.maxHeight = "90vh";
|
|
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
|
|
}
|
|
}).catch(err => console.log("Error enabling fullscreen:", err));
|
|
} else {
|
|
document.exitFullscreen().then(() => {
|
|
div.style.width = "100%";
|
|
div.style.height = "100%";
|
|
|
|
// Reset .table-responsive height when exiting fullscreen
|
|
if (tableResponsive) {
|
|
tableResponsive.style.height = "auto";
|
|
}
|
|
}).catch(err => console.log("Error exiting fullscreen:", err));
|
|
}
|
|
}
|
|
|
|
</script>
|