1022 lines
42 KiB
PHP
1022 lines
42 KiB
PHP
|
|
<style type="text/css">
|
|
.num {
|
|
text-align: right;
|
|
}
|
|
|
|
.fht-table,
|
|
.fht-table thead,
|
|
.fht-table tfoot,
|
|
.fht-table tbody,
|
|
.fht-table tr,
|
|
.fht-table th,
|
|
.fht-table td {
|
|
margin: 0;
|
|
}
|
|
|
|
.fht-table td {
|
|
text-align: center;
|
|
}
|
|
|
|
.fht-table td:hover {
|
|
background-color: #00a65a;
|
|
color: #ffffff;
|
|
}
|
|
|
|
.fht-table {
|
|
border: 0 none;
|
|
height: auto;
|
|
width: auto;
|
|
border-collapse: collapse;
|
|
border-spacing: 0;
|
|
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
|
white-space:nowrap;
|
|
}
|
|
|
|
.fht-table th,
|
|
.fht-table td {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.fht-table-wrapper,
|
|
.fht-table-wrapper .fht-thead,
|
|
.fht-table-wrapper .fht-tfoot,
|
|
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
|
.fht-table-wrapper .fht-tbody {
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
|
.fht-table-wrapper .fht-tbody {
|
|
overflow: auto;
|
|
}
|
|
|
|
.fht-table-wrapper .fht-table .fht-cell {
|
|
overflow: hidden;
|
|
height: 1px;
|
|
}
|
|
|
|
.fht-table-wrapper .fht-fixed-column,
|
|
.fht-table-wrapper .fht-fixed-body {
|
|
top: 0;
|
|
left: 0;
|
|
position: absolute;
|
|
}
|
|
|
|
.fht-table-wrapper .fht-fixed-column {
|
|
z-index: 1;
|
|
}
|
|
|
|
.fht-fixed-body .fht-thead table {
|
|
margin-right: 20px;
|
|
border: 0 none;
|
|
}
|
|
|
|
/*For Examples*/
|
|
|
|
.ContenedorTabla {
|
|
height: 500px;
|
|
margin: 0 auto;
|
|
overflow: auto;
|
|
width: auto;
|
|
position: relative;
|
|
}
|
|
|
|
.header,
|
|
.main {
|
|
display: inline-block;
|
|
height: auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.titulosHeader {
|
|
border-bottom: 1px solid #e8bb25;
|
|
height: auto;
|
|
margin-bottom: 10px;
|
|
padding-bottom: 8px;
|
|
padding-top: 8px;
|
|
width: 100%;
|
|
}
|
|
|
|
|
|
.celda_encabezado_general {
|
|
background-color: #00a65a;
|
|
border: 1px solid #ccc;
|
|
color: #ffffff;
|
|
font-weight: bold;
|
|
padding: 2px 4px;
|
|
text-align: center;
|
|
}
|
|
|
|
._Separador {
|
|
background-color: #fff;
|
|
height: 12px;
|
|
border-left: 1px solid #ccc;
|
|
border-right: 1px solid #ccc;
|
|
width: 7px;
|
|
}
|
|
|
|
._Separador div {
|
|
width: 4px;
|
|
}
|
|
|
|
.celda_normal {
|
|
/*background-color: #fff;*/
|
|
/* <!-- ad9271 into ffffff brown-light to green-light --> */
|
|
border: 1px solid #ccc;
|
|
padding: 2px 4px;
|
|
}
|
|
|
|
/*style excel*/
|
|
.excel_cell {
|
|
border: 1px solid #CCC;
|
|
color: #222;
|
|
text-align: center;
|
|
font-size: 13px;
|
|
font-weight: normal;
|
|
padding: 4px;
|
|
white-space: pre-line;
|
|
empty-cells: show;
|
|
}
|
|
|
|
._cell_header {
|
|
background-color: #EEE;
|
|
}
|
|
|
|
._cell_Default {
|
|
background-color: #FFF;
|
|
text-align: left;
|
|
}
|
|
|
|
.excel_cell div {
|
|
width: 30px;
|
|
height: 20px;
|
|
}
|
|
|
|
#coatingMachineDetailTableId th:nth-child(1),
|
|
#coatingMachineDetailTableId td:nth-child(1) {
|
|
position: sticky;
|
|
left: 0;
|
|
background-color: #00a65a;
|
|
z-index: 2;
|
|
border-right: 2px solid #ddd;
|
|
color: #ffffff;
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="content-page">
|
|
<div class="content">
|
|
<!-- Start Content-->
|
|
<div class="container-fluid">
|
|
<!-- start page title -->
|
|
<div>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Stock</a></li>
|
|
<li class="breadcrumb-item active">
|
|
<h4 class="page-title"> <?= trim(explode(":", $pageTitle)[1]) ?> </h4>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<button type="button" class="btn btn-success" data-target="#coatingMachineDetailModal"
|
|
data-toggle="modal">
|
|
Add New Record
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (session()->getFlashdata('error')): ?>
|
|
<div class="alert alert-danger">
|
|
<?= session()->getFlashdata('error'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (session()->getFlashdata('success')): ?>
|
|
<div class="alert alert-success">
|
|
<?= session()->getFlashdata('success'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<form method='post' action="<?= base_url('/coatingMachineDetails');?>">
|
|
<div class="card-body">
|
|
|
|
<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">
|
|
|
|
|
|
|
|
</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;">
|
|
|
|
<thead>
|
|
<tr>
|
|
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Date</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Shift</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Machine On Time</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Machine Off Time</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Machine Running(hr)</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Total Coating</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Total Coating Sand(kg)</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Total Gas Consumption</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Hour Gas</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Hour QTY(kg)
|
|
</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Customer Name</th>
|
|
<th class="celda_encabezado_general" style="padding: 10px;">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
|
|
if (!empty($coatingMachineDetails)) {
|
|
|
|
foreach ($coatingMachineDetails as $record) {
|
|
?>
|
|
<tr data-id="<?php echo $record['id']; ?>"
|
|
<?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;"';}
|
|
?>
|
|
>
|
|
|
|
<?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>
|
|
<td class="celda_normal"><?php echo $record['machineOnTime'] ?></td>
|
|
<td class="celda_normal"><?php echo $record['machineOffTime'] ?></td>
|
|
<td class="celda_normal"><?php echo $record['machineRunningInHrs'] ?? '' ?></td>
|
|
<td class="celda_normal"><?php echo $record['totalCoating'] ?></td>
|
|
<td class="celda_normal"><?php echo $record['totalCoatingSandInKg'] ?></td>
|
|
<td class="celda_normal"><?php echo $record['totalGasConsumption'] ?></td>
|
|
<td class="celda_normal"><?php echo $record['perHourGasConsumption'] ?? '' ?></td>
|
|
<td class="celda_normal"><?php echo $record['perHourCoatingSandQTY'] ?? '' ?></td>
|
|
<td class="celda_normal"><?php echo $record['customerName']; ?></td>
|
|
<td class="celda_normal" style="background-color:white;">
|
|
<a data-toggle="tooltip" class="edit-btn"
|
|
data-target="editCoatingMachineDetailModal" data-toggle="modal"
|
|
style="cursor:pointer;">
|
|
<i class="fa fa-pencil-alt"
|
|
title="Click here to Edit "></i>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<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"
|
|
title="Click here to Delete "></i>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<br>
|
|
<?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>
|
|
</div> <!-- container -->
|
|
</div> <!-- content -->
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="coatingMachineDetailModal" tabindex="-1" role="dialog"
|
|
aria-labelledby="coatingMachineDetailModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-xl" style="width:1060px !important ;" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
|
|
<h5 class="modal-title" id="coatingMachineDetailModalLabel">
|
|
Add New Coating Machine Detail</h5>
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- form -->
|
|
<form method="post" action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?=$month;?>">
|
|
<div class="modal-body">
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="dateId">Date</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="date" class="form-control" id="dateId" name="date" value="" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="shiftId">Shift</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="shiftId" name="shift" value="" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="machineOnTimeHrId">Machine On Time</label>
|
|
<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:30 AM"> 12:30 AM</option>
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour < 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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>
|
|
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour <= 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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:30 AM"> 12:30 AM</option>
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour < 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
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>
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour <= 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
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">
|
|
<div class="form-group col-md-3">
|
|
<label for="customerNameId">Customer Name</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="customerNameId" name="customerName" value=""
|
|
required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="totalCoatingId">Total Coating</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
|
|
required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="totalCoatingSandId">Total Coating Sand (in Kg)</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="totalCoatingSandId" name="totalCoatingSandInKg"
|
|
value="" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="totalGasConsumptionId">Total Gas Consumption</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="totalGasConsumptionId"
|
|
name="totalGasConsumption" value="" required>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="machineRunningInHrsId"> Machine Running In Hrs</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="machineRunningInHrsId"
|
|
name="machineRunningInHrs" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="perHourGasConsumptionId">Per Hour Gas Consumption </label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="perHourGasConsumptionId"
|
|
name="perHourGasConsumption" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="perHourCoatingSandQTY">Per Hour Coating Sand QTY</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="perHourCoatingSandQTYId"
|
|
name="perHourCoatingSandQTY" required>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary">Save </button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- editCoatingMachineDetailModal -->
|
|
<div class="modal fade" id="editCoatingMachineDetailModal" tabindex="-1" role="dialog"
|
|
aria-labelledby="editCoatingMachineDetailModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-xl" style="width:1060px !important ;" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
|
|
<h5 class="modal-title" id="editCoatingMachineDetailModalLabel">
|
|
Edit Coating Machine 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="editCoatingMachineDetailModalFormId"
|
|
action="<?php echo base_url(); ?>updateCoatingMachineDetails?month=<?=$month;?>">
|
|
<div class="modal-body">
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="editDateId">Date</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="date" class="form-control" id="editDateId" name="date" value="" required>
|
|
<input type="hidden" name="editCoatingMachineDetailId" id="editCoatingMachineDetailId">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="editShiftId">Shift</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editShiftId" name="shift" value="" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="editMachineOnTimeHrId">Machine On Time</label>
|
|
<span class="badge mandatory">*</span>
|
|
<select class="form-control" name="machineOnTime" id="editMachineOnTimeHrId" required>
|
|
<option value="">Select Time</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
|
|
for ($hour = 1; $hour < 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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>
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour <= 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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>
|
|
<select class="form-control" name="machineOffTime" id="editMachineOffTimeHrId" required>
|
|
<option value="">Select Time</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
|
|
for ($hour = 1; $hour <= 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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>
|
|
<?php
|
|
// Loop through the hours 1 to 12
|
|
for ($hour = 1; $hour < 12; $hour++) {
|
|
// Display each hour with ":00"
|
|
$formattedHour = str_pad($hour, 2, '0', STR_PAD_LEFT);
|
|
|
|
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">
|
|
<div class="form-group col-md-3">
|
|
<label for="editCustomerNameId">Customer Name</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editCustomerNameId" name="customerName" value=""
|
|
required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="editTotalCoatingId">Total Coating</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editTotalCoatingId" name="totalCoating" value=""
|
|
required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="editTotalCoatingSandId">Total Coating Sand (in Kg)</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editTotalCoatingSandId"
|
|
name="totalCoatingSandInKg" value="" required>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="editTotalGasConsumptionId">Total Gas Consumption</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editTotalGasConsumptionId"
|
|
name="totalGasConsumption" value="" required>
|
|
<input type="hidden" class="form-control" id="existingTotalGasConsumptionId"
|
|
name="existingTotalGasConsumption" value="" >
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="editMachineRunningInHrsId"> Machine Running In Hrs</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editMachineRunningInHrsId"
|
|
name="machineRunningInHrs" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="editPerHourGasConsumptionId">Per Hour Gas Consumption </label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editPerHourGasConsumptionId"
|
|
name="perHourGasConsumption" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-3">
|
|
<label for="editPerHourCoatingSandQTYId">Per Hour Coating Sand QTY</label>
|
|
<span class="badge mandatory">*</span>
|
|
<input type="text" class="form-control" id="editPerHourCoatingSandQTYId"
|
|
name="perHourCoatingSandQTY" required>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
<button type="submit" class="btn btn-primary">Save </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>
|
|
function confirmDelete(event) {
|
|
|
|
let result = confirm(` Do you Confirm to Delete the Coating Machine Detail?`);
|
|
if (result) { return result; } else { event.preventDefault(); }
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
$('#exampleSelect2 ').select2();
|
|
$('#machineOnTimeHrId ').select2();
|
|
$('#machineOffTimeHrId ').select2();
|
|
$('#editMachineOnTimeHrId ').select2();
|
|
$('#editMachineOffTimeHrId ').select2();
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
<!-- appending values in the edit coating machine detail modal from the table -->
|
|
|
|
<script>
|
|
$(document).ready(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]}`;
|
|
var shift = row.find('td:eq(1)').text();
|
|
var machineOnTimeHr = row.find('td:eq(2)').text();
|
|
var machineOffTimeHr = row.find('td:eq(3)').text();
|
|
var machineRunningInHrs = row.find('td:eq(4)').text();
|
|
var totalCoating = row.find('td:eq(5)').text();
|
|
var totalCoatingSandInKg = row.find('td:eq(6)').text();
|
|
var totalGasConsumption = row.find('td:eq(7)').text();
|
|
var perHourGasConsumption = row.find('td:eq(8)').text();
|
|
var perHourCoatingSandQTY = row.find('td:eq(9)').text();
|
|
var customerName = row.find('td:eq(10)').text();
|
|
|
|
|
|
// Fill the modal fields with the values
|
|
|
|
|
|
$('#editCoatingMachineDetailId').val(row.data('id'));
|
|
$('#editCustomerNameId').val(customerName);
|
|
$('#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();
|
|
$('#editTotalCoatingId').val(totalCoating);
|
|
$('#editTotalCoatingSandId').val(totalCoatingSandInKg);
|
|
$('#editTotalGasConsumptionId').val(totalGasConsumption);
|
|
$('#existingTotalGasConsumptionId').val(totalGasConsumption);
|
|
$('#editMachineRunningInHrsId').val(machineRunningInHrs);
|
|
$('#editPerHourGasConsumptionId').val(perHourGasConsumption);
|
|
$('#editPerHourCoatingSandQTYId').val(perHourCoatingSandQTY);
|
|
|
|
// Show the modal
|
|
$('#editCoatingMachineDetailModal').modal('show');
|
|
});
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<!-- calculations for some fields needed in onChange while adding coating machine details -->
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
$('#machineOnTimeHrId , #dateId').change(function () {
|
|
|
|
let machineOnDate = $('#dateId').val();
|
|
|
|
if (machineOnDate == '') {
|
|
alert('Please Select Date before entering Machine On and Off Time ..!!');
|
|
$('#machineOnTimeHrId').val("");
|
|
return false;
|
|
}
|
|
|
|
let machineOnTimeHr = $('#machineOnTimeHrId').val();
|
|
let machineOffTimeHr = $('#machineOffTimeHrId').val();
|
|
|
|
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr );
|
|
|
|
if (!machineRunningInHrs) {
|
|
$('machineOnTimeHrId').val('');
|
|
return
|
|
}
|
|
$('#machineRunningInHrsId').val(machineRunningInHrs);
|
|
$('#totalCoatingSandId').trigger('change');
|
|
$('#totalGasConsumptionId').trigger('change');
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
$('#machineOffTimeHrId , #dateId').change(function () {
|
|
|
|
let machineOnDate = $('#dateId').val();
|
|
|
|
if (machineOnDate == '') {
|
|
alert('Please Select Date before entering Machine On and Off Time ..!!');
|
|
$('#machineOffTimeHrId').val('');
|
|
return false;
|
|
}
|
|
|
|
let machineOffTimeHr = $('#machineOffTimeHrId').val();
|
|
let machineOnTimeHr = $('#machineOnTimeHrId').val();
|
|
|
|
|
|
|
|
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
|
|
|
if (!machineRunningInHrs) {
|
|
|
|
$('#machineOffTimeHrId').val('');
|
|
return
|
|
}
|
|
$('#machineRunningInHrsId').val(machineRunningInHrs);
|
|
$('#totalCoatingSandId').trigger('change');
|
|
$('#totalGasConsumptionId').trigger('change');
|
|
|
|
|
|
|
|
})
|
|
|
|
$('#totalCoatingSandId').change(function () {
|
|
|
|
let totalCoatingSandValue = $(this).val();
|
|
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
|
|
|
|
if (totalCoatingSandValue && machineRunningInHrsValue) {
|
|
let perHourCoatingSandQTYValue = (totalCoatingSandValue / machineRunningInHrsValue).toFixed(2);
|
|
$('#perHourCoatingSandQTYId').val(perHourCoatingSandQTYValue);
|
|
}
|
|
|
|
|
|
})
|
|
|
|
$('#totalGasConsumptionId').change(function () {
|
|
|
|
let totalGasConsumptionValue = $(this).val();
|
|
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
|
|
if (totalGasConsumptionValue && machineRunningInHrsValue) {
|
|
let perHourGasConsumptionValue = (totalGasConsumptionValue / machineRunningInHrsValue).toFixed(2);
|
|
$('#perHourGasConsumptionId').val(perHourGasConsumptionValue);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<!-- calculations for some fields needed in onChange while editing coating machine details -->
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
|
|
|
|
$('#editMachineOnTimeHrId , #editDateId').change(function () {
|
|
|
|
let machineOnDate = $('#editDateId').val();
|
|
|
|
if (machineOnDate == '') {
|
|
alert('Please Select Date before entering Machine On and Off Time ..!!');
|
|
$('#editMachineOnTimeHrId').val('');
|
|
return false;
|
|
}
|
|
|
|
let machineOnTimeHr = $('#editMachineOnTimeHrId').val();
|
|
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
|
|
|
|
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
|
|
|
if (!machineRunningInHrs) {
|
|
$('#editMachineOnTimeHrId').val('');
|
|
return
|
|
}
|
|
$('#editMachineRunningInHrsId').val(machineRunningInHrs);
|
|
$('#editTotalCoatingSandId').trigger('change');
|
|
$('#editTotalGasConsumptionId').trigger('change');
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
$('#editMachineOffTimeHrId , #editDateId').change(function () {
|
|
|
|
let machineOnDate = $('#editDateId').val();
|
|
|
|
if (machineOnDate == '') {
|
|
alert('Please Select Date before entering Machine On and Off Time ..!!');
|
|
$('#editMachineOnTimeHrId').val('');
|
|
return false;
|
|
}
|
|
|
|
|
|
let machineOnTimeHr = $('#editMachineOnTimeHrId').val();
|
|
let machineOffTimeHr = $('#editMachineOffTimeHrId').val();
|
|
|
|
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
|
|
|
|
if (!machineRunningInHrs) {
|
|
|
|
$('#editMachineOffTimeHrId').val('');
|
|
return
|
|
}
|
|
$('#editMachineRunningInHrsId').val(machineRunningInHrs);
|
|
$('#editTotalCoatingSandId').trigger('change');
|
|
$('#editTotalGasConsumptionId').trigger('change');
|
|
|
|
|
|
|
|
})
|
|
|
|
$('#editTotalCoatingSandId').change(function () {
|
|
|
|
let totalCoatingSandValue = $(this).val();
|
|
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
|
|
|
|
if (totalCoatingSandValue && machineRunningInHrsValue) {
|
|
let perHourCoatingSandQTYValue = (totalCoatingSandValue / machineRunningInHrsValue).toFixed(2);
|
|
$('#editPerHourCoatingSandQTYId').val(perHourCoatingSandQTYValue);
|
|
}
|
|
|
|
|
|
})
|
|
|
|
$('#editTotalGasConsumptionId').change(function () {
|
|
|
|
let totalGasConsumptionValue = $(this).val();
|
|
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
|
|
if (totalGasConsumptionValue && machineRunningInHrsValue) {
|
|
let perHourGasConsumptionValue = (totalGasConsumptionValue / machineRunningInHrsValue).toFixed(2);
|
|
$('#editPerHourGasConsumptionId').val(perHourGasConsumptionValue);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
</script>
|
|
|
|
<!-- utility function for input elements of type="time" -->
|
|
|
|
|
|
<script>
|
|
function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr) {
|
|
|
|
let machineOnTime12 = machineOnTimeHr;
|
|
let machineOffTime12 = machineOffTimeHr;
|
|
|
|
let machineOnTime24 = convertTo24Hr(machineOnTime12);
|
|
let machineOffTime24 = convertTo24Hr(machineOffTime12);
|
|
|
|
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);
|
|
}
|
|
|
|
// 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(":");
|
|
|
|
// 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)
|
|
}
|
|
|
|
// 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,
|
|
orientation: 'bottom'
|
|
})
|
|
|
|
</script>
|