stock module-3 vadivel J 25-12-2024
This commit is contained in:
parent
c56fa1d486
commit
042e32839d
@ -1,9 +1,22 @@
|
||||
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
.batch-card-table th,
|
||||
.batch-card-table td {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.batch-card-table-cell-space {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.fht-table,
|
||||
.fht-table thead,
|
||||
.fht-table tfoot,
|
||||
@ -30,7 +43,7 @@
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||||
white-space:nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fht-table th,
|
||||
@ -164,7 +177,6 @@
|
||||
border-right: 2px solid #ddd;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="content-page">
|
||||
@ -186,10 +198,17 @@
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-success" data-target="#coatingMachineDetailModal"
|
||||
data-toggle="modal">
|
||||
Add New Record
|
||||
</button>
|
||||
<div>
|
||||
<button type="button" class="btn btn-danger" data-target="#productionBatchCardDetailModalId"
|
||||
data-toggle="modal">
|
||||
Add Production Batch Card
|
||||
</button>
|
||||
<button type="button" class="btn btn-success" data-target="#coatingMachineDetailModal"
|
||||
data-toggle="modal">
|
||||
Add Shift Record
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -209,27 +228,27 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<form method='post' action="<?= base_url('/coatingMachineDetails');?>">
|
||||
<form method='post' action="<?= base_url('/coatingMachineDetails'); ?>">
|
||||
<div class="card-body">
|
||||
|
||||
<div class=form-row>
|
||||
<div class="form-group col-md-2 mt-2 ">
|
||||
<div class=form-row>
|
||||
<div class="form-group col-md-2 mt-2 ">
|
||||
|
||||
<input type="text"
|
||||
value="<?= $month; ?>" name="month"
|
||||
class="form-control monthpicker" id="monthpicker">
|
||||
|
||||
<input type="text"
|
||||
value="<?= $month; ?>" name="month"
|
||||
class="form-control monthpicker" id="monthpicker">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<button type="submit" class="btn btn-success"> Change Month </button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<button type="submit" class="btn btn-success"> Change Month </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="coatingMachineDetailTableId" class="fht-table table-hover table-bordered"
|
||||
style="background-color:#fff;">
|
||||
@ -258,18 +277,19 @@
|
||||
if (!empty($coatingMachineDetails)) {
|
||||
|
||||
foreach ($coatingMachineDetails as $record) {
|
||||
?>
|
||||
?>
|
||||
<tr data-id="<?php echo $record['id']; ?>"
|
||||
<?php
|
||||
<?php
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat=DateTime::createFromFormat('Y-m-d', $record['date'])->format('d-m-Y');
|
||||
if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"';}
|
||||
?>
|
||||
>
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $record['date'])->format('d-m-Y');
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
|
||||
<?php
|
||||
$date = DateTime::createFromFormat('Y-m-d', $record['date'])->format('d-m-Y');
|
||||
?>
|
||||
<?php
|
||||
$date = DateTime::createFromFormat('Y-m-d', $record['date'])->format('d-m-Y');
|
||||
?>
|
||||
|
||||
<td class="celda_normal"><?php echo $date ?></td>
|
||||
<td class="celda_normal"><?php echo $record['shift'] ?></td>
|
||||
@ -286,16 +306,16 @@
|
||||
<a data-toggle="tooltip" class="edit-btn"
|
||||
data-target="editCoatingMachineDetailModal" data-toggle="modal"
|
||||
style="cursor:pointer;">
|
||||
<i class="fa fa-pencil-alt"
|
||||
<i class="fa fa-pencil-alt"
|
||||
title="Click here to Edit "></i>
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<a data-toggle="tooltip" onclick="confirmDelete(event)" style="cursor:pointer ;"
|
||||
<a data-toggle="tooltip" onclick="confirmDelete(event)" style="cursor:pointer ;"
|
||||
href="<?php echo base_url(); ?>deleteCoatingMachineDetails?id=<?php echo $record['id'] ?>">
|
||||
<i class="fa fa-trash"
|
||||
<i class="fa fa-trash"
|
||||
title="Click here to Delete "></i>
|
||||
|
||||
</a>
|
||||
@ -305,7 +325,7 @@
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -316,20 +336,20 @@
|
||||
|
||||
|
||||
<br>
|
||||
<?php if(empty($coatingMachineDetails)){ ?>
|
||||
<h5 align="center" style="color:grey;">
|
||||
No Coating Machine Details present in this month
|
||||
</h5>
|
||||
<?php }?>
|
||||
<?php if (empty($coatingMachineDetails)) { ?>
|
||||
<h5 align="center" style="color:grey;">
|
||||
No Coating Machine Details present in this month
|
||||
</h5>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
</div> <!-- container -->
|
||||
</div> <!-- content -->
|
||||
</div>
|
||||
</div> <!-- container -->
|
||||
</div> <!-- content -->
|
||||
</div>
|
||||
|
||||
|
||||
@ -350,7 +370,7 @@
|
||||
</div>
|
||||
|
||||
<!-- form -->
|
||||
<form method="post" action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?=$month;?>">
|
||||
<form method="post" action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?= $month; ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-row">
|
||||
@ -369,7 +389,7 @@
|
||||
<span class="badge mandatory">*</span>
|
||||
<select class="form-control" name="machineOnTime" id="machineOnTimeHrId" required>
|
||||
<option value="">Select Time</option>
|
||||
<option value="12:00 AM" >12:00 AM</option>
|
||||
<option value="12:00 AM">12:00 AM</option>
|
||||
<option value="12:30 AM"> 12:30 AM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
@ -380,7 +400,6 @@
|
||||
echo '<option value="' . $formattedHour . ':00 AM"> ' . $formattedHour . ':00 AM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 AM">' . $formattedHour . ':30 AM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -396,21 +415,20 @@
|
||||
echo '<option value="' . $formattedHour . ':00 PM"> ' . $formattedHour . ':00 PM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 PM">' . $formattedHour . ':30 PM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="machineOffTimeHrId">Machine Off Time</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
<select class="form-control" name="machineOffTime" id="machineOffTimeHrId" required>
|
||||
<option value="">Select Time</option>
|
||||
<option value="12:00 AM" > 12:00 AM</option>
|
||||
<option value="12:00 AM"> 12:00 AM</option>
|
||||
<option value="12:30 AM"> 12:30 AM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
@ -420,11 +438,10 @@
|
||||
echo '<option value="' . $formattedHour . ':00 AM"> ' . $formattedHour . ':00 AM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 AM">' . $formattedHour . ':30 AM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<option value="12:00 PM" > 12:00 PM</option>
|
||||
<option value="12:00 PM"> 12:00 PM</option>
|
||||
<option value="12:30 PM"> 12:30 PM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
@ -434,7 +451,6 @@
|
||||
echo '<option value="' . $formattedHour . ':00 PM"> ' . $formattedHour . ':00 PM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 PM">' . $formattedHour . ':30 PM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@ -530,7 +546,7 @@
|
||||
|
||||
<!-- form -->
|
||||
<form method="post" id="editCoatingMachineDetailModalFormId"
|
||||
action="<?php echo base_url(); ?>updateCoatingMachineDetails?month=<?=$month;?>">
|
||||
action="<?php echo base_url(); ?>updateCoatingMachineDetails?month=<?= $month; ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-row">
|
||||
@ -561,7 +577,6 @@
|
||||
echo '<option value="' . $formattedHour . ':00 AM"> ' . $formattedHour . ':00 AM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 AM">' . $formattedHour . ':30 AM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -576,13 +591,12 @@
|
||||
echo '<option value="' . $formattedHour . ':00 PM"> ' . $formattedHour . ':00 PM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 PM">' . $formattedHour . ':30 PM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="editMachineOffTimeHrId">Machine Off Time</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
@ -599,11 +613,10 @@
|
||||
echo '<option value="' . $formattedHour . ':00 AM"> ' . $formattedHour . ':00 AM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 AM">' . $formattedHour . ':30 AM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
<option value="12:00 PM">12:00 PM</option>
|
||||
<option value="12:30 PM">12:30 PM</option>
|
||||
<option value="12:00 PM">12:00 PM</option>
|
||||
<option value="12:30 PM">12:30 PM</option>
|
||||
<?php
|
||||
// Loop through the hours 1 to 12
|
||||
for ($hour = 1; $hour < 12; $hour++) {
|
||||
@ -613,13 +626,12 @@
|
||||
echo '<option value="' . $formattedHour . ':00 PM"> ' . $formattedHour . ':00 PM</option>';
|
||||
|
||||
echo '<option value="' . $formattedHour . ':30 PM">' . $formattedHour . ':30 PM</option>';
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@ -647,7 +659,7 @@
|
||||
<input type="text" class="form-control" id="editTotalGasConsumptionId"
|
||||
name="totalGasConsumption" value="" required>
|
||||
<input type="hidden" class="form-control" id="existingTotalGasConsumptionId"
|
||||
name="existingTotalGasConsumption" value="" >
|
||||
name="existingTotalGasConsumption" value="">
|
||||
</div>
|
||||
|
||||
|
||||
@ -691,9 +703,167 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- productionBatchCardModal -->
|
||||
|
||||
<div class="modal fade" id="productionBatchCardDetailModalId" tabindex="-1" role="dialog"
|
||||
aria-labelledby="productionBatchCardDetailModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" style="width:1060px !important ;" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
||||
<h5 class="modal-title" id="productionBatchCardDetailModalLabel">
|
||||
Production Batch Card Detail
|
||||
</h5>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- form -->
|
||||
<form method="post" id="productionBatchCardDetailModalFormId"
|
||||
action="<?php echo base_url(); ?>updateBatchCardDetail?month=<?= $month; ?>">
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="table-responsive">
|
||||
|
||||
|
||||
<table class="batch-card-table">
|
||||
<thead>
|
||||
<!-- Table Header Rows -->
|
||||
<tr>
|
||||
<th rowspan="5" colspan="1">logo</th>
|
||||
<th rowspan="5" colspan="7">resico name</th>
|
||||
<tr>
|
||||
<td colspan="1">one </td>
|
||||
<td colspan="1">one </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">one </td>
|
||||
<td colspan="1">one </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">one </td>
|
||||
<td colspan="1">one </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">one </td>
|
||||
<td colspan="1">one </td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="batch-card-table-cell-space" colspan="10">Production Batch Card</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="batch-card-table-cell-space" >Customer Name</th>
|
||||
<td class="batch-card-table-cell-space"colspan="4">DR Axion India Pvt.Ltd (PCS ROUGH) </td>
|
||||
<th class="batch-card-table-cell-space" >P.Batch No</th>
|
||||
<td class="batch-card-table-cell-space" colspan="4">MI | 12 | 19 | C</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="batch-card-table-cell-space">Date</th>
|
||||
<td class="batch-card-table-cell-space" colspan="2">19/12/2024</td>
|
||||
<th class="batch-card-table-cell-space">Shift</th>
|
||||
<td class="batch-card-table-cell-space">III</td>
|
||||
|
||||
<th class="batch-card-table-cell-space">Batch No</th>
|
||||
<td class="batch-card-table-cell-space" colspan="4">123</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="batch-card-table-cell-space">Operator</th>
|
||||
<td class="batch-card-table-cell-space" colspan="4">KUMARAN</td>
|
||||
<th class="batch-card-table-cell-space">Helpers</th>
|
||||
<td class="batch-card-table-cell-space" colspan="4">MURUGESAN</td>
|
||||
</tr>
|
||||
|
||||
<!-- Sub Header -->
|
||||
<tr>
|
||||
<th class="batch-card-table-cell-space">S.No</th>
|
||||
<th class="batch-card-table-cell-space">Sand</th>
|
||||
<th class="batch-card-table-cell-space">Resin Solid</th>
|
||||
<th class="batch-card-table-cell-space">Hexamine</th>
|
||||
<th class="batch-card-table-cell-space">Water</th>
|
||||
<th class="batch-card-table-cell-space">Catalyst Calcium Stearat</th>
|
||||
<th class="batch-card-table-cell-space">Resin Mixing Time</th>
|
||||
<th class="batch-card-table-cell-space">Hexamine Mixing Time</th>
|
||||
<th class="batch-card-table-cell-space">Catalyst Mixing Time</th>
|
||||
<th class="batch-card-table-cell-space">TS</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SPEC</th>
|
||||
<th>200KG-300KG</th>
|
||||
<th>3KG-6KG</th>
|
||||
<th>450G-900G</th>
|
||||
<th>900G-1800G</th>
|
||||
<th>150G-300G</th>
|
||||
<th>60-120 SEC</th>
|
||||
<th>60-120 SEC</th>
|
||||
<th>180-300 SEC</th>
|
||||
<th>50-60 KG/CM<sup>2</sup></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Data Rows -->
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>300</td>
|
||||
<td>5.000</td>
|
||||
<td>7.30</td>
|
||||
<td>1500</td>
|
||||
<td>230</td>
|
||||
<td>60</td>
|
||||
<td>60</td>
|
||||
<td>180</td>
|
||||
<td>54.2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>300</td>
|
||||
<td>5.000</td>
|
||||
<td>7.30</td>
|
||||
<td>1500</td>
|
||||
<td>230</td>
|
||||
<td>60</td>
|
||||
<td>60</td>
|
||||
<td>180</td>
|
||||
<td>52.4</td>
|
||||
</tr>
|
||||
<!-- Add more rows dynamically as needed -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8">
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -702,20 +872,22 @@
|
||||
function confirmDelete(event) {
|
||||
|
||||
let result = confirm(` Do you Confirm to Delete the Coating Machine Detail?`);
|
||||
if (result) { return result; } else { event.preventDefault(); }
|
||||
if (result) {
|
||||
return result;
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
$('#exampleSelect2 ').select2();
|
||||
$('#machineOnTimeHrId ').select2();
|
||||
$('#machineOffTimeHrId ').select2();
|
||||
$('#editMachineOnTimeHrId ').select2();
|
||||
$('#editMachineOffTimeHrId ').select2();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -723,16 +895,16 @@
|
||||
<!-- appending values in the edit coating machine detail modal from the table -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#coatingMachineDetailTableId tbody').on('click', '.edit-btn', function () {
|
||||
$('#coatingMachineDetailTableId tbody').on('click', '.edit-btn', function() {
|
||||
|
||||
var row = $(this).closest('tr');
|
||||
|
||||
// Get values from the row
|
||||
|
||||
|
||||
var date = row.find('td:eq(0)').text().split('-');
|
||||
date=`${date[2]}-${date[1]}-${date[0]}`;
|
||||
date = `${date[2]}-${date[1]}-${date[0]}`;
|
||||
var shift = row.find('td:eq(1)').text();
|
||||
var machineOnTimeHr = row.find('td:eq(2)').text();
|
||||
var machineOffTimeHr = row.find('td:eq(3)').text();
|
||||
@ -750,7 +922,7 @@
|
||||
|
||||
$('#editCoatingMachineDetailId').val(row.data('id'));
|
||||
$('#editCustomerNameId').val(customerName);
|
||||
$('#editDateId').val(date);//convert this from d-m-y to Y-m-d in javascript
|
||||
$('#editDateId').val(date); //convert this from d-m-y to Y-m-d in javascript
|
||||
$('#editShiftId').val(shift);
|
||||
$('#editMachineOnTimeHrId').val(machineOnTimeHr).change();
|
||||
$('#editMachineOffTimeHrId').val(machineOffTimeHr).change();
|
||||
@ -768,17 +940,15 @@
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- calculations for some fields needed in onChange while adding coating machine details -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$('#machineOnTimeHrId , #dateId').change(function () {
|
||||
$('#machineOnTimeHrId , #dateId').change(function() {
|
||||
|
||||
let machineOnDate = $('#dateId').val();
|
||||
|
||||
@ -791,7 +961,7 @@
|
||||
let machineOnTimeHr = $('#machineOnTimeHrId').val();
|
||||
let machineOffTimeHr = $('#machineOffTimeHrId').val();
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr );
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
$('machineOnTimeHrId').val('');
|
||||
@ -806,7 +976,7 @@
|
||||
|
||||
});
|
||||
|
||||
$('#machineOffTimeHrId , #dateId').change(function () {
|
||||
$('#machineOffTimeHrId , #dateId').change(function() {
|
||||
|
||||
let machineOnDate = $('#dateId').val();
|
||||
|
||||
@ -821,7 +991,7 @@
|
||||
|
||||
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
|
||||
@ -836,7 +1006,7 @@
|
||||
|
||||
})
|
||||
|
||||
$('#totalCoatingSandId').change(function () {
|
||||
$('#totalCoatingSandId').change(function() {
|
||||
|
||||
let totalCoatingSandValue = $(this).val();
|
||||
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
|
||||
@ -849,7 +1019,7 @@
|
||||
|
||||
})
|
||||
|
||||
$('#totalGasConsumptionId').change(function () {
|
||||
$('#totalGasConsumptionId').change(function() {
|
||||
|
||||
let totalGasConsumptionValue = $(this).val();
|
||||
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
|
||||
@ -862,16 +1032,15 @@
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<!-- calculations for some fields needed in onChange while editing coating machine details -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$('#editMachineOnTimeHrId , #editDateId').change(function () {
|
||||
$('#editMachineOnTimeHrId , #editDateId').change(function() {
|
||||
|
||||
let machineOnDate = $('#editDateId').val();
|
||||
|
||||
@ -884,7 +1053,7 @@
|
||||
let machineOnTimeHr = $('#editMachineOnTimeHrId').val();
|
||||
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
$('#editMachineOnTimeHrId').val('');
|
||||
@ -899,7 +1068,7 @@
|
||||
|
||||
});
|
||||
|
||||
$('#editMachineOffTimeHrId , #editDateId').change(function () {
|
||||
$('#editMachineOffTimeHrId , #editDateId').change(function() {
|
||||
|
||||
let machineOnDate = $('#editDateId').val();
|
||||
|
||||
@ -913,7 +1082,7 @@
|
||||
let machineOnTimeHr = $('#editMachineOnTimeHrId').val();
|
||||
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
|
||||
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
||||
|
||||
if (!machineRunningInHrs) {
|
||||
|
||||
@ -928,7 +1097,7 @@
|
||||
|
||||
})
|
||||
|
||||
$('#editTotalCoatingSandId').change(function () {
|
||||
$('#editTotalCoatingSandId').change(function() {
|
||||
|
||||
let totalCoatingSandValue = $(this).val();
|
||||
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
|
||||
@ -941,7 +1110,7 @@
|
||||
|
||||
})
|
||||
|
||||
$('#editTotalGasConsumptionId').change(function () {
|
||||
$('#editTotalGasConsumptionId').change(function() {
|
||||
|
||||
let totalGasConsumptionValue = $(this).val();
|
||||
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
|
||||
@ -960,63 +1129,59 @@
|
||||
|
||||
|
||||
<script>
|
||||
function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr) {
|
||||
function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr) {
|
||||
|
||||
let machineOnTime12 = machineOnTimeHr;
|
||||
let machineOffTime12 = machineOffTimeHr;
|
||||
let machineOnTime12 = machineOnTimeHr;
|
||||
let machineOffTime12 = machineOffTimeHr;
|
||||
|
||||
let machineOnTime24 = convertTo24Hr(machineOnTime12);
|
||||
let machineOffTime24 = convertTo24Hr(machineOffTime12);
|
||||
let machineOnTime24 = convertTo24Hr(machineOnTime12);
|
||||
let machineOffTime24 = convertTo24Hr(machineOffTime12);
|
||||
|
||||
const startDate = new Date(`${machineOnDate}T${machineOnTime24}`);
|
||||
const endDate = new Date(`${machineOnDate}T${machineOffTime24}`);
|
||||
const startDate = new Date(`${machineOnDate}T${machineOnTime24}`);
|
||||
const endDate = new Date(`${machineOnDate}T${machineOffTime24}`);
|
||||
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
// Handle the case where end time is on the next day
|
||||
if (endDate < startDate) {
|
||||
endDate.setDate(endDate.getDate() + 1);
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
return `${hours}.${minutes >= 30 ? 5 : 0}`; // Return in HH.MM format
|
||||
}
|
||||
|
||||
// Calculate the difference in milliseconds
|
||||
const diffInMs = endDate - startDate;
|
||||
|
||||
// Convert milliseconds to hours and minutes
|
||||
const hours = Math.floor(diffInMs / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
return `${hours}.${minutes >= 30 ? 5 : 0}`; // Return in HH.MM format
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function convertTo24Hr(time) {
|
||||
const [timePart, modifier] = time.split(" ");
|
||||
let [hours, minutes] = timePart.split(":");
|
||||
|
||||
function convertTo24Hr(time) {
|
||||
const [timePart, modifier] = time.split(" ");
|
||||
let [hours, minutes] = timePart.split(":");
|
||||
// Convert hours to a number
|
||||
hours = parseInt(hours, 10);
|
||||
|
||||
// Convert hours to a number
|
||||
hours = parseInt(hours, 10);
|
||||
// Adjust hours based on AM/PM
|
||||
if (modifier == "PM" && hours < 12) {
|
||||
hours += 12; // Convert PM times to 24-hour format (e.g., 1 PM becomes 13:00)
|
||||
} else if (modifier == "AM" && hours == 12) {
|
||||
hours = 0; // Convert 12 AM to 00:00 (midnight)
|
||||
}
|
||||
|
||||
// Adjust hours based on AM/PM
|
||||
if (modifier == "PM" && hours < 12) {
|
||||
hours += 12; // Convert PM times to 24-hour format (e.g., 1 PM becomes 13:00)
|
||||
} else if (modifier == "AM" && hours == 12) {
|
||||
hours = 0; // Convert 12 AM to 00:00 (midnight)
|
||||
// Format hours and minutes to ensure two digits
|
||||
return `${String(hours).padStart(2, '0')}:${minutes}:00`;
|
||||
}
|
||||
|
||||
// Format hours and minutes to ensure two digits
|
||||
return `${String(hours).padStart(2, '0')}:${minutes}:00`;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('#monthpicker').datepicker({
|
||||
format: 'M-yyyy',
|
||||
viewMode: 'months',
|
||||
minViewMode: 'months',
|
||||
autoclose: true,
|
||||
format: 'M-yyyy',
|
||||
viewMode: 'months',
|
||||
minViewMode: 'months',
|
||||
autoclose: true,
|
||||
orientation: 'bottom'
|
||||
})
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user