stock module latest today vadivel J 24-01-2025
This commit is contained in:
parent
06fd8031d3
commit
e011e967ea
@ -97,29 +97,7 @@
|
||||
padding-bottom: 8px;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
@ -133,14 +111,6 @@
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
border: 1px solid #CCC;
|
||||
@ -167,37 +137,82 @@
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#bagStockDetailsTableId th:nth-child(1),
|
||||
#bagStockDetailsTableId td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
border-right: 2px solid #ddd;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
#bagStockDetailsTableSummaryId th:nth-child(1),
|
||||
#bagStockDetailsTableSummaryId td:nth-child(1) {
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fht-table thead th {
|
||||
top: 0;
|
||||
z-index: 5!important;
|
||||
td{
|
||||
min-width: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
@ -395,7 +410,7 @@
|
||||
contenteditable="true"
|
||||
<?php endif; ?>
|
||||
|
||||
><?= $bagStock['opening']?>
|
||||
><?= $bagStock['opening'] ?? " " ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
@ -403,7 +418,7 @@
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true"
|
||||
>
|
||||
<?= $bagStock['receipt']?>
|
||||
<?= $bagStock['receipt'] ?? " " ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
@ -412,12 +427,12 @@
|
||||
contenteditable="true"
|
||||
|
||||
>
|
||||
<?= $bagStock['used']?>
|
||||
<?= $bagStock['used'] ?? " " ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?=$bagStock['date']?> <?=$bagStock['materialCode']?>">
|
||||
<?= $bagStock['balanceStock']?>
|
||||
<?= $bagStock['balanceStock'] ?? " " ?>
|
||||
</td>
|
||||
|
||||
<?php
|
||||
@ -439,10 +454,10 @@
|
||||
|
||||
// Sum values for the material
|
||||
|
||||
$summary[$materialCode]['opening'] = "-" ;
|
||||
$summary[$materialCode]['receipt'] += $bagStock['receipt'] == '-' ? 0 : $bagStock['receipt'] ;
|
||||
$summary[$materialCode]['used'] += $bagStock['used'] == '-' ? 0 : $bagStock['used'] ;
|
||||
$summary[$materialCode]['balanceStock'] = $bagStock['balanceStock'] == '-' ? 0 : $bagStock['balanceStock'] ;
|
||||
$summary[$materialCode]['opening'] = "-" ;
|
||||
$summary[$materialCode]['receipt'] += is_numeric( $bagStock['receipt']) ? $bagStock['receipt'] : 0 ;
|
||||
$summary[$materialCode]['used'] += is_numeric( $bagStock['used']) ? $bagStock['used'] : 0 ;
|
||||
$summary[$materialCode]['balanceStock'] = is_numeric( $bagStock['balanceStock']) ? $bagStock['balanceStock'] : 0 ;
|
||||
|
||||
|
||||
} ?>
|
||||
@ -461,7 +476,7 @@
|
||||
<th class="celda_encabezado_total">Receipt</th>
|
||||
<th class="celda_encabezado_total">Used</th>
|
||||
<th class="celda_encabezado_total">Balance Stock</th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@ -540,20 +555,20 @@
|
||||
contenteditable="true"
|
||||
|
||||
<?php }?>
|
||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock']??'-' ?></td>
|
||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true"> - </td>
|
||||
contenteditable="true"> <?= " " ?> </td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||
oninput="usedStockChange(this)" contenteditable="true"> - </td>
|
||||
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?=$dateInMonth?> <?=$bagMaterial['MaterialCode']?>"
|
||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock']??'-' ?></td>
|
||||
><?= $previousMonthBagStockDetails[$bagMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -812,7 +827,7 @@
|
||||
|
||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||
|
||||
updateStockValue( date,materialCode,currentBalanceStock )
|
||||
|
||||
@ -839,7 +854,7 @@
|
||||
|
||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = ccurrentBalanceStock == 0 ? " " : currentBalanceStock ;
|
||||
|
||||
updateStockValue( date,materialCode,currentBalanceStock )
|
||||
|
||||
@ -869,7 +884,7 @@
|
||||
|
||||
let currentBalanceStock = ( Number(openingStock) + Number(receiptStock) ) - Number(usedStock);
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock ;
|
||||
|
||||
updateStockValue( date,materialCode,currentBalanceStock )
|
||||
|
||||
@ -901,7 +916,7 @@
|
||||
|
||||
let dataId = `${otherDate} ${materialCode}`;
|
||||
|
||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||
|
||||
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
||||
|
||||
@ -909,10 +924,8 @@
|
||||
|
||||
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||
|
||||
// console.log( 'other date' , new Date(otherDate));
|
||||
// console.log('new balance stock' , currentBalanceStock)
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -100,25 +100,6 @@
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
height: 12px;
|
||||
@ -131,13 +112,7 @@
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
@ -166,54 +141,81 @@
|
||||
}
|
||||
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
td{
|
||||
min-width: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
td{
|
||||
min-width: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -885,6 +885,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
$('#loader').hide();
|
||||
alert(data);
|
||||
window.location.reload();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -98,17 +98,7 @@
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
@ -122,13 +112,7 @@
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
@ -156,18 +140,11 @@
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#dustAndRoughStockDetailsTableId th:nth-child(1),
|
||||
#dustAndRoughStockDetailsTableId td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff;
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
@ -175,9 +152,79 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal {
|
||||
padding-right: 30% ! important;
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
td{
|
||||
min-width: 150px;
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
@ -223,6 +270,18 @@
|
||||
<div class="form-group col-md-2">
|
||||
<button type="submit" class="btn btn-success"> Change Month </button>
|
||||
</div>
|
||||
<div class="col-md-1"></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" id="dustAndRoughStockExport" href="#">Export</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -277,17 +336,17 @@
|
||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||
oninput="finalRoughStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= $dustAndRoughStockDetail['finalRough'] ?></td>
|
||||
><?= $dustAndRoughStockDetail['finalRough'] ?? ' ' ?></td>
|
||||
|
||||
<td class="celda_normal dust"
|
||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||
oninput="dustStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= $dustAndRoughStockDetail['dust'] ?></td>
|
||||
><?= $dustAndRoughStockDetail['dust'] ?? ' ' ?></td>
|
||||
|
||||
<td class="celda_normal total"
|
||||
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
|
||||
><?= $dustAndRoughStockDetail['total'] ?></td>
|
||||
><?= $dustAndRoughStockDetail['total'] ?? ' ' ?></td>
|
||||
</tr>
|
||||
|
||||
<div class="table-responsive" style="width: 700px;">
|
||||
@ -308,7 +367,7 @@
|
||||
|
||||
$summary['finalRough'] += $dustAndRoughStockDetail['finalRough'] == "-" ? 0 : (float) $dustAndRoughStockDetail['finalRough'] ;
|
||||
$summary['dust'] += $dustAndRoughStockDetail['dust'] == "-" ? 0 : (float) $dustAndRoughStockDetail['dust'] ;
|
||||
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 :(float) $dustAndRoughStockDetail['total'] ;
|
||||
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 : (float) $dustAndRoughStockDetail['total'] ;
|
||||
|
||||
} ?>
|
||||
|
||||
@ -377,17 +436,17 @@
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
oninput="finalRoughStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= 0 ?></td>
|
||||
><?= ' ' ?></td>
|
||||
|
||||
<td class="celda_normal dust"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
oninput="dustStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= 0 ?></td>
|
||||
><?= ' ' ?></td>
|
||||
|
||||
<td class="celda_normal total"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
><?= 0 ?></td>
|
||||
><?= ' ' ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -509,8 +568,8 @@
|
||||
|
||||
try {
|
||||
let dataId = tdElement.getAttribute('data-id')
|
||||
let finalRoughStock = tdElement.innerText;
|
||||
let dustStock = document.querySelector(`td.dust[data-id="${dataId}"]`).innerText;
|
||||
let finalRoughStock = validateInput(tdElement.innerText);
|
||||
let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText);
|
||||
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total;
|
||||
|
||||
@ -522,8 +581,8 @@
|
||||
function dustStockChange(tdElement) {
|
||||
try{
|
||||
let dataId = tdElement.getAttribute('data-id')
|
||||
let finalRoughStock = document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText;
|
||||
let dustStock = tdElement.innerText;
|
||||
let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText);
|
||||
let dustStock = validateInput(tdElement.innerText);
|
||||
let total = (Number(finalRoughStock) + Number(dustStock)) ;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
|
||||
|
||||
@ -536,6 +595,58 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
function validateInput(input) {
|
||||
|
||||
|
||||
if (input == '' || input == ' ' || input == '-') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (typeof input === 'string' && input.split('').map(char => char.charCodeAt(0))[0] == 10) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Validate against the regex
|
||||
const isValid = /^-?\d*\.?\d*$/.test(input);
|
||||
if (!isValid) {
|
||||
alert('Invalid input! Please enter a valid number.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
function exportTableToExcel(tableID, filename = '') {
|
||||
let table = document.getElementById(tableID);
|
||||
let ws = XLSX.utils.table_to_sheet(table); // Convert table to worksheet
|
||||
let wb = XLSX.utils.book_new(); // Create a new workbook
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
||||
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
||||
}
|
||||
|
||||
let tableId = 'dustAndRoughStockDetailsTableId';
|
||||
|
||||
document.getElementById('dustAndRoughStockExport').addEventListener('click',function(){
|
||||
|
||||
exportTableToExcel(tableId ,'dustAndRoughStockDetails.xlsx');
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -100,26 +100,6 @@
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
._Separador {
|
||||
background-color: #fff;
|
||||
@ -133,14 +113,6 @@
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
border: 1px solid #CCC;
|
||||
@ -167,36 +139,81 @@
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#resinStockDetailsTableId th:nth-child(1),
|
||||
#resinStockDetailsTableId td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
border-right: 2px solid #ddd;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
#resinStockDetailsTableSummaryId th:nth-child(1),
|
||||
#resinStockDetailsTableSummaryId td:nth-child(1) {
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
|
||||
.table-responsive {
|
||||
overflow-y: auto;
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 5!important;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
td{
|
||||
min-width: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
@ -365,13 +382,14 @@ foreach ($period as $day) {
|
||||
</td>
|
||||
<td style="display:none"
|
||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||
class="materialCode"><?= $resinStock['materialCode'] ?>
|
||||
class="materialCode">
|
||||
<?= $resinStock['materialCode'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
<td style="display:none" class="celda_normal customer"
|
||||
data-materialCode="<?= $resinStock['materialCode'] ?>"
|
||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
||||
<?= $resinStock['customer'] ?>
|
||||
<?= $resinStock['customer'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingStock"
|
||||
@ -380,25 +398,25 @@ foreach ($period as $day) {
|
||||
<?php if ($groupedResinStockDetailsIndex == 0): ?>
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true"
|
||||
<?php endif; ?>><?= $resinStock['opening'] ?>
|
||||
<?php endif; ?>><?= $resinStock['opening'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true">
|
||||
<?= $resinStock['receipt'] ?>
|
||||
<?= $resinStock['receipt'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true"><?= $resinStock['used'] ?>
|
||||
contenteditable="true"><?= $resinStock['used'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?= $resinStock['date'] ?> <?= $resinStock['materialCode'] ?>">
|
||||
<?= $resinStock['balanceStock'] ?>
|
||||
<?= $resinStock['balanceStock'] ?? ' ' ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -421,10 +439,10 @@ foreach ($period as $day) {
|
||||
|
||||
// Sum values for the material
|
||||
;
|
||||
$summary[$materialCode]['opening'] = "-" ;
|
||||
$summary[$materialCode]['receipt'] += $resinStock['receipt'] == '-' ? 0 :$resinStock['receipt'] ;
|
||||
$summary[$materialCode]['used'] += $resinStock['used'] == '-' ? 0 :$resinStock['used'] ;
|
||||
$summary[$materialCode]['balanceStock'] = $resinStock['balanceStock'] == '-' ? 0 :$resinStock['balanceStock'] ;
|
||||
$summary[$materialCode]['opening'] = "-" ;
|
||||
$summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0;
|
||||
$summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
|
||||
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
|
||||
|
||||
} ?>
|
||||
|
||||
@ -522,20 +540,20 @@ foreach ($period as $day) {
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true"
|
||||
|
||||
<?php } ?>><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? '-' ?></td>
|
||||
<?php } ?>><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true">-</td>
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true">-</td>
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? '-' ?></td>
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"><?= $previousMonthResinStockDetails[$resinMaterialIndex]['balanceStock'] ?? ' ' ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@ -816,9 +834,9 @@ foreach ($period as $day) {
|
||||
try {
|
||||
let dataId = tdElement.getAttribute('data-id');
|
||||
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
|
||||
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
|
||||
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
|
||||
let usedStock = tdElement.innerText;
|
||||
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
|
||||
let receiptStock = validateInput(document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText);
|
||||
let usedStock = validateInput(tdElement.innerText);
|
||||
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
||||
|
||||
@ -876,7 +894,7 @@ foreach ($period as $day) {
|
||||
|
||||
let dataId = `${otherDate} ${materialCode}`;
|
||||
|
||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
||||
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||
|
||||
let usedStock = validateInput(document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText);
|
||||
|
||||
@ -884,8 +902,7 @@ foreach ($period as $day) {
|
||||
|
||||
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
|
||||
|
||||
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -98,16 +98,6 @@
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
._Separador {
|
||||
@ -122,13 +112,7 @@
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell {
|
||||
@ -156,18 +140,10 @@
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#trpSandUseStockDetailsTableId th:nth-child(1),
|
||||
#trpSandUseStockDetailsTableId td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 2;
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff;
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #00a65a;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
@ -175,9 +151,77 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal {
|
||||
padding-right: 30% ! important;
|
||||
.celda_encabezado_total {
|
||||
background-color:#ffffff !important;
|
||||
border: 1px solid #ffffff;
|
||||
color: #ffffff !important;
|
||||
font-weight: bold;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 6px;
|
||||
}
|
||||
|
||||
|
||||
/* Make entire thead sticky */
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #00a65a; /* Header background color */
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
z-index :25 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Ensure each <th> in thead stays sticky */
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #00a65a; /* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Sticky First Column */
|
||||
.fht-table th:nth-child(1),
|
||||
.fht-table td:nth-child(1) {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #00a65a;
|
||||
z-index: 15; /* Ensures it stays above other cells */
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Table Wrapper for Scrolling */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 450px; /* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
td{
|
||||
min-width: 150px;
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@ -234,7 +278,7 @@
|
||||
<div class="table-responsive">
|
||||
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table table-striped">
|
||||
|
||||
<thead class="celda_encabezado_general" style="padding: 10px;">
|
||||
<thead class="celda_encabezado_general" >
|
||||
|
||||
<tr>
|
||||
<th class="celda_encabezado_general" colspan="5" >Trp Sand To Use Coating Sand </th>
|
||||
@ -281,26 +325,26 @@
|
||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||
oninput="roughStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= $trpSandUseStockDetail['rough_kgs'] ?></td>
|
||||
><?= $trpSandUseStockDetail['rough_kgs'] ?? " " ?></td>
|
||||
|
||||
<td class="celda_normal fine"
|
||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||
oninput="fineStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= $trpSandUseStockDetail['fine_kgs'] ?></td>
|
||||
><?= $trpSandUseStockDetail['fine_kgs'] ?? " " ?></td>
|
||||
|
||||
<td class="celda_normal total"
|
||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||
><?= $trpSandUseStockDetail['total_kgs'] ?></td>
|
||||
><?= $trpSandUseStockDetail['total_kgs'] ?? " " ?></td>
|
||||
|
||||
<td class="celda_normal customerName"
|
||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||
contenteditable="true"
|
||||
><?= $trpSandUseStockDetail['customer_name'] ?></td>
|
||||
><?= $trpSandUseStockDetail['customer_name'] ?? " " ?></td>
|
||||
|
||||
<td style="display:none"
|
||||
data-id="<?= $trpSandUseStockDetail['date'] ?>"
|
||||
><?= $trpSandUseStockDetail['id'] ?></td>
|
||||
><?= $trpSandUseStockDetail['id'] ?? " " ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
@ -318,17 +362,18 @@
|
||||
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'] ;
|
||||
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'] ;
|
||||
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 :(float) $trpSandUseStockDetail['total_kgs'] ;
|
||||
} ?>
|
||||
|
||||
} ?>
|
||||
|
||||
<div class="table-responsive" style="width: 700px;">
|
||||
|
||||
<table id="trpSandUseStockDetailsTableSummaryId" class="fht-table table-striped">
|
||||
|
||||
<thead >
|
||||
<th class="celda_encabezado_total" style="width: 100px;">Total </th>
|
||||
<th class="celda_encabezado_total" style="width: 150px;">Rough Kgs </th>
|
||||
<th class="celda_encabezado_total" style="width: 120px;">Fine Kgs </th>
|
||||
<th class="celda_encabezado_total" style="width: 130px;">Total Kgs </th>
|
||||
<th class="celda_encabezado_total" >Total </th>
|
||||
<th class="celda_encabezado_total" >Rough Kgs </th>
|
||||
<th class="celda_encabezado_total" >Fine Kgs </th>
|
||||
<th class="celda_encabezado_total" >Total Kgs </th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@ -394,31 +439,31 @@
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
oninput="roughStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= 0 ?></td>
|
||||
><?= " " ?></td>
|
||||
|
||||
<!-- td:eq(2) -->
|
||||
<td class="celda_normal fine"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
oninput="fineStockChange(this)"
|
||||
contenteditable="true"
|
||||
><?= 0 ?></td>
|
||||
><?= " " ?></td>
|
||||
|
||||
<!-- td:eq(3) -->
|
||||
<td class="celda_normal total"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
><?= 0 ?></td>
|
||||
><?= " " ?></td>
|
||||
|
||||
<!-- td:eq(4) -->
|
||||
<td class="celda_normal customer"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
contenteditable="true"
|
||||
><?= " " ?></td>
|
||||
><?= " " ?></td>
|
||||
|
||||
<!-- td:eq(5) -->
|
||||
<td style="display:none"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
contenteditable="true"
|
||||
><?= " " ?></td>
|
||||
><?= " " ?></td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
@ -537,10 +582,10 @@
|
||||
console.log("just an alert from RoughStockChange..!!")
|
||||
console.log(tdElement.innerText)
|
||||
let dataId = tdElement.getAttribute('data-id')
|
||||
let roughStock = tdElement.innerText;
|
||||
let fineStock = document.querySelector(`td.fine[data-id="${dataId}"]`).innerText;
|
||||
let roughStock = validateInput(tdElement.innerText);
|
||||
let fineStock = validateInput(document.querySelector(`td.fine[data-id="${dataId}"]`).innerText);
|
||||
let total = (Number(roughStock) + Number(fineStock)) ;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
|
||||
|
||||
|
||||
} catch(error){
|
||||
@ -554,10 +599,10 @@
|
||||
console.log("just an alert from fineStockChange..!!")
|
||||
console.log(tdElement.innerText)
|
||||
let dataId = tdElement.getAttribute('data-id')
|
||||
let roughStock = document.querySelector(`td.rough[data-id="${dataId}"]`).innerText;
|
||||
let fineStock = tdElement.innerText;
|
||||
let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText);
|
||||
let fineStock = validateInput(tdElement.innerText) ;
|
||||
let total = (Number(roughStock) + Number(fineStock)) ;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
|
||||
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total ;
|
||||
|
||||
} catch(error){
|
||||
|
||||
@ -567,6 +612,33 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function validateInput(input) {
|
||||
|
||||
|
||||
if (input == '' || input == ' ' || input == '-') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (typeof input === 'string' && input.split('').map(char => char.charCodeAt(0))[0] == 10) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Validate against the regex
|
||||
const isValid = /^-?\d*\.?\d*$/.test(input);
|
||||
if (!isValid) {
|
||||
alert('Invalid input! Please enter a valid number.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user