stock module-3 vadivel J 21-12-2024

This commit is contained in:
vadivelJ96 2024-12-21 17:46:11 +05:30
parent 7d4de6792f
commit 28cf1f49e6
2 changed files with 81 additions and 47 deletions

View File

@ -370,7 +370,7 @@
<!-- calculateRow() for every td change below --> <!-- calculateRow() for every td change below -->
<!-- 'td:eq(9)' --> <!-- 'td:eq(9)' -->
<td class="celda_normal" id="totalSandQty"> <td class="celda_normal" >
<?php echo $record['Qty']??'0'; ?> <?php echo $record['Qty']??'0'; ?>
</td> </td>
@ -456,12 +456,13 @@
<!-- 'td:eq(26)' --> <!-- 'td:eq(26)' -->
<td class="celda_normal" contenteditable="true" <td class="celda_normal" contenteditable="true"
onkeyup="calculateRow(this.parentNode.id);"> onkeyup="calculateRow(this.parentNode.id);"
>
<?php echo $record['moistureSpec']??'0.00'; ?> <?php echo $record['moistureSpec']??'0.00'; ?>
</td> </td>
<!-- 'td:eq(27)' --> <!-- 'td:eq(27)' -->
<td class="celda_normal" contenteditable="true" <td class="celda_normal" contenteditable="true" id="moistureActualId"
onkeyup="calculateRow(this.parentNode.id);"> onkeyup="calculateRow(this.parentNode.id);">
<?php echo $record['moistureActual']??'0.00'; ?> <?php echo $record['moistureActual']??'0.00'; ?>
</td> </td>
@ -683,8 +684,15 @@
<tr> <tr>
<td style="text-align: left !important; width:25%;"><b>Moisture %</b></td> <td style="text-align: left !important; width:25%;"><b>Moisture %</b></td>
<td contenteditable="true" oninput="calculateRow()" <td contenteditable="true" oninput="calculateRow()"
id="dwnldMoistureId">10</td> id="dwnldMoistureActualId">10</td>
</tr> </tr>
<tr>
<td style="text-align: left !important; width:25%;"><b>Moisture Spec %</b></td>
<td contenteditable="true" oninput="calculateRow()"
id="dwnldMoistureSpecId">10</td>
</tr>
<tr>
</tbody> </tbody>
</table> </table>
@ -811,7 +819,7 @@
<tr>&nbsp; <tr>&nbsp;
<td style="text-align: right;" colspan="3"><strong>&nbsp;TOTAL </strong></td> <td style="text-align: right;" colspan="3"><strong>&nbsp;TOTAL </strong></td>
<td class="text-right" id="dwnldWeighOfSand"></td> <td class="text-right" id="dwnldWeighOfSand"></td>
<td class="text-right" id="dwnldTotalId" colspan="2"><b></b></td> <td class="text-right" id="dwnldFtotalId" colspan="2"><b></b></td>
</tr> </tr>
<tr>&nbsp; <tr>&nbsp;
<td class="text-right" colspan="4"><b>AFS </b></td> <td class="text-right" colspan="4"><b>AFS </b></td>
@ -871,22 +879,22 @@
<input type="hidden" name="igrNo" id="igrNo" value=""> <input type="hidden" name="igrNo" id="igrNo" value="">
<input type="hidden" name="materialCode" id="materialCode" value=""> <input type="hidden" name="materialCode" id="materialCode" value="">
<input type="hidden" name="qty" id="qty" value=""> <input type="hidden" name="qty" id="qty" value="">
<input type="hidden" class="form-control" name="10Mm" id="10Mm" value="0.00"> <input type="hidden" name="10Mm" id="10Mm" value="0.00">
<input type="hidden" class="form-control" name="20Mm" id="20Mm" value="0.00"> <input type="hidden" name="20Mm" id="20Mm" value="0.00">
<input type="hidden" class="form-control" name="30Mm" id="30Mm" value="0.00"> <input type="hidden" name="30Mm" id="30Mm" value="0.00">
<input type="hidden" class="form-control" name="40Mm" id="40Mm" value="0.00"> <input type="hidden" name="40Mm" id="40Mm" value="0.00">
<input type="hidden" class="form-control" name="50Mm" id="50Mm" value="0.00"> <input type="hidden" name="50Mm" id="50Mm" value="0.00">
<input type="hidden" class="form-control" name="70Mm" id="70Mm" value="0.00"> <input type="hidden" name="70Mm" id="70Mm" value="0.00">
<input type="hidden" class="form-control" name="100Mm" id="100Mm" value="0.00"> <input type="hidden" name="100Mm" id="100Mm" value="0.00">
<input type="hidden" class="form-control" name="140Mm" id="140Mm" value="0.00"> <input type="hidden" name="140Mm" id="140Mm" value="0.00">
<input type="hidden" class="form-control" name="200Mm" id="200Mm" value="0.00"> <input type="hidden" name="200Mm" id="200Mm" value="0.00">
<input type="hidden" class="form-control" name="300Mm" id="300Mm" value="0.00"> <input type="hidden" name="300Mm" id="300Mm" value="0.00">
<input type="hidden" class="form-control" name="pan" id="pan" value="0.00" > <input type="hidden" name="pan" id="pan" value="0.00" >
<input type="hidden" class="form-control" name="total" id="total" value="0.00" readonly> <input type="hidden" name="total" id="total" value="0.00" >
<input type="hidden" class="form-control" name="moistureSpec" id="moistureSpec" value="0.00"> <input type="hidden" name="moistureSpec" id="moistureSpec" value="0.00">
<input type="hidden" class="form-control" name="moistureActual" id="moistureActual" value="0.00"> <input type="hidden" name="moistureActual" id="moistureActual" value="0.00">
<input type="hidden" class="form-control" name="moistureLoss" id="moistureLoss" value="0.00" readonly> <input type="hidden" name="moistureLoss" id="moistureLoss" value="0.00" >
<input type="hidden" class="form-control" name="moistureLossQty" id="moistureLossQty" value="0.00" readonly> <input type="hidden" name="moistureLossQty" id="moistureLossQty" value="0.00">
<input type="hidden" name="plus20Loss" id="plus20Loss" value=""> <input type="hidden" name="plus20Loss" id="plus20Loss" value="">
<input type="hidden" name="plus30Loss" id="plus30Loss" value=""> <input type="hidden" name="plus30Loss" id="plus30Loss" value="">
<input type="hidden" name="sieveLossQty" id="sieveLossQty" value=""> <input type="hidden" name="sieveLossQty" id="sieveLossQty" value="">
@ -908,8 +916,6 @@
<script> <script>
document.getElementById('pdfGenerateId').addEventListener('click', function () { document.getElementById('pdfGenerateId').addEventListener('click', function () {
// Get the content // Get the content
const content = document.getElementById("content").innerHTML; const content = document.getElementById("content").innerHTML;
@ -934,7 +940,6 @@
$('#downloadLabReportModel').modal('hide'); $('#downloadLabReportModel').modal('hide');
}); });
</script> </script>
@ -1040,6 +1045,9 @@
let _300Mm = row.find('td:eq(19)').text().trim(); let _300Mm = row.find('td:eq(19)').text().trim();
let pan = row.find('td:eq(20)').text().trim(); let pan = row.find('td:eq(20)').text().trim();
let total = row.find('td:eq(21)').text().trim(); let total = row.find('td:eq(21)').text().trim();
let moistureSpec = row.find('td:eq(26)').text().trim();
let moistureActual = row.find('td:eq(27)').text().trim();
let moistureLoss = row.find('td:eq(28)').text().trim(); let moistureLoss = row.find('td:eq(28)').text().trim();
let remark = row.find('.sand-status').val(); let remark = row.find('.sand-status').val();
@ -1047,7 +1055,6 @@
// Fill the modal fields with the values // Fill the modal fields with the values
$('#dwnldIgrNoId').text(igrNo); $('#dwnldIgrNoId').text(igrNo);
@ -1125,11 +1132,12 @@
$('#dwnldWeighOfSand').text(total); $('#dwnldWeighOfSand').text(total);
$('#dwnldMoistureId').text(moistureLoss); $('#dwnldMoistureActualId').text(moistureActual);
$('#dwnldMoistureSpecId').text(moistureSpec);
$('#dwnldAcceptedId').text(""); $('#dwnldAcceptedId').text("");
$('#dwnldAcceptedUnderDeviationId').text(""); $('#dwnldAcceptedUnderDeviationId').text("");
$('#dwnldRejectedId').text(""); $('#dwnldRejectedId').text("");
$('#dwnldTotalId').text(fTotal); $('#dwnldFtotalId').text(fTotal);
$('#dwnldAfsId').text(dwnldAfsId); $('#dwnldAfsId').text(dwnldAfsId);
if(remark == "accepted"){ if(remark == "accepted"){
@ -1245,7 +1253,6 @@
let row = incomingSilicaSandDetailsData[index]; let row = incomingSilicaSandDetailsData[index];
// Get the selected values from dropdowns
row['Remark'] = $(this).find('.sand-status').val(); row['Remark'] = $(this).find('.sand-status').val();
row['Grade Condition'] = $(this).find('.grade-condition').val() row['Grade Condition'] = $(this).find('.grade-condition').val()
@ -1305,12 +1312,14 @@ function calculateRow(value){
var tr = $(value).closest('tr'); var tr = $(value).closest('tr');
var weighOfSand = tr.find('td:eq(3)').text(); var weighOfSand = tr.find('td:eq(3)').text();
var factor = tr.find('td:eq(4)').text(); var factor = tr.find('td:eq(4)').text();
tr.find('td:eq(5)').text(weighOfSand * factor); tr.find('td:eq(5)').text(parseFloat((weighOfSand * factor).toFixed(2)));
let result = table.tableToJSON(); let result = table.tableToJSON();
let qty = $('#totalSandQty').val(); let qty = parseFloat($('#dwnldQtyId').text());
let moistureSpec = $('#dwnldMoistureSpecId').text();
let moistureActual = $('#dwnldMoistureActualId').text();
let totalWeighOfSand = 0; let totalWeighOfSand = 0;
let totalFactoredValue = 0; let totalFactoredValue = 0;
let afs = 0 ; let afs = 0 ;
@ -1328,7 +1337,7 @@ function calculateRow(value){
newPlus30Loss += Number(result[i]['WEIGH OF SAND']) ; newPlus30Loss += Number(result[i]['WEIGH OF SAND']) ;
newSieveLossQty = Math.floor((parseFloat(qty) * newPlus30Loss) / 100) ; newSieveLossQty = (parseFloat(qty) * newPlus30Loss) / 100 ;
} }
@ -1336,34 +1345,59 @@ function calculateRow(value){
totalFactoredValue += Number(result[i]['TOTAL']) ; totalFactoredValue += Number(result[i]['TOTAL']) ;
afs = (Number(totalFactoredValue) / Number(totalWeighOfSand)).toFixed(2) ; afs = (Number(totalFactoredValue) / Number(totalWeighOfSand)).toFixed(2) ;
$('#dwnldWeighOfSand').text(totalWeighOfSand);
$('#dwnldTotalId').text(totalFactoredValue);
$('#dwnldWeighOfSand').text((totalWeighOfSand.toFixed(2)));
$('#dwnldFtotalId').text((totalFactoredValue).toFixed(2));
$('#dwnldAfsId').text(afs); $('#dwnldAfsId').text(afs);
} }
let newMoistureLoss = parseFloat(moistureActual) - parseFloat(moistureSpec) ; let newMoistureLoss = parseFloat(moistureActual) - parseFloat(moistureSpec) ;
let newMoistureLossQty = Math.round((parseFloat(qty) * newMoistureLoss) / 100 ) ; let newMoistureLossQty = ((parseFloat(qty) * newMoistureLoss) / 100 ).toFixed(2) ;
let newSalableQty = Math.floor(parseFloat(qty) - newMoistureLossQty - newSieveLossQty) ; let newSalableQty = (parseFloat(qty) - newMoistureLossQty - newSieveLossQty).toFixed(2) ;
newSieveLossQty = (newSieveLossQty).toFixed(2);
console.log(totalWeighOfSand); //total console.log(totalWeighOfSand); //total
console.log(totalFactoredValue); console.log(totalFactoredValue);
console.log(afs); console.log(afs);
console.log(newMoistureLoss);
console.log("qty");
console.log(qty);
console.log(newMoistureLossQty);
console.log(newSieveLossQty);
console.log(newSalableQty);
$('#10Mm').val(result[0]['WEIGH OF SAND']);
$('#20Mm').val(result[1]['WEIGH OF SAND']);
$('#30Mm').val(result[2]['WEIGH OF SAND']);
$('#40Mm').val(result[3]['WEIGH OF SAND']);
$('#50Mm').val(result[4]['WEIGH OF SAND']);
$('#70Mm').val(result[5]['WEIGH OF SAND']);
$('#100Mm').val(result[6]['WEIGH OF SAND']);
$('#140Mm').val(result[7]['WEIGH OF SAND']);
$('#200Mm').val(result[8]['WEIGH OF SAND']);
$('#300Mm').val(result[9]['WEIGH OF SAND']);
$('#pan') .val(result[10]['WEIGH OF SAND']);
$('#total').val(totalWeighOfSand);
$('#plus20Loss').val(newPlus20Loss);
$('#plus30Loss').val(newPlus30Loss);
$('#moistureSpec').val(moistureSpec);
$('#moistureActual').val(moistureActual);
$('#moistureLoss').val(newMoistureLoss);
$('#moistureLossQty').val(newMoistureLossQty);
$('#sieveLossQty').val(newSieveLossQty);
$('#salableQty').val(newSalableQty);
return; return;
} }