GWM : navigation menu
This commit is contained in:
parent
63ce96efec
commit
dac2812848
@ -1,140 +1,138 @@
|
|||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
$datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||||
?>
|
?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.num {
|
.num {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.fht-table,
|
.fht-table,
|
||||||
.fht-table thead,
|
.fht-table thead,
|
||||||
.fht-table tfoot,
|
.fht-table tfoot,
|
||||||
.fht-table tbody,
|
.fht-table tbody,
|
||||||
.fht-table tr,
|
.fht-table tr,
|
||||||
.fht-table th,
|
.fht-table th,
|
||||||
.fht-table td {
|
.fht-table td {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table td {
|
.fht-table td {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table td:hover {
|
.fht-table td:hover {
|
||||||
background-color: #41a1c8;
|
background-color: #41a1c8;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table {
|
.fht-table {
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||||||
white-space:nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table th,
|
.fht-table th,
|
||||||
.fht-table td {
|
.fht-table td {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table-wrapper,
|
.fht-table-wrapper,
|
||||||
.fht-table-wrapper .fht-thead,
|
.fht-table-wrapper .fht-thead,
|
||||||
.fht-table-wrapper .fht-tfoot,
|
.fht-table-wrapper .fht-tfoot,
|
||||||
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
||||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||||
.fht-table-wrapper .fht-tbody {
|
.fht-table-wrapper .fht-tbody {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||||
.fht-table-wrapper .fht-tbody {
|
.fht-table-wrapper .fht-tbody {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table-wrapper .fht-table .fht-cell {
|
.fht-table-wrapper .fht-table .fht-cell {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table-wrapper .fht-fixed-column,
|
.fht-table-wrapper .fht-fixed-column,
|
||||||
.fht-table-wrapper .fht-fixed-body {
|
.fht-table-wrapper .fht-fixed-body {
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-table-wrapper .fht-fixed-column {
|
.fht-table-wrapper .fht-fixed-column {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fht-fixed-body .fht-thead table {
|
.fht-fixed-body .fht-thead table {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*For Examples*/
|
/*For Examples*/
|
||||||
|
|
||||||
.ContenedorTabla {
|
.ContenedorTabla {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header,
|
.header,
|
||||||
.main {
|
.main {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titulosHeader {
|
.titulosHeader {
|
||||||
border-bottom: 1px solid #e8bb25;
|
border-bottom: 1px solid #e8bb25;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.celda_encabezado_general {
|
.celda_encabezado_general {
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
._Separador {
|
._Separador {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
border-left: 1px solid #ccc;
|
border-left: 1px solid #ccc;
|
||||||
border-right: 1px solid #ccc;
|
border-right: 1px solid #ccc;
|
||||||
width: 7px;
|
width: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
._Separador div {
|
._Separador div {
|
||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.celda_normal {
|
.celda_normal {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*style excel*/
|
/*style excel*/
|
||||||
.excel_cell {
|
.excel_cell {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
color: #222;
|
color: #222;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -143,30 +141,27 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
empty-cells: show;
|
empty-cells: show;
|
||||||
}
|
}
|
||||||
|
|
||||||
._cell_header {
|
._cell_header {
|
||||||
background-color: #EEE;
|
background-color: #EEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
._cell_Default {
|
._cell_Default {
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.excel_cell div {
|
.excel_cell div {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.modal {
|
|
||||||
padding-right: 30% ! important;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#dieselMachineTable th:nth-child(1),
|
#dieselMachineTable th:nth-child(1),
|
||||||
#dieselMachineTable td:nth-child(1)
|
#dieselMachineTable td:nth-child(1) {
|
||||||
{
|
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: #00a65a;
|
background-color: #00a65a;
|
||||||
@ -174,10 +169,60 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
border-right: 2px solid #ddd;
|
border-right: 2px solid #ddd;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<!-- Machine Dropdown -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="machineDropdown">Select Machine</label>
|
||||||
|
<select id="machineDropdown" class="form-control">
|
||||||
|
<option value="">Select Machine</option>
|
||||||
|
<?php foreach ($machineName as $name): ?>
|
||||||
|
<option value="<?= $name; ?>"><?= $name; ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Date Dropdown -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="dateDropdown">Select Date</label>
|
||||||
|
<select id="dateDropdown" class="form-control">
|
||||||
|
<option value="01-11-2024">01-11-2024</option>
|
||||||
|
<option value="02-11-2024">02-11-2024</option>
|
||||||
|
<option value="10-11-2024">10-11-2024</option>
|
||||||
|
<option value="15-11-2024">15-11-2024</option>
|
||||||
|
<option value="25-11-2024">25-11-2024</option>
|
||||||
|
<option value="30-11-2024">30-11-2024</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary float-right" onclick="navigateToMachine()">Navigate</button>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="content-page">
|
<div class="content-page">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<!-- Start Content-->
|
<!-- Start Content-->
|
||||||
@ -208,6 +253,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
@ -216,17 +263,42 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<?php $today = date('M-Y'); ?>
|
<?php $today = date('M-Y'); ?>
|
||||||
<input type="text" name="month" id="month" value="<?php echo $datefordropdown; ?>" class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1">
|
<input type="text" name="month" id="month"
|
||||||
|
value="<?php echo $datefordropdown; ?>" class="form-control"
|
||||||
|
data-provide="datepicker" data-date-format="M-yyyy"
|
||||||
|
data-date-min-view-mode="1">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<input type="submit" value="Change Month" class="btn btn-success" style="margin-top:0px;">
|
<input type="submit" value="Change Month" class="btn btn-success"
|
||||||
|
style="margin-top:0px;">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="dropdown float-right">
|
||||||
|
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
||||||
|
aria-expanded="false">
|
||||||
|
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
||||||
|
<a class="dropdown-item" href="#">Export</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Add table-responsive for horizontal scroll -->
|
<!-- Add table-responsive for horizontal scroll -->
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<?php
|
<?php
|
||||||
@ -242,14 +314,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<table id="dieselMachineTable" class="fht-table table-striped" style="font-size: small;">
|
<table id="dieselMachineTable" class="fht-table table-striped"
|
||||||
|
style="font-size: small;">
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;"></th>
|
<th class="celda_encabezado_general" style="padding: 10px;"></th>
|
||||||
<th class="celda_encabezado_general" colspan="4" style="padding: 10px;">Total Diesel</th>
|
<th class="celda_encabezado_general" colspan="4" style="padding: 10px;">
|
||||||
|
Total Diesel</th>
|
||||||
<?php foreach ($machineName as $name): ?>
|
<?php foreach ($machineName as $name): ?>
|
||||||
<th class="celda_encabezado_general" colspan="6" style="padding: 10px;"><?= $name; ?></th>
|
<th class="celda_encabezado_general" colspan="6" data-id="<?= $name; ?>"
|
||||||
|
style="padding: 10px;"><?= $name; ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -257,7 +332,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach ($columns as $column): ?>
|
<?php foreach ($columns as $column): ?>
|
||||||
<th class="celda_encabezado_general" style="padding: 10px;" id="<?= $column ?>"><?= formatHeader($column) ?></th>
|
<th class="celda_encabezado_general" style="padding: 10px;"
|
||||||
|
id="<?= $column ?>"><?= formatHeader($column) ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -268,25 +344,42 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
<?php foreach ($columns as $index => $column): ?>
|
<?php foreach ($columns as $index => $column): ?>
|
||||||
|
|
||||||
<?php if($index == 0) : ?>
|
<?php if($index == 0) : ?>
|
||||||
<td class="celda_normal" style="padding: 5px;" ><?php echo DateTime::createFromFormat('Y-m-d', $row[$column])->format('d-m-Y'); ?></td>
|
<td class="celda_normal" style="padding: 5px;">
|
||||||
|
<?php echo DateTime::createFromFormat('Y-m-d', $row[$column])->format('d-m-Y'); ?>
|
||||||
|
</td>
|
||||||
<?php elseif(formatHeader($column) == 'Opening Reading'): ?>
|
<?php elseif(formatHeader($column) == 'Opening Reading'): ?>
|
||||||
<td class="celda_normal" <?= ($key == 0) ? 'contenteditable="true"' : ''; ?> style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal"
|
||||||
|
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Closing Reading'): ?>
|
<?php elseif(formatHeader($column) == 'Closing Reading'): ?>
|
||||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateRunningHrs(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" contenteditable="true"
|
||||||
|
onkeyup="calculateRunningHrs(this.parentNode.id,this.textContent);"
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Filling Diesel'): ?>
|
<?php elseif(formatHeader($column) == 'Filling Diesel'): ?>
|
||||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateTotalFillingDiesel(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" contenteditable="true"
|
||||||
|
onkeyup="calculateTotalFillingDiesel(this.parentNode.id,this.textContent);"
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Consumption'): ?>
|
<?php elseif(formatHeader($column) == 'Consumption'): ?>
|
||||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateMileage(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" contenteditable="true"
|
||||||
|
onkeyup="calculateMileage(this.parentNode.id,this.textContent);"
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Running Hours'): ?>
|
<?php elseif(formatHeader($column) == 'Running Hours'): ?>
|
||||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" style="padding: 5px;">
|
||||||
|
<?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Mileage'): ?>
|
<?php elseif(formatHeader($column) == 'Mileage'): ?>
|
||||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" style="padding: 5px;">
|
||||||
|
<?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Opening Stock'): ?>
|
<?php elseif(formatHeader($column) == 'Opening Stock'): ?>
|
||||||
<td class="celda_normal" <?= ($key == 0) ? 'contenteditable="true"' : ''; ?> style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal"
|
||||||
|
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php elseif(formatHeader($column) == 'Purchase Diesel'): ?>
|
<?php elseif(formatHeader($column) == 'Purchase Diesel'): ?>
|
||||||
<td class="celda_normal" contenteditable="true" onkeyup="calculateBalanceStock(this.parentNode.id,this.textContent);" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" contenteditable="true"
|
||||||
|
onkeyup="calculateBalanceStock(this.parentNode.id,this.textContent);"
|
||||||
|
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<td class="celda_normal" style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
|
<td class="celda_normal" style="padding: 5px;">
|
||||||
|
<?= $row[$column] ?? 'N/A' ?></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -324,10 +417,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
$(document).ready(function()
|
|
||||||
{
|
|
||||||
$('#save').click(function() {
|
$('#save').click(function() {
|
||||||
|
|
||||||
// Get headers from the second <thead> as keys
|
// Get headers from the second <thead> as keys
|
||||||
@ -371,21 +461,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function openingReading(parentId, textContent) {
|
||||||
function openingReading(parentId , textContent) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function calculateRunningHrs(parentId , textContent){
|
function calculateRunningHrs(parentId, textContent) {
|
||||||
|
|
||||||
var tr = $('#' + parentId);
|
var tr = $('#' + parentId);
|
||||||
var currentTd = $(event.target);
|
var currentTd = $(event.target);
|
||||||
@ -395,14 +482,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
closingReading = currentTd.text();
|
closingReading = currentTd.text();
|
||||||
openingReading = tr.find('td:eq(' + (tdIndex - 1) + ')').text();
|
openingReading = tr.find('td:eq(' + (tdIndex - 1) + ')').text();
|
||||||
runningHrs = closingReading - openingReading;
|
runningHrs = closingReading - openingReading;
|
||||||
if(runningHrs != NaN && runningHrs != Infinity)
|
if (runningHrs != NaN && runningHrs != Infinity)
|
||||||
tr.find('td:eq(' + (tdIndex + 3) + ')').text(runningHrs.toFixed(2));
|
tr.find('td:eq(' + (tdIndex + 3) + ')').text(runningHrs.toFixed(2));
|
||||||
|
|
||||||
// mileage calculation
|
// mileage calculation
|
||||||
consumption = tr.find('td:eq(' + (tdIndex + 2) + ')').text();
|
consumption = tr.find('td:eq(' + (tdIndex + 2) + ')').text();
|
||||||
runningHrs = runningHrs.toFixed(2);
|
runningHrs = runningHrs.toFixed(2);
|
||||||
mileage = consumption / runningHrs;
|
mileage = consumption / runningHrs;
|
||||||
if(mileage != NaN && mileage != Infinity)
|
if (mileage != NaN && mileage != Infinity)
|
||||||
tr.find('td:eq(' + (tdIndex + 4) + ')').text(mileage.toFixed(2));
|
tr.find('td:eq(' + (tdIndex + 4) + ')').text(mileage.toFixed(2));
|
||||||
|
|
||||||
//next opening reading
|
//next opening reading
|
||||||
@ -412,9 +499,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateMileage(parentId , textContent) {
|
function calculateMileage(parentId, textContent) {
|
||||||
|
|
||||||
var tr = $('#' + parentId);
|
var tr = $('#' + parentId);
|
||||||
var currentTd = $(event.target);
|
var currentTd = $(event.target);
|
||||||
@ -424,13 +511,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
consumption = currentTd.text();
|
consumption = currentTd.text();
|
||||||
runningHrs = tr.find('td:eq(' + (tdIndex + 1) + ')').text();
|
runningHrs = tr.find('td:eq(' + (tdIndex + 1) + ')').text();
|
||||||
result = consumption / runningHrs;
|
result = consumption / runningHrs;
|
||||||
if(result != NaN && result != Infinity)
|
if (result != NaN && result != Infinity)
|
||||||
tr.find('td:eq(' + (tdIndex + 2) + ')').text(result.toFixed(2));
|
tr.find('td:eq(' + (tdIndex + 2) + ')').text(result.toFixed(2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function calculateTotalFillingDiesel(parentId , textContent) {
|
function calculateTotalFillingDiesel(parentId, textContent) {
|
||||||
|
|
||||||
var tr = $('#' + parentId);
|
var tr = $('#' + parentId);
|
||||||
totalFillingDiesel = 0;
|
totalFillingDiesel = 0;
|
||||||
@ -442,7 +529,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
// var headerText = $('table thead th').eq(index).text();
|
// var headerText = $('table thead th').eq(index).text();
|
||||||
var headerText = $('table thead tr:eq(1) th').eq(index).text();
|
var headerText = $('table thead tr:eq(1) th').eq(index).text();
|
||||||
|
|
||||||
if(headerText == 'Filling Diesel'){
|
if (headerText == 'Filling Diesel') {
|
||||||
totalFillingDiesel += value;
|
totalFillingDiesel += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,16 +543,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
fillingDiesel = tr.find('td:eq(' + (3) + ')').text();
|
fillingDiesel = tr.find('td:eq(' + (3) + ')').text();
|
||||||
|
|
||||||
balanceStock = (parseFloat(openingStock) + parseFloat(purchaseDiesel)) - parseFloat(fillingDiesel);
|
balanceStock = (parseFloat(openingStock) + parseFloat(purchaseDiesel)) - parseFloat(fillingDiesel);
|
||||||
if(balanceStock != NaN && balanceStock != Infinity)
|
if (balanceStock != NaN && balanceStock != Infinity)
|
||||||
tr.find('td:eq(' + (4) + ')').text(balanceStock.toFixed(2));
|
tr.find('td:eq(' + (4) + ')').text(balanceStock.toFixed(2));
|
||||||
|
|
||||||
//next opening stock
|
//next opening stock
|
||||||
nextTrIndex = parseInt(parentId, 10) + 1
|
nextTrIndex = parseInt(parentId, 10) + 1
|
||||||
var nexttr = $('#' + nextTrIndex);
|
var nexttr = $('#' + nextTrIndex);
|
||||||
nexttr.find('td:eq(' + (1) + ')').text(balanceStock.toFixed(2));
|
nexttr.find('td:eq(' + (1) + ')').text(balanceStock.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateBalanceStock(parentId , textContent) {
|
function calculateBalanceStock(parentId, textContent) {
|
||||||
|
|
||||||
var tr = $('#' + parentId);
|
var tr = $('#' + parentId);
|
||||||
var currentTd = $(event.target);
|
var currentTd = $(event.target);
|
||||||
@ -477,7 +564,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
fillingDiesel = tr.find('td:eq(' + (tdIndex + 1) + ')').text();
|
fillingDiesel = tr.find('td:eq(' + (tdIndex + 1) + ')').text();
|
||||||
|
|
||||||
balanceStock = (parseFloat(openingStock) + parseFloat(purchaseDiesel)) - parseFloat(fillingDiesel);
|
balanceStock = (parseFloat(openingStock) + parseFloat(purchaseDiesel)) - parseFloat(fillingDiesel);
|
||||||
if(balanceStock != NaN && balanceStock != Infinity)
|
if (balanceStock != NaN && balanceStock != Infinity)
|
||||||
tr.find('td:eq(' + (tdIndex + 2) + ')').text(balanceStock.toFixed(2));
|
tr.find('td:eq(' + (tdIndex + 2) + ')').text(balanceStock.toFixed(2));
|
||||||
|
|
||||||
//next opening stock
|
//next opening stock
|
||||||
@ -485,11 +572,77 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
|||||||
var nexttr = $('#' + nextTrIndex);
|
var nexttr = $('#' + nextTrIndex);
|
||||||
nexttr.find('td:eq(' + (1) + ')').text(balanceStock.toFixed(2));
|
nexttr.find('td:eq(' + (1) + ')').text(balanceStock.toFixed(2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function navigateToMachine() {
|
||||||
|
$('.close').click();
|
||||||
|
const machineDropdown = document.getElementById('machineDropdown');
|
||||||
|
const dateDropdown = document.getElementById('dateDropdown');
|
||||||
|
const selectedMachine = machineDropdown.value;
|
||||||
|
const selectedDate = dateDropdown.value;
|
||||||
|
|
||||||
|
const table = document.getElementById('dieselMachineTable');
|
||||||
|
const headerCells = table.querySelectorAll('thead tr:nth-child(1) th');
|
||||||
|
const rows = table.querySelectorAll('tbody tr');
|
||||||
|
|
||||||
|
let targetColumnIndex = -1;
|
||||||
|
headerCells.forEach((header, index) => {
|
||||||
|
if (header.getAttribute('data-id') === selectedMachine) {
|
||||||
|
targetColumnIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (targetColumnIndex === -1) {
|
||||||
|
console.log("Machine column not found.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let targetRow = null;
|
||||||
|
rows.forEach(row => {
|
||||||
|
const dateCell = row.querySelector('td:first-child');
|
||||||
|
if (dateCell && dateCell.textContent.trim() === selectedDate) {
|
||||||
|
targetRow = row;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!targetRow) {
|
||||||
|
console.log("Date row not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
targetColumnIndex = targetColumnIndex - 2;
|
||||||
|
targetColumnIndex = targetColumnIndex * 6;
|
||||||
|
targetColumnIndex = targetColumnIndex + 5;
|
||||||
|
|
||||||
|
targetRow.cells[targetColumnIndex].scrollIntoView({
|
||||||
|
behavior: 'smooth',
|
||||||
|
inline: 'center',
|
||||||
|
block: 'center'
|
||||||
|
});
|
||||||
|
|
||||||
|
const highlightDuration = 10000;
|
||||||
|
for (let i = targetColumnIndex; i < targetColumnIndex + 6; i++) {
|
||||||
|
const cell = targetRow.cells[i];
|
||||||
|
if (cell) {
|
||||||
|
|
||||||
|
// Scroll the table to ensure the highlighted cell is visible
|
||||||
|
// table.scrollTop = targetRow.offsetTop - table.clientHeight / 2; // Adjust vertical scroll
|
||||||
|
// table.scrollLeft = cell.offsetLeft - table.clientWidth / 2; // Adjust horizontal scroll
|
||||||
|
|
||||||
|
cell.style.transition = "background-color 0.5s";
|
||||||
|
cell.style.backgroundColor = "#df9675";
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
cell.style.backgroundColor = "";
|
||||||
|
}, highlightDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user