1410 lines
70 KiB
PHP
Executable File
1410 lines
70 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">Monthly Pay Information</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">
|
|
|
|
<!-- <p><b>
|
|
The <span style="background-color:#ff4d4d;">Red</span> highlighted Employee have loan
|
|
to pay. Put <span style="background-color:#66ff33;">'NA'</span> for Skip Current
|
|
Month Loan Due.
|
|
</b></p> -->
|
|
|
|
</div>
|
|
<!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
<?php
|
|
|
|
$year = date("Y");
|
|
$current = date("m-Y");
|
|
|
|
//echo $current;
|
|
$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-9 text-right d-flex" style="justify-content: end;" id="savebutton">
|
|
|
|
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
|
|
|
|
<!-- <input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;"> -->
|
|
|
|
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;" title="Export Excel"></i>
|
|
|
|
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;" title="Full screen view"></i>
|
|
|
|
<i class="fas fa-save" onclick="getAllData();" style="margin-right: 15px;margin-top: 5px;font-size:28px;" title="Save"></i>
|
|
|
|
</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">DOJ</th>
|
|
<th class="celda_encabezado_general">Designation</th>
|
|
<th class="celda_encabezado_general">Total Days</th>
|
|
<!-- <th class="celda_encabezado_general">Number Of Trips</th> -->
|
|
<th class="celda_encabezado_general">Days Worked</th>
|
|
<th class="celda_encabezado_general">LOP Days</th>
|
|
<th class="celda_encabezado_general">Paid Leave</th>
|
|
<th class="celda_encabezado_general">OT Hrs</th>
|
|
<th class="celda_encabezado_general">Total Salary</th>
|
|
<th class="celda_encabezado_general">Per Day Salary</th>
|
|
<th class="celda_encabezado_general">Worked Salary</th>
|
|
<th class="celda_encabezado_general">Per hr Salary</th>
|
|
<th class="celda_encabezado_general">Earned Salary</th>
|
|
<th class="celda_encabezado_general">Basic Salary(0.7)</th>
|
|
<th class="celda_encabezado_general">HRA Salary(0.3)</th>
|
|
<th class="celda_encabezado_general">Gross Salary</th>
|
|
<th class="celda_encabezado_general">ESI</th>
|
|
<th class="celda_encabezado_general">PF</th>
|
|
<th class="celda_encabezado_general">Over Time</th>
|
|
<th class="celda_encabezado_general">Auto Loan Due ₹</th>
|
|
<th class="celda_encabezado_general">TDS Deductions in ₹</th>
|
|
<th class="celda_encabezado_general">Festival Bonus in ₹</th>
|
|
<th class="celda_encabezado_general">Net Salary ₹</th>
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
$index = 0;
|
|
$testarray = array();
|
|
|
|
if (!empty($sample)) {
|
|
|
|
$i = 0;
|
|
foreach ($sample as $i => $record) {
|
|
|
|
$index++;
|
|
if (in_array($record->EmpID, $testarray)) {
|
|
$index--;
|
|
} else {
|
|
array_push($testarray, $record->EmpID);
|
|
?>
|
|
|
|
<tr class="lastvalue">
|
|
<td style="text-align:right;" style="background-color:blue;">
|
|
<?php echo $index; ?></td>
|
|
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
|
|
<td <?php if($record->is_management_team == 1){ ?> style="background-color: #d8d8ea;" <?php } ?> >
|
|
<?php echo $record->FirstName; ?>
|
|
</td>
|
|
<td style="max-width: 100px;">
|
|
<?php
|
|
$date = DateTime::createFromFormat('Y-m-d H:i:s', $record->DateofJoining);
|
|
$newDateFormat = $date->format('d-m-Y');
|
|
echo $newDateFormat;
|
|
?>
|
|
</td>
|
|
|
|
<td style="max-width: 150px;overflow: hidden;text-overflow: ellipsis;">
|
|
<?php echo $record->Designation; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:center;"><?php echo $record->NoofDays; ?></td>
|
|
<!-- <td style="max-width:80px;text-align:center;"><?php echo 0; ?></td> -->
|
|
<td id="dayWork<?php echo $index ?>"
|
|
<?php if (empty($record->Key)) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
|
style="text-align:center;color:blue;"
|
|
<?php } else { ?>style="text-align:center;" <?php } ?>>
|
|
<?php if (!empty($record->Days_worked)) {
|
|
echo $record->Days_worked;
|
|
} else {
|
|
echo "0.00";
|
|
} ?>
|
|
</td>
|
|
|
|
<td id="lopDay<?php echo $index ?>"
|
|
<?php if (empty($record->Key)) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
|
style="text-align:center;color:blue;"
|
|
<?php } else { ?>style="text-align:center;" <?php } ?>>
|
|
<?php if (!empty($record->LOP_Days)) {
|
|
echo $record->LOP_Days;
|
|
} else {
|
|
echo "0.00";
|
|
} ?>
|
|
</td>
|
|
|
|
<td id="paidLeave<?php echo $index ?>"
|
|
<?php if (empty($record->Key)) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
|
style="text-align:center;color:blue;"
|
|
<?php } else { ?>style="text-align:center;" <?php } ?>>
|
|
<?php if (!empty($record->Paid_leave)) {
|
|
echo number_format($record->Paid_leave, 2, '.', '');
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');
|
|
} ?>
|
|
</td>
|
|
|
|
<td id="otHrsWork<?php echo $index ?>"
|
|
<?php if (empty($record->Key)) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
|
style="text-align:center;color:blue;"
|
|
<?php } else { ?>style="text-align:center;" <?php } ?>>
|
|
<?php if (!empty($record->OT_Hrs_Worked)) {
|
|
echo $record->OT_Hrs_Worked;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');
|
|
} ?>
|
|
</td>
|
|
|
|
<td id="ttlsalary<?php echo $index ?>" 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 $workedSalary = $perDaySalary * ($record->Days_worked);
|
|
echo number_format($workedSalary, 2, '.', ''); ?>
|
|
</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 echo number_format($workedSalary, 2, '.', ''); $totalworkedSalary[] = $workedSalary; ?>
|
|
</td>
|
|
|
|
<td id="bassalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
|
<?php $basicWorked = $workedSalary * 70 / 100;
|
|
echo number_format($basicWorked, 2, '.', ''); $totalbasic[] = $basicWorked; ?>
|
|
</td>
|
|
|
|
<td id="hrasalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
|
<?php $hraWorked = $workedSalary * 30 / 100;
|
|
echo number_format($hraWorked, 2, '.', ''); $totalhra[] = $hraWorked; ?>
|
|
</td>
|
|
|
|
<td id="grosalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo number_format($basicWorked + $hraWorked, 2, '.', ''); $totalgross[] = $basicWorked + $hraWorked; ?>
|
|
</td>
|
|
|
|
<td id="esiAmt<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo $esi[$i]; $totalesi[] = $esi[$i]; ?>
|
|
</td>
|
|
|
|
<td id="pfAmt<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo $pf[$i]; $totalpf[] = $pf[$i]; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php echo $over_time[$i]; $totalovertime[] = $over_time[$i]; ?>
|
|
</td>
|
|
|
|
<td id="monthDue<?php echo $index ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);"
|
|
<?php if ($record->is_payslip_generated == 0) { echo "contenteditable='true';"; } ?>
|
|
<?php if ($record->is_payslip_generated == 1) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;"
|
|
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
|
|
|
<?php if (!empty($record->Monthly_Due)) {
|
|
echo $record->Monthly_Due;
|
|
$totalmonthloan[] = $record->Monthly_Due;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');
|
|
} ?>
|
|
</td>
|
|
|
|
|
|
<td id="otherDet<?php echo $index ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);"
|
|
<?php if ($record->is_payslip_generated == 0) {
|
|
echo "contenteditable='true';";
|
|
} ?>
|
|
<?php if ($record->is_payslip_generated == 1) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;"
|
|
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
|
|
|
<?php if (!empty($record->Other_Deductions)) {
|
|
echo $record->Other_Deductions;
|
|
$totalotherDet[] = $record->Other_Deductions;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');
|
|
} ?>
|
|
</td>
|
|
|
|
<?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?>
|
|
|
|
<td id="Festival<?php echo $index ?>" onkeypress="return isNumber(event);"
|
|
onkeyup="changeInput(event);"
|
|
<?php if ($record->is_payslip_generated == 0) {
|
|
echo "contenteditable='true';";
|
|
} ?>
|
|
<?php if ($record->is_payslip_generated == 1) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;"
|
|
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
|
<?php if (!empty($record->Festival_Bonus)) {
|
|
echo $record->Festival_Bonus;
|
|
$totalfestival[] = $record->Festival_Bonus;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');;
|
|
} ?>
|
|
</td>
|
|
|
|
<?php $totalfestival[] = isset($Festival_Bonus) ? $Festival_Bonus : []; ?>
|
|
|
|
<td id="empsal<?php echo $index ?>"
|
|
<?php if ($record->is_payslip_generated == 1) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if ($record->is_payslip_generated == 1) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;" <?php }else{ ?>style="text-align:right;" <?php } ?>>
|
|
<?php if (!empty($record->Estimate)) {
|
|
echo $record->Estimate;
|
|
$estTotal[] = $record->Estimate;
|
|
} else {
|
|
echo $empSalary[$i];
|
|
$estTotal[] = $empSalary[$i];
|
|
}
|
|
?>
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<input type="hidden" id="sunday<?php echo $index ?>"
|
|
value="<?php echo $record->sunday_count ?>">
|
|
<input type="hidden" id="is_management_team<?php echo $index ?>"
|
|
value="<?php echo $record->is_management_team ?>">
|
|
<input type="hidden" id="esi_applicable<?php echo $index ?>"
|
|
value="<?php echo $record->esi_applicable ?>">
|
|
<input type="hidden" id="pf_applicable<?php echo $index ?>"
|
|
value="<?php echo $record->pf_applicable ?>">
|
|
<input type="hidden" id="bPay<?php echo $index ?>"
|
|
value="<?php echo $record->Basic_Pay ?>">
|
|
<input type="hidden" id="hraRate<?php echo $index ?>"
|
|
value="<?php echo $record->HRA_Rate ?>">
|
|
<input type="hidden" id="allow<?php echo $index ?>"
|
|
value="<?php echo $record->Allowances ?>">
|
|
<input type="hidden" id="fAllow<?php echo $index ?>"
|
|
value="<?php echo $record->Food_Allowances ?>">
|
|
<input type="hidden" id="pfRate<?php echo $index ?>"
|
|
value="<?php echo $record->PF_Rate ?>">
|
|
<input type="hidden" id="eslRate<?php echo $index ?>"
|
|
value="<?php echo $record->ESI_Rate ?>">
|
|
<input type="hidden" id="hraAmt<?php echo $index ?>"
|
|
value="<?php echo $record->HRA_Amount ?>">
|
|
|
|
<input type="hidden" id="loanamt<?php echo $index ?>"
|
|
value="<?php echo isset($record->Loan_Amount) ? $record->Loan_Amount : 0 ?>">
|
|
<input type="hidden" id="paidamt<?php echo $index ?>"
|
|
value="<?php echo $record->Paid_Amount ?>">
|
|
|
|
<input type="hidden" id="duedate<?php echo $index ?>"
|
|
value="<?php echo $record->DueDate ?>">
|
|
<input type="hidden" id="is_driver<?php echo $index ?>"
|
|
value="<?php echo $record->is_driver ?>">
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
}
|
|
}
|
|
$inx = $index;
|
|
if(!empty($drivermonthinputs)){
|
|
foreach ($drivermonthinputs as $i => $record) {
|
|
$inx++;
|
|
$hra_worked = $record->hra_worked;
|
|
$basic_worked = $record->basic_worked;
|
|
$sum_of_amount = ($record->driver_salary+$record->driver_shed+$record->driver_diesel);
|
|
?>
|
|
<tr class="lastvalue">
|
|
<td style="text-align:right;" style="background-color:blue;">
|
|
<?php echo $inx; ?></td>
|
|
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
|
|
<td style="background-color: #d8d8ea;" >
|
|
<?php echo $record->FirstName; ?>
|
|
</td>
|
|
<td style="max-width: 100px;">
|
|
<?php
|
|
$date = DateTime::createFromFormat('Y-m-d H:i:s', $record->DateofJoining);
|
|
$newDateFormat = $date->format('d-m-Y');
|
|
echo $newDateFormat;
|
|
?>
|
|
</td>
|
|
|
|
<td style="max-width: 150px;overflow: hidden;text-overflow: ellipsis;">
|
|
<?php echo $record->Designation; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:center;">
|
|
<?php echo $record->total_cal_days; ?>
|
|
</td>
|
|
|
|
<!-- <td style="max-width:80px;text-align:center;">
|
|
<?php echo $record->no_of_loads." (trip)"; ?>
|
|
</td> -->
|
|
|
|
<td id="dayWork<?php echo $inx ?>" style="text-align:center;">
|
|
<?php echo number_format($record->unique_days, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<td id="lopDay<?php echo $inx ?>" style="text-align:center;">
|
|
<?php echo number_format(0.00, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<td id="paidLeave<?php echo $inx ?>" style="text-align:center;">
|
|
<?php echo number_format(0.00, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<td id="otHrsWork<?php echo $inx ?>" style="text-align:center;">
|
|
<?php echo number_format(0.00, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;" data-empid="<?php echo $record->EmpID; ?>">
|
|
<a href="#" onclick="openDriverLoad(this)">
|
|
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalsalary[] = $sum_of_amount; ?>
|
|
</a>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php
|
|
$worked_amt = $sum_of_amount / $record->total_cal_days ;
|
|
echo number_format($worked_amt, 2, '.', ''); $totalperdaySalary[] = $worked_amt; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php $hr_amt = $worked_amt/8;
|
|
echo number_format($hr_amt, 2, '.', ''); $totalperhrSalary[] = $hr_amt; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<!-- $record->driver_salary_amount -->
|
|
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalworkedSalary[] = $sum_of_amount; ?>
|
|
</td>
|
|
|
|
<td id="bassalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
|
<?php
|
|
echo number_format($basic_worked, 2, '.', ''); $totalbasic[] = $basic_worked; ?>
|
|
</td>
|
|
|
|
<td id="hrasalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
|
<?php
|
|
echo number_format($hra_worked, 2, '.', ''); $totalhra[] = $hra_worked; ?>
|
|
</td>
|
|
|
|
<td id="grosalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo number_format($basic_worked + $hra_worked, 2, '.', ''); $totalgross[] = $basic_worked + $hra_worked; ?>
|
|
</td>
|
|
|
|
<td id="esiAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo $record->esi_amount; $totalesi[] = $record->esi_amount; ?>
|
|
</td>
|
|
|
|
<td id="pfAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
|
<?php echo $record->pf_amount; $totalpf[] = $record->pf_amount; ?>
|
|
</td>
|
|
|
|
<td style="max-width:80px;text-align:right;">
|
|
<?php echo number_format(0.00, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
|
|
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
|
|
<?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?>
|
|
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;"
|
|
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
|
|
|
<?php if (!empty($record->Monthly_Due)) {
|
|
echo $record->Monthly_Due;
|
|
$totalmonthloan[] = $record->Monthly_Due;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');
|
|
} ?>
|
|
</td>
|
|
|
|
|
|
|
|
<td id="otherDet<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);" style="text-align:right;">
|
|
<?php echo number_format(0.00, 2, '.', ''); ?>
|
|
</td>
|
|
|
|
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> -->
|
|
|
|
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
|
|
onkeyup="driverchangeInput(event);"
|
|
<?php if (empty($record->payroll_id)) {
|
|
echo "contenteditable='true';";
|
|
} ?>
|
|
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;"
|
|
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
|
<?php if (!empty($record->Festival_Bonus)) {
|
|
echo $record->Festival_Bonus;
|
|
$totalfestival[] = $record->Festival_Bonus;
|
|
} else {
|
|
echo number_format(0.00, 2, '.', '');;
|
|
} ?>
|
|
</td>
|
|
|
|
<?php $totalfestival[] = isset($Festival_Bonus) ? $Festival_Bonus : []; ?>
|
|
|
|
<td id="empsal<?php echo $inx ?>"
|
|
<?php if (empty($record->payroll_id)) {
|
|
echo "contenteditable='false';";
|
|
} ?>
|
|
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
|
|
style="text-align:right;color:blue;" <?php }else{ ?>style="text-align:right;" <?php } ?>>
|
|
<?php if (!empty($record->driver_final_payment)) {
|
|
echo ($basic_worked + $hra_worked + $record->Festival_Bonus)-($record->Monthly_Due+$record->esi_amount+$record->pf_amount);
|
|
$estTotal[] = ($basic_worked + $hra_worked + $record->Festival_Bonus)-($record->Monthly_Due+$record->esi_amount+$record->pf_amount);
|
|
} else {
|
|
echo ($basic_worked + $hra_worked + $record->Festival_Bonus)-($record->Monthly_Due+$record->esi_amount+$record->pf_amount);
|
|
$estTotal[] = ($basic_worked + $hra_worked + $record->Festival_Bonus)-($record->Monthly_Due+$record->esi_amount+$record->pf_amount);
|
|
}
|
|
?>
|
|
</td>
|
|
|
|
<input type="hidden" id="loanatm<?php echo $inx ?>"
|
|
value="<?php echo isset($record->Loan_Amount) ? $record->Loan_Amount : 0 ?>">
|
|
<input type="hidden" id="paidamt<?php echo $inx ?>"
|
|
value="<?php echo $record->Paid_Amount ?>">
|
|
|
|
<input type="hidden" id="duedate<?php echo $inx ?>"
|
|
value="<?php echo $record->DueDate ?>">
|
|
|
|
<input type="hidden" id="is_driver<?php echo $inx ?>"
|
|
value="<?php echo $record->is_driver ?>">
|
|
|
|
|
|
|
|
</tr>
|
|
<?php }} ?>
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
<tr>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></th>
|
|
<th style=" background-color: #ffffff;"></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($totalworkedSalary) ? number_format(array_sum($totalworkedSalary), 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($totalworkedSalary) ? number_format(array_sum($totalworkedSalary), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalbasic) ? number_format(array_sum($totalbasic), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalhra) ? number_format(array_sum($totalhra), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalgross) ? number_format(array_sum($totalgross), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalesi) ? number_format(array_sum($totalesi), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalpf) ? number_format(array_sum($totalpf), 2) : ''; ?>
|
|
</th>
|
|
<th style="text-align:right;">
|
|
<?php echo isset($totalovertime) ? number_format(array_sum($totalovertime), 2) : ''; ?>
|
|
</th>
|
|
<th id="monthloan" style="text-align:right;">
|
|
<?php echo isset($totalmonthloan) ? number_format(array_sum($totalmonthloan), 2) : ''; ?>
|
|
</th>
|
|
<th id="other" style="text-align:right;">
|
|
<?php echo isset($totalotherDet) ? number_format(array_sum($totalotherDet), 2) : ''; ?>
|
|
</th>
|
|
<th id="fest" style="text-align:right;">
|
|
<?php echo isset($totalfestival) ? number_format(array_sum($totalfestival), 2) : ''; ?>
|
|
</th>
|
|
<th id="estsal" style="text-align:right;">
|
|
<?php echo isset($estTotal) ? number_format(array_sum($estTotal), 2) : ''; ?>
|
|
</th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
<p> </p>
|
|
<div class="row">
|
|
<!-- <div class="col-md-12 text-right" id="savebutton">
|
|
<input type="button" id="submit" value="Save" class="btn btn-success"
|
|
onclick="getAllData();">
|
|
</div> -->
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
<!-- <div class="box-footer clearfix">
|
|
|
|
</div> -->
|
|
</div><!-- /.box -->
|
|
</div> <!-- end card body-->
|
|
</div> <!-- end card -->
|
|
</div><!-- end col-->
|
|
</div>
|
|
</div>
|
|
</div> <!-- container -->
|
|
</div> <!-- content -->
|
|
</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">
|
|
|
|
|
|
$(document).ready(function () {
|
|
// function exportTableToExcel(tableId, filename = 'monthlyPay.xlsx') {
|
|
// var table = document.getElementById(tableId);
|
|
// var rows = table.rows;
|
|
// var csv = [];
|
|
|
|
// // Loop through table rows and cells
|
|
// for (var i = 0; i < rows.length; i++) {
|
|
// var row = rows[i];
|
|
// var cols = row.querySelectorAll('td, th');
|
|
// var rowData = [];
|
|
|
|
// // Loop through each cell in the row
|
|
// for (var j = 0; j < cols.length; j++) {
|
|
// rowData.push(cols[j].innerText);
|
|
// }
|
|
|
|
// csv.push(rowData.join('\t'));
|
|
// }
|
|
|
|
// // Create a Blob from the CSV data
|
|
// var blob = new Blob([csv.join('\n')], { type: 'application/vnd.ms-excel' });
|
|
// var link = document.createElement('a');
|
|
// link.href = URL.createObjectURL(blob);
|
|
// link.download = filename;
|
|
|
|
// // Trigger download
|
|
// link.click();
|
|
// }
|
|
|
|
|
|
function exportTableToExcel(tableId, filename = 'monthlypay.xlsx') {
|
|
var table = document.getElementById(tableId);
|
|
var rows = table.rows;
|
|
var data = [];
|
|
|
|
for (var i = 0; i < rows.length; i++) {
|
|
var row = rows[i];
|
|
var cols = row.querySelectorAll('td, th');
|
|
var rowData = [];
|
|
|
|
for (var j = 0; j < cols.length; j++) {
|
|
rowData.push(cols[j].innerText);
|
|
}
|
|
|
|
data.push(rowData);
|
|
}
|
|
|
|
var wb = XLSX.utils.book_new();
|
|
var ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
|
XLSX.writeFile(wb, filename);
|
|
}
|
|
|
|
// Add click event listener to the export button
|
|
document.getElementById('exportButton').addEventListener('click', function () {
|
|
exportTableToExcel('monthlylistings');
|
|
});
|
|
});
|
|
|
|
$('#monthyear').attr('class', 'form-control');
|
|
|
|
var estTotal = [];
|
|
|
|
var totalotherDet = [];
|
|
var totalmonthloan = [];
|
|
|
|
|
|
// $(function() {
|
|
// var i = 0;
|
|
// $('tr.lastvalue').each(function() {
|
|
// i = i + 1;
|
|
// estTotal[i] = $(this).find('td').eq(11).text();
|
|
// });
|
|
|
|
|
|
|
|
|
|
// var i = 0;
|
|
// $('tr.lastvalue').each(function() {
|
|
// i = i + 1;
|
|
// totalotherDet[i] = $(this).find('td').eq(9).text();
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var i = 0;
|
|
// $('tr.lastvalue').each(function() {
|
|
// i = i + 1;
|
|
// totalmonthloan[i] = $(this).find('td').eq(7).text();
|
|
// });
|
|
|
|
|
|
|
|
// t.on('order.dt search.dt', function() {
|
|
// t.column(0, {
|
|
// search: 'applied',
|
|
// order: 'applied'
|
|
// }).nodes().each(function(cell, i) {
|
|
// cell.innerHTML = i + 1;
|
|
// });
|
|
// }).draw();
|
|
|
|
// var s = "<?php echo $drop; ?>";
|
|
// $('#monthyear').val(s);
|
|
|
|
// savebuttonvalidation();
|
|
|
|
// });
|
|
|
|
function isNumber(evt) {
|
|
|
|
//alert("hi");
|
|
var iKeyCode = (evt.which) ? evt.which : evt.keyCode
|
|
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57)) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function isCheckKeyCode(event) {
|
|
|
|
var iKeyCode = (event.which) ? event.which : event.keyCode
|
|
if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57) && (iKeyCode == 78 && iKeyCode == 65)) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
function getAllData() {
|
|
|
|
var alldata = $("#monthlylistings").tableToJSON();
|
|
alldata = JSON.stringify(alldata)
|
|
// Parse the JSON string back into an array of objects
|
|
alldata = JSON.parse(alldata);
|
|
|
|
// Filter out objects where "Emp ID" is empty
|
|
alldata = alldata.filter(function(item) {
|
|
return item["Emp ID"].trim() !== "";
|
|
});
|
|
|
|
// Convert the filtered array back to a JSON string if needed
|
|
alldata = JSON.stringify(alldata);
|
|
var month = $('#monthyear').val();
|
|
|
|
$('#loader').show();
|
|
$.ajax({
|
|
data: {
|
|
param1: alldata,
|
|
param2: month
|
|
},
|
|
//dataType:"json",
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>payslip/saveMonthlyData",
|
|
success: function(data) {
|
|
|
|
if (data) {
|
|
$('#loader').hide();
|
|
// alert(data);
|
|
showMessage(data);
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
$("#monthyear").change(function() {
|
|
|
|
$s = $('#monthyear').val();
|
|
//echo $dropdownvalue;
|
|
//$('#monthyear').attr('selected',true);
|
|
//alert($s);
|
|
|
|
$("#formid").attr("method", "post");
|
|
//alert($s);
|
|
$("#formid").attr("action", "<?php echo base_url() ?>monthlypay");
|
|
|
|
$('#formid').submit();
|
|
|
|
|
|
});
|
|
|
|
function savebuttonvalidation() {
|
|
var curselection = $("#monthyear").val();
|
|
var currentdate = new Date();
|
|
var currentmonth = currentdate.getMonth();
|
|
var currentyear = currentdate.getFullYear();
|
|
currentmonth++;
|
|
var res = curselection.split("-");
|
|
var selmonth = res[0];
|
|
var selyear = res[1];
|
|
var savebuttonstatus = currentmonth - selmonth;
|
|
var year = currentyear - selyear;
|
|
if (savebuttonstatus >= 2) {
|
|
if (year == 1) {
|
|
$("#savebutton").hide();
|
|
} else {
|
|
$("#savebutton").hide();
|
|
}
|
|
} else if (savebuttonstatus < 0) {
|
|
|
|
if (year == 1) {
|
|
$("#savebutton").show();
|
|
} else if (year == 0) {
|
|
$("#savebutton").hide();
|
|
} else {
|
|
$("#savebutton").hide();
|
|
}
|
|
} else if (savebuttonstatus == 0 && year == 0) {
|
|
$("#savebutton").hide();
|
|
} else if (savebuttonstatus == 1) {
|
|
if (year == 0 || year == 1) {
|
|
$("#savebutton").show();
|
|
} else {
|
|
$("#savebutton").show();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var totalfestival = [];
|
|
var totalempSal = [];
|
|
var grandtotal = [];
|
|
|
|
function changeInput(event, k) {
|
|
var str = event.target.id;
|
|
var sno = str.substr(8);
|
|
var dayWorks = parseFloat(document.getElementById('dayWork' + sno).textContent);
|
|
var lopDay = parseFloat(document.getElementById('lopDay' + sno).textContent);
|
|
var paidLeave = parseFloat(document.getElementById('paidLeave' + sno).textContent);
|
|
var otHrsWork = parseFloat(document.getElementById('otHrsWork' + sno).textContent);
|
|
var monthDue = parseFloat(document.getElementById('monthDue' + sno).textContent);
|
|
var duedate = document.getElementById('duedate' + sno).value;
|
|
duedate = new Date(duedate);
|
|
var paydate = document.getElementById('paydate').value;
|
|
if (paydate.length == 6) {
|
|
paydate = '0' + paydate;
|
|
}
|
|
var pmonthonly = paydate.substring(0, 2);
|
|
var pyearonly = paydate.substring(3);
|
|
var pday = new Date(pyearonly, pmonthonly, 0).getDate();
|
|
var finalpaydate = pyearonly + '-' + pmonthonly + '-' + pday;
|
|
finalpaydate = new Date(finalpaydate);
|
|
var otherDet = parseFloat(document.getElementById('otherDet' + sno).textContent);
|
|
totalotherDet[sno] = otherDet;
|
|
var Festival = parseFloat(document.getElementById('Festival' + sno).textContent);
|
|
totalfestival[sno] = Festival;
|
|
var empsal = parseFloat(document.getElementById('empsal' + sno).textContent);
|
|
var bpay = parseFloat(document.getElementById('bPay' + sno).value);
|
|
var hraRate = parseFloat(document.getElementById('hraRate' + sno).value);
|
|
var allow = parseFloat(document.getElementById('allow' + sno).value);
|
|
var fAllow = parseFloat(document.getElementById('fAllow' + sno).value);
|
|
var pfRate = parseFloat(document.getElementById('pfRate' + sno).value);
|
|
var eslRate = parseFloat(document.getElementById('eslRate' + sno).value);
|
|
var hraAmt = parseFloat(document.getElementById('hraAmt' + sno).value);
|
|
// var Balance_Amount =parseFloat(document.getElementById('Balance'+sno).value);
|
|
var loanamt = parseFloat(document.getElementById('loanamt' + sno).value);
|
|
var paidamt = parseFloat(document.getElementById('paidamt' + sno).value);
|
|
var sunday = parseFloat(document.getElementById('sunday' + sno).value);
|
|
var is_management_team = parseFloat(document.getElementById('is_management_team' + sno).value);
|
|
var esi_applicable = parseFloat(document.getElementById('esi_applicable' + sno).value);
|
|
var pf_applicable = parseFloat(document.getElementById('pf_applicable' + sno).value);
|
|
|
|
var pfAmtString = document.getElementById('pfAmt' + sno).textContent;
|
|
pfAmtString = pfAmtString.replace(/,/g, '');
|
|
var pfAmt = parseFloat(pfAmtString);
|
|
|
|
var esiAmtString = document.getElementById('esiAmt' + sno).textContent;
|
|
esiAmtString = esiAmtString.replace(/,/g, '');
|
|
var esiAmt = parseFloat(esiAmtString);
|
|
|
|
|
|
|
|
if (is_management_team == 1) {
|
|
var dayWorkPaid = dayWorks + paidLeave + lopDay;
|
|
} else {
|
|
var dayWorkPaid = dayWorks + paidLeave;
|
|
}
|
|
|
|
|
|
var NoofDays = dayWorks + paidLeave + lopDay;
|
|
|
|
var Food_Allowances = fAllow * dayWorks;
|
|
|
|
|
|
var daySalary = bpay / NoofDays;
|
|
|
|
var dayHra = hraAmt / NoofDays;
|
|
|
|
var onehoursSalary = (daySalary + dayHra) / 8;
|
|
|
|
|
|
|
|
var totSalayOT = 0;
|
|
if (otHrsWork != 0) {
|
|
totSalayOT = otHrsWork * onehoursSalary;
|
|
} else {
|
|
totSalayOT = 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
var currentDaySalary = daySalary * dayWorkPaid;
|
|
if (isNaN(currentDaySalary)) { currentDaySalary = 0; }
|
|
|
|
var currentDayHra = dayHra * dayWorkPaid;
|
|
if (isNaN(currentDayHra)) { currentDayHra = 0; }
|
|
|
|
|
|
var current_loan_amt = 0;
|
|
var autoLoan = parseFloat(monthDue);
|
|
|
|
var Balance_Amount = loanamt - paidamt;
|
|
|
|
if (autoLoan > Balance_Amount) {
|
|
if (duedate <= finalpaydate) {
|
|
current_loan_amt = Balance_Amount;
|
|
}
|
|
} else {
|
|
current_loan_amt = autoLoan;
|
|
}
|
|
|
|
|
|
if (parseFloat(Festival) == parseFloat(Festival)) {
|
|
|
|
var Festivals = parseFloat(Festival);
|
|
|
|
|
|
}
|
|
|
|
if (parseFloat(otherDet) == parseFloat(otherDet)) {
|
|
|
|
var otherDets = parseFloat(otherDet);
|
|
|
|
|
|
}
|
|
|
|
|
|
pfAmount = 0;
|
|
if (pf_applicable == 1) {
|
|
pfAmount = pfAmt;
|
|
} else {
|
|
pfAmount = 0;
|
|
}
|
|
|
|
esiAmount = 0;
|
|
if (esi_applicable == 1) {
|
|
esiAmount = esiAmt;
|
|
} else {
|
|
esiAmount = 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var empSalaryAdd = currentDaySalary + totSalayOT + currentDayHra + Festivals;
|
|
|
|
var empSalarySub = current_loan_amt + esiAmount + pfAmount + otherDets;
|
|
|
|
|
|
|
|
var empMonthSalary = empSalaryAdd - empSalarySub
|
|
|
|
var employeeSalary = Math.round(empMonthSalary);
|
|
|
|
|
|
var cals = (employeeSalary).toFixed(0);
|
|
|
|
document.getElementById("empsal" + sno).innerHTML = cals;
|
|
|
|
|
|
// $.each(estTotal, function(i, value) {
|
|
// if (sno == i) {
|
|
// estTotal[i] = cals;
|
|
// }
|
|
// });
|
|
// $.each(totalotherDet, function(i, value) {
|
|
// if (sno == i) {
|
|
// totalotherDet[i] = otherDet;
|
|
// }
|
|
// });
|
|
// $.each(totalmonthloan, function(i, value) {
|
|
// if (sno == i) {
|
|
// totalmonthloan[i] = loanRecd;
|
|
// }
|
|
// });
|
|
|
|
|
|
calculategrandtotal();
|
|
|
|
}
|
|
|
|
function driverchangeInput(event, k) {
|
|
var str = event.target.id;
|
|
var sno = str.substr(8);
|
|
|
|
// console.log(sno);return true;
|
|
|
|
var driverEarn = parseFloat(document.getElementById('ttlsalary' + sno).textContent);
|
|
var grosssalary = parseFloat(document.getElementById('grosalary' + sno).textContent);
|
|
var basicsalary = parseFloat(document.getElementById('bassalary' + sno).textContent);
|
|
var hrasalary = parseFloat(document.getElementById('hrasalary' + sno).textContent);
|
|
|
|
var Festivals = parseFloat(document.getElementById('Festival' + sno).textContent);
|
|
totalfestival[sno] = Festivals;
|
|
|
|
var ESI = parseFloat(document.getElementById('esiAmt' + sno).textContent);
|
|
var PF = parseFloat(document.getElementById('pfAmt' + sno).textContent);
|
|
|
|
var element = document.getElementById('loanatm' + sno);
|
|
|
|
var loanamt = parseFloat(element.value);
|
|
|
|
var paidamt = parseFloat(document.getElementById('paidamt' + sno).value);
|
|
var monthDue = parseFloat(document.getElementById('monthDue' + sno).textContent);
|
|
var duedate = document.getElementById('duedate' + sno).value;
|
|
|
|
duedate = new Date(duedate);
|
|
var paydate = document.getElementById('paydate').value;
|
|
var paydate = document.getElementById('paydate').value;
|
|
if (paydate.length == 6) {
|
|
paydate = '0' + paydate;
|
|
}
|
|
var pmonthonly = paydate.substring(0, 2);
|
|
var pyearonly = paydate.substring(3);
|
|
var pday = new Date(pyearonly, pmonthonly, 0).getDate();
|
|
var finalpaydate = pyearonly + '-' + pmonthonly + '-' + pday;
|
|
finalpaydate = new Date(finalpaydate);
|
|
|
|
|
|
var current_loan_amt = 0;
|
|
var autoLoan = parseFloat(monthDue);
|
|
console.log(autoLoan,"autoLoan");
|
|
var Balance_Amount = loanamt - paidamt;
|
|
|
|
if (autoLoan > Balance_Amount) {
|
|
if (duedate <= finalpaydate) {
|
|
current_loan_amt = Balance_Amount;
|
|
}
|
|
} else {
|
|
current_loan_amt = autoLoan;
|
|
}
|
|
|
|
if (isNaN(basicsalary)) { basicsalary = 0; }
|
|
if (isNaN(hrasalary)) { hrasalary = 0; }
|
|
|
|
|
|
var driverSalaryAdd = basicsalary + hrasalary + Festivals;
|
|
console.log('bas + hra + bon ',driverSalaryAdd);
|
|
|
|
var driverSalarySub = current_loan_amt+ESI + PF ;
|
|
console.log("L + E + P ",current_loan_amt);
|
|
|
|
|
|
var driverMonthSalary = driverSalaryAdd - driverSalarySub
|
|
var driverSalary = Math.round(driverMonthSalary);
|
|
console.log("Sal ",driverSalary);
|
|
|
|
|
|
var cals = (driverSalary).toFixed(0);
|
|
|
|
document.getElementById("empsal" + sno).innerHTML = cals;
|
|
|
|
// copied from calculategrandtotal() because we need those two only thats why
|
|
var AutoLoanDueIndex = 22;
|
|
var AutoLoanDue = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(AutoLoanDueIndex).text();
|
|
AutoLoanDue += parseFloat(value) || 0;
|
|
});
|
|
$('#monthloan').text(AutoLoanDue);
|
|
|
|
var FestivalBonusIndex = 24;
|
|
var FestivalBonus = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(FestivalBonusIndex).text();
|
|
FestivalBonus += parseFloat(value) || 0;
|
|
});
|
|
$('#fest').text(FestivalBonus);
|
|
|
|
var EstimateIndex = 25;
|
|
var Estimate = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(EstimateIndex).text();
|
|
Estimate += parseFloat(value) || 0;
|
|
});
|
|
$('#estsal').text(Estimate);
|
|
|
|
}
|
|
|
|
function calculategrandtotal()
|
|
{
|
|
var AutoLoanDueIndex = 22;
|
|
var AutoLoanDue = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(AutoLoanDueIndex).text();
|
|
AutoLoanDue += parseFloat(value) || 0;
|
|
});
|
|
$('#monthloan').text(AutoLoanDue);
|
|
|
|
var TDSDeductionsIndex = 23;
|
|
var TDSDeductions = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(TDSDeductionsIndex).text();
|
|
TDSDeductions += parseFloat(value) || 0;
|
|
});
|
|
$('#other').text(TDSDeductions);
|
|
|
|
var FestivalBonusIndex = 24;
|
|
var FestivalBonus = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(FestivalBonusIndex).text();
|
|
FestivalBonus += parseFloat(value) || 0;
|
|
});
|
|
$('#fest').text(FestivalBonus);
|
|
|
|
var EstimateIndex = 25;
|
|
var Estimate = 0;
|
|
$('#monthlylistings tbody tr').each(function() {
|
|
var value = $(this).find('td').eq(EstimateIndex).text();
|
|
Estimate += parseFloat(value) || 0;
|
|
});
|
|
$('#estsal').text(Estimate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function openDriverLoad(element) {
|
|
var empId = $(element).data("empid"); // Get the empid from clicked element
|
|
var monthYear = $('#monthyear').val();
|
|
// Convert "03-2025" to "Mar-2025"
|
|
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
var parts = monthYear.split('-');
|
|
var monthIndex = parseInt(parts[0], 10) - 1; // Convert "03" to index 2 (March)
|
|
var formattedMonthYear = monthNames[monthIndex] + '-' + parts[1];
|
|
|
|
var baseUrl = "<?= base_url(); ?>"; // Ensure this echoes the correct base URL
|
|
var requestUrl = baseUrl + "loadDriverAttendance?month_year=" + encodeURIComponent(formattedMonthYear) + "&drv_id=" + encodeURIComponent(empId);
|
|
|
|
// Open the URL in a new tab
|
|
window.open(requestUrl, "_blank");
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
}
|
|
}
|
|
|
|
|
|
function showMessage(msg) {
|
|
let msgBox = document.getElementById("successMessage");
|
|
msgBox.innerText = msg; // Set API message
|
|
msgBox.style.display = "block";
|
|
|
|
// Hide message after 3 seconds
|
|
setTimeout(() => {
|
|
msgBox.style.display = "none";
|
|
}, 3000);
|
|
}
|
|
|
|
$("#searchInput").on("keyup", function () {
|
|
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
|
|
|
|
$("#table-responsive tbody tr").filter(function () {
|
|
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|