Driverpayinputs : ps
This commit is contained in:
parent
8697edd670
commit
45368dec10
@ -83,13 +83,15 @@ $routes->post('fetchDriverDetails', 'Driver::fetchDriverDetails');// for Ajax bo
|
||||
$routes->get('reActivateDriver', 'Driver::reActivateDriver');
|
||||
$routes->get('deleteDriver', 'Driver::deleteDriver');
|
||||
$routes->post('checkDriver', 'Driver::checkDriver');
|
||||
|
||||
// Driver Trip Routes
|
||||
$routes->match(['GET', 'POST'], 'loadDriverAttendance', 'Driver::loadDriverAttendance');
|
||||
$routes->post('fetchDriverAttendanceDetails', 'Driver::fetchDriverAttendanceDetails');
|
||||
$routes->get('reActivateDriverAttendance', 'Driver::reActivateDriverAttendance');
|
||||
$routes->get('deleteDriverAttendance', 'Driver::deleteDriverAttendance');
|
||||
$routes->post('gatheredCustAndQty', 'Driver::gatheredCustAndQty');
|
||||
|
||||
// Driver Monthly Pay Inputs Routes
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverMonthlyPayInputs', 'Driver::driverMonthlyPayInputs');
|
||||
$routes->post('saveMonthlyData', 'Driver::saveMonthlyData');
|
||||
// Asset Detail Routes
|
||||
$routes->get('assetListing', 'Assetdetails::assetListing');
|
||||
$routes->get('addasset', 'Assetdetails::addasset');
|
||||
|
||||
@ -242,4 +242,100 @@ class Driver extends BaseController
|
||||
$results = $this->driver_model->gatheredCustAndQty($invoice);
|
||||
return $this->response->setJSON($results);
|
||||
}
|
||||
|
||||
public function driverMonthlyPayInputs()
|
||||
{
|
||||
$current = $this->request->getGet('month_year') ? $this->request->getGet('month_year') : date("n-Y"); // for get - input header click and dropdown changes
|
||||
|
||||
list($month, $year) = explode('-', $current);
|
||||
|
||||
$month_in_number = get_date_time_dynamical_format('n','m',"$month");// refer helper
|
||||
|
||||
$get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year);
|
||||
|
||||
$from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year");
|
||||
$to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year");
|
||||
|
||||
// $data['monthinputs']
|
||||
$attendance_data = $this->driver_model->driverAttendanceForMonthlyPayInputs($from_mysql_date,$to_mysql_date);
|
||||
$format_month_year = get_date_time_dynamical_format('n-Y','m-Y',"$current");
|
||||
|
||||
$monthly_pay_data = $this->driver_model->driverMonthlyPayInputs($format_month_year);
|
||||
// dd($attendance_data);
|
||||
// dd($monthly_pay_data);
|
||||
|
||||
// both foreach refer with chatgpt array data replacement....
|
||||
$monthly_pay_array = [];
|
||||
foreach ($monthly_pay_data as $row) {
|
||||
$monthly_pay_array[$row->driver_id] = $row;
|
||||
}
|
||||
|
||||
foreach ($attendance_data as &$attendance) {
|
||||
if (isset($monthly_pay_array[$attendance->driver_id])) {
|
||||
// Replace values where data exists in driverMonthlyPayInputs2
|
||||
$attendance->driver_earnings_amount = $monthly_pay_array[$attendance->driver_id]->driver_earnings_amount;
|
||||
$attendance->diesel = $monthly_pay_array[$attendance->driver_id]->diesel;
|
||||
$attendance->shed_duty_amount = $monthly_pay_array[$attendance->driver_id]->shed_duty_amount;
|
||||
$attendance->driver_final_payment = $monthly_pay_array[$attendance->driver_id]->driver_final_payment;
|
||||
}
|
||||
}
|
||||
|
||||
$data['monthinputs'] = $attendance_data;
|
||||
$data['dropdownvalue'] = $current;
|
||||
// dd($data['monthinputs']);
|
||||
|
||||
$this->global['pageTitle'] = 'Driver Monthly Inputs';
|
||||
$this->loadViews("driverMonthlyPayInputs", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
function saveMonthlyData()
|
||||
{
|
||||
|
||||
$jsondata = (string)$this->request->getPost('param1');
|
||||
|
||||
$json = json_decode($jsondata, true);
|
||||
|
||||
$month = (string)$this->request->getPost('param2');
|
||||
|
||||
$formattedmonth = get_date_time_dynamical_format('n-Y','m-Y',"$month");
|
||||
|
||||
$total = 0;
|
||||
|
||||
foreach ($json as $index => $j) {
|
||||
|
||||
$ID = isset($j['Driver Id']) ? $j['Driver Id'] : '' ;
|
||||
$NAME = isset($j['Driver Name']) ? $j['Driver Name'] : '' ;
|
||||
$LOAD = isset($j['Number Of Load']) ? $j['Number Of Load'] : 0 ;
|
||||
$SALARY = isset($j['Salary Amount ₹']) ? $j['Salary Amount ₹'] : 0.00 ;
|
||||
$FOOD = isset($j['Food Amount ₹']) ? $j['Food Amount ₹'] : 0.00 ;
|
||||
$TOTAL = isset($j['Total Amount ₹']) ? $j['Total Amount ₹'] : 0.00 ;
|
||||
$DIESEL = isset($j['Diesel']) ? $j['Diesel'] : 0.00 ;
|
||||
$SHED = isset($j['Shed Duty']) ? $j['Shed Duty'] : 0.00 ;
|
||||
$GRAND = isset($j['Grand Total in ₹']) ? $j['Grand Total in ₹'] : 0.00;
|
||||
$CREATED = $this->session->get('userId');
|
||||
$UPDATED = $this->session->get('userId');
|
||||
|
||||
$monthlypaydata = array(
|
||||
'month_year' => $formattedmonth,
|
||||
'driver_id' =>$ID,
|
||||
'driver_name' =>$NAME,
|
||||
'no_of_loads' =>$LOAD,
|
||||
'driver_monthly_salary_amount' =>$SALARY,
|
||||
'driver_monthly_food_amount' =>$FOOD,
|
||||
'driver_earnings_amount' =>$TOTAL,
|
||||
'diesel' =>$DIESEL,
|
||||
'shed_duty_amount' =>$SHED,
|
||||
'driver_final_payment' =>$GRAND,
|
||||
'created_by'=>$CREATED,
|
||||
'updated_by'=>$UPDATED
|
||||
|
||||
);
|
||||
|
||||
$result = $this->driver_model->saveMonthlyData($monthlypaydata);
|
||||
$total = $total + $result;
|
||||
}
|
||||
|
||||
echo $total . "- Driver Updated Successfully ";
|
||||
}
|
||||
|
||||
}
|
||||
@ -91,7 +91,68 @@ class Driver_model extends Model
|
||||
return $query->getRowArray() ?: [];
|
||||
}
|
||||
|
||||
|
||||
function driverAttendanceForMonthlyPayInputs($from,$to){
|
||||
$builder = $this->db->table('t_driver_attendance')
|
||||
->select('t_driver_attendance.driver_id,SUM(t_driver_attendance.salary_amount) as driver_monthly_salary_amount,SUM(t_driver_attendance.food_amount) as driver_monthly_food_amount,t_driver.driver_name,
|
||||
DATE_FORMAT(date, "%M-%Y") AS month_year,SUM(salary_amount + food_amount) AS driver_earnings_amount,COUNT(t_driver_attendance.load_type) AS no_of_loads')
|
||||
->join('t_driver', 't_driver.driver_id = t_driver_attendance.driver_id and t_driver.isactive = 1', 'left')
|
||||
->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"')
|
||||
->groupBy('t_driver.driver_id, DATE_FORMAT(t_driver_attendance.date, "%M-%Y")');
|
||||
|
||||
$query = $builder->get();
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
function driverMonthlyPayInputs($monthYear){
|
||||
|
||||
$builder = $this->db->table('t_driver_monthly_pay_inputs');
|
||||
$query = $builder->where('t_driver_monthly_pay_inputs.month_year', $monthYear)
|
||||
->groupBy('t_driver_monthly_pay_inputs.driver_id, t_driver_monthly_pay_inputs.month_year')
|
||||
->get();
|
||||
|
||||
$result = $query->getResult();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function saveMonthlyData($data)
|
||||
{
|
||||
|
||||
$month = $data['month_year'];
|
||||
$drid = $data['driver_id'];
|
||||
$count = 0;
|
||||
|
||||
$builder = $this->db->table('t_driver_monthly_pay_inputs')->select('count(*) as count')
|
||||
->where('month_year', $month)
|
||||
->where('driver_id', $drid);
|
||||
$isExits = $builder->get();
|
||||
$res = $isExits->getResultArray();
|
||||
|
||||
if (!empty($res)) {
|
||||
|
||||
$count = $res[0]['count'];
|
||||
}
|
||||
|
||||
|
||||
if ($count == 0) {
|
||||
unset($data['updated_by']);
|
||||
$builder = $this->db->table('t_driver_monthly_pay_inputs');
|
||||
$builder->insert($data);
|
||||
$i = $this->db->affectedRows();
|
||||
return $i;
|
||||
} elseif ($count == 1) {
|
||||
unset($data['created_by']);
|
||||
$this->db->table('t_driver_monthly_pay_inputs')
|
||||
->where('driver_id', $data['driver_id'])
|
||||
->where('month_year', $data['month_year'])
|
||||
->update($data);
|
||||
|
||||
$i = $this->db->affectedRows();
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
559
app/Views/driverMonthlyPayInputs.php
Normal file
559
app/Views/driverMonthlyPayInputs.php
Normal file
@ -0,0 +1,559 @@
|
||||
<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
|
||||
// echo "****";die;
|
||||
|
||||
$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 m-0">
|
||||
<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">Driver's Monthly Pay Information</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<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 = $dropdownvalue; // $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('month_year', $ot, set_value('month_year', $currentselection), 'id="month_year"', 'class="form-control select2'); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-3 ">
|
||||
<i id="exportButton" class="fas fa-download download-icon" style="font-size: x-large; margin-top:12px;" title="Export Excel"></i>
|
||||
</div>
|
||||
|
||||
<div class="col-6 text-right" id="savebutton">
|
||||
<input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" style="overflow-x:scroll;">
|
||||
<table id="drivermonthlylistings" 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 style="display:none;">Driver Id</th>
|
||||
<th class="celda_encabezado_general">S.No</th>
|
||||
<th class="celda_encabezado_general">Driver Name </th>
|
||||
<th class="celda_encabezado_general">Number Of Load</th>
|
||||
<th class="celda_encabezado_general">Salary Amount ₹</th>
|
||||
<th class="celda_encabezado_general">Food Amount ₹</th>
|
||||
<th class="celda_encabezado_general">Total Amount ₹</th>
|
||||
<th class="celda_encabezado_general">Diesel</th>
|
||||
<th class="celda_encabezado_general">Shed Duty</th>
|
||||
<th class="celda_encabezado_general">Grand Total in ₹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
$index = 0;
|
||||
if (!empty($monthinputs)) {
|
||||
foreach ($monthinputs as $i => $record) {
|
||||
$index++;
|
||||
?>
|
||||
|
||||
<tr class="lastvalue">
|
||||
<td style="display:none;"><?php echo $record->driver_id; ?></td>
|
||||
<td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td> <!-- s.no -->
|
||||
<td id="driver<?php echo $index ?>" style="max-width:80px"><?php echo $record->driver_name; ?></td>
|
||||
<td id="loadno<?php echo $index ?>" style="max-width:40px;text-align:right;"><?php echo $record->no_of_loads; ?></td>
|
||||
<td id="slryam<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
||||
<?php if (!empty($record->driver_monthly_salary_amount)) {
|
||||
$totalforfooter[] = $record->driver_monthly_salary_amount;
|
||||
echo number_format($record->driver_monthly_salary_amount, 2, '.', '');
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
} ?>
|
||||
<td id="foodam<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
||||
<?php if (!empty($record->driver_monthly_food_amount)) {
|
||||
$totalforfooter2[] = $record->driver_monthly_food_amount;
|
||||
echo number_format($record->driver_monthly_food_amount, 2, '.', '');
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
} ?>
|
||||
</td>
|
||||
<td id="totala<?php echo $index ?>" style="max-width:80px;text-align:right;">
|
||||
<?php $driver_earnings_amount = isset($record->driver_earnings_amount) ? $record->driver_earnings_amount : ($record->driver_monthly_salary_amount + $record->driver_monthly_food_amount);
|
||||
if (!empty($driver_earnings_amount)) {
|
||||
$totalforfooter3[] = $driver_earnings_amount;
|
||||
echo number_format($driver_earnings_amount, 2, '.', '');
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
} ?>
|
||||
</td>
|
||||
<td id="diesel<?php echo $index ?>" style="max-width:80px;text-align:right;" onkeypress="return isNumber(event);" onkeyup="changeInput(event, <?php echo $index; ?>);"
|
||||
<?php if (empty($record->Key)) {
|
||||
echo "contenteditable='true';";
|
||||
} ?>
|
||||
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated" style="text-align:right;color:blue;"
|
||||
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
||||
|
||||
<?php if (!empty($record->diesel)) {
|
||||
echo number_format($record->diesel, 2, '.', '');
|
||||
$totalforfooter4[] = $record->diesel;
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
} ?>
|
||||
</td>
|
||||
<td id="sheddu<?php echo $index ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event, <?php echo $index; ?>);"
|
||||
<?php if (empty($record->Key)) {
|
||||
echo "contenteditable='true';";
|
||||
} ?>
|
||||
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
||||
style="text-align:right;color:blue;"
|
||||
<?php } else { ?>style="text-align:right;" <?php } ?>>
|
||||
|
||||
<?php if (!empty($record->shed_duty_amount)) {
|
||||
echo number_format($record->shed_duty_amount, 2, '.', '');
|
||||
$totalforfooter5[] = $record->shed_duty_amount;
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
} ?>
|
||||
</td>
|
||||
<td id="grdttl<?php echo $index ?>"
|
||||
<?php if (empty($record->Key)) {
|
||||
echo "contenteditable='false';";
|
||||
} ?>
|
||||
<?php if (!empty($record->Key)) { ?> title="Payslip Calculated"
|
||||
style="text-align:right;color:blue;" <?php }else{ ?>style="text-align:right;" <?php } ?>>
|
||||
<?php if (!empty($record->driver_final_payment)) {
|
||||
echo number_format($record->driver_final_payment, 2, '.', '');
|
||||
$totalforfooter6[] = $record->driver_final_payment;
|
||||
} else {
|
||||
echo number_format(0.00, 2, '.', '');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<input type="hidden" id="driver_id<?php echo $index ?>"
|
||||
value="<?php echo $record->driver_id ?>">
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th style="display:none;"></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th></th>
|
||||
<th id="footercol4" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter) ? number_format(array_sum($totalforfooter), 2) : '0.00'; ?>
|
||||
</th>
|
||||
<th id="footercol5" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter2) ? number_format(array_sum($totalforfooter2), 2) : '0.00'; ?>
|
||||
</th>
|
||||
<th id="footercol6" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter3) ? number_format(array_sum($totalforfooter3), 2) : '0.00'; ?>
|
||||
</th>
|
||||
<th id="footercol7" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter4) ? number_format(array_sum($totalforfooter4), 2) : '0.00'; ?>
|
||||
</th>
|
||||
<th id="footercol8" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter5) ? number_format(array_sum($totalforfooter5), 2) : '0.00'; ?>
|
||||
</th>
|
||||
<th id="footercol9" style="text-align:right;">
|
||||
<?php echo isset($totalforfooter6) ? number_format(array_sum($totalforfooter6), 2) : '0.00'; ?>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
</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 = 'driverMonthlyPay.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('drivermonthlylistings');
|
||||
});
|
||||
});
|
||||
|
||||
$('#month_year').attr('class', 'form-control');
|
||||
|
||||
|
||||
|
||||
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 getAllData() {
|
||||
|
||||
var alldata = $("#drivermonthlylistings").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["Driver Id"].trim() !== "";
|
||||
});
|
||||
|
||||
// Convert the filtered array back to a JSON string if needed
|
||||
alldata = JSON.stringify(alldata);
|
||||
var month = $('#month_year').val();
|
||||
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
param1: alldata,
|
||||
param2: month
|
||||
},
|
||||
//dataType:"json",
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>saveMonthlyData",
|
||||
success: function(data) {
|
||||
|
||||
if (data) {
|
||||
$('#loader').hide();
|
||||
alert(data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$("#month_year").change(function() {
|
||||
|
||||
$s = $('#month_year').val();
|
||||
|
||||
$("#formid").attr("method", "get");
|
||||
|
||||
$("#formid").attr("action", "<?php echo base_url() ?>driverMonthlyPayInputs");
|
||||
|
||||
$('#formid').submit();
|
||||
|
||||
|
||||
});
|
||||
|
||||
function changeInput(event, sno) {
|
||||
var str = event.target.id;
|
||||
var salary_amount = parseFloat(document.getElementById('slryam' + sno).textContent) || 0;
|
||||
var food_amount = parseFloat(document.getElementById('foodam' + sno).textContent) || 0;
|
||||
var diesel_amount = parseFloat(document.getElementById('diesel' + sno).textContent) || 0;
|
||||
var shedduty = parseFloat(document.getElementById('sheddu' + sno).textContent) || 0;
|
||||
var grand_total = parseFloat(document.getElementById('grdttl' + sno).textContent) || 0;
|
||||
var driver_final_payment = salary_amount+food_amount+diesel_amount+shedduty;
|
||||
var employeeSalary = Math.round(driver_final_payment);
|
||||
var cals = (employeeSalary).toFixed(2);
|
||||
document.getElementById("grdttl" + sno).innerHTML = cals;
|
||||
calculategrandtotal();
|
||||
// return;
|
||||
|
||||
}
|
||||
|
||||
function calculategrandtotal()
|
||||
{
|
||||
var FooterColFourthIndex = 4;
|
||||
var FooterColFourthVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColFourthIndex).text();
|
||||
FooterColFourthVal += parseFloat(value) || 0;
|
||||
});
|
||||
let FourthVal = FooterColFourthVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol4').text(FourthVal);
|
||||
// $('#footercol4').text((FooterColFourthVal).toFixed(2));
|
||||
|
||||
var FooterColFifthIndex = 5;
|
||||
var FooterColFifthVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColFifthIndex).text();
|
||||
FooterColFifthVal += parseFloat(value) || 0;
|
||||
});
|
||||
let FifthVal = FooterColFifthVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol5').text(FifthVal);
|
||||
// $('#footercol5').text((FooterColFifthVal).toFixed(2));
|
||||
|
||||
var FooterColSixthIndex = 6;
|
||||
var FooterColSixthVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColSixthIndex).text();
|
||||
FooterColSixthVal += parseFloat(value) || 0;
|
||||
});
|
||||
let SixthVal = FooterColSixthVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol6').text(SixthVal);
|
||||
// $('#footercol6').text((FooterColSixthVal).toFixed(2));
|
||||
|
||||
var FooterColSeventhIndex = 7;
|
||||
var FooterColSeventhVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColSeventhIndex).text();
|
||||
FooterColSeventhVal += parseFloat(value) || 0;
|
||||
});
|
||||
let SeventhVal = FooterColSeventhVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol7').text(SeventhVal);
|
||||
// $('#footercol7').text((FooterColSeventhVal).toFixed(2));
|
||||
|
||||
var FooterColEigthIndex = 8;
|
||||
var FooterColEigthVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColEigthIndex).text();
|
||||
FooterColEigthVal += parseFloat(value) || 0;
|
||||
});
|
||||
let EigthVal = FooterColEigthVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol8').text(EigthVal);
|
||||
// $('#footercol8').text((FooterColEigthVal).toFixed(2));
|
||||
|
||||
var FooterColNinthIndex = 9;
|
||||
var FooterColNinthVal = 0;
|
||||
$('#drivermonthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FooterColNinthIndex).text();
|
||||
FooterColNinthVal += parseFloat(value) || 0;
|
||||
});
|
||||
let NinthVal = FooterColNinthVal.toLocaleString("en-IN", { minimumFractionDigits: 2,maximumFractionDigits: 2 });
|
||||
$('#footercol9').text(NinthVal);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -770,7 +770,7 @@
|
||||
<div class="dropdown">
|
||||
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
|
||||
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="ri-secure-payment-line align-middle mr-1"></i> PaySlip <div class="arrow-down"></div>
|
||||
<i class="ri-secure-payment-line align-middle mr-1"></i> Employee PaySlip <div class="arrow-down"></div>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="topnav-payslip">
|
||||
<a href="<?php echo base_url(); ?>monthlypay" class="dropdown-item">Monthly Pay Information </a>
|
||||
@ -780,6 +780,20 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
|
||||
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="ri-secure-payment-line align-middle mr-1"></i> Driver PaySlip <div class="arrow-down"></div>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="topnav-payslip">
|
||||
<a href="<?php echo base_url(); ?>driverMonthlyPayInputs" class="dropdown-item">Monthly Pay Information </a>
|
||||
<a href="#" class="dropdown-item">PaySlip Generator</a>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"
|
||||
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user