1725 lines
71 KiB
PHP
1725 lines
71 KiB
PHP
<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;
|
||
}
|
||
|
||
|
||
input[type="date"]::-webkit-calendar-picker-indicator {
|
||
transform: scale(2.0);
|
||
cursor: pointer;
|
||
}
|
||
|
||
input[type="date"] {
|
||
cursor: pointer;
|
||
}
|
||
|
||
|
||
|
||
|
||
.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: #50bbd9;
|
||
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:rgb(80, 187, 217); /* blue background */
|
||
border: 1px solid #ccc;
|
||
color: #ffffff;
|
||
font-weight: bold;
|
||
padding: 2px 4px;
|
||
text-align: center;
|
||
min-width: 120px;
|
||
max-width: 120px;
|
||
white-space: normal; /* Allows text to wrap */
|
||
word-wrap: break-word; /* Breaks long words if needed */
|
||
text-align: center; /* Centers text for better alignment */
|
||
max-width: 150px; /* Set a max width to control wrapping */
|
||
}
|
||
|
||
.celda_encabezado_total {
|
||
background-color:#ffffff;
|
||
border: 1px solid white;
|
||
color: #ffffff;
|
||
font-weight: bold;
|
||
padding: 6px 10px;
|
||
text-align: center;
|
||
min-width: 120px;
|
||
max-width: 120px;
|
||
}
|
||
|
||
._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: 10px 4px;
|
||
min-width: 120px;
|
||
max-width: 120px;
|
||
}
|
||
|
||
/*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;
|
||
}
|
||
|
||
|
||
|
||
.fht-table th:nth-child(1),
|
||
.fht-table th:nth-child(1)
|
||
{
|
||
position: sticky;
|
||
left: 0;
|
||
top: 0;
|
||
background-color:rgb(80, 187, 217); /* blue background */
|
||
z-index: 7!important;
|
||
border-right: 2px solid #ddd;
|
||
color: #ffffff;
|
||
}
|
||
|
||
|
||
.fht-table td:nth-child(1)
|
||
{
|
||
position: sticky;
|
||
left: 0;
|
||
background-color:rgb(80, 187, 217); /* blue background */
|
||
z-index: 2;
|
||
border-right: 2px solid #ddd;
|
||
color: #ffffff;
|
||
|
||
}
|
||
|
||
.table-responsive {
|
||
overflow-y: auto;
|
||
max-height: 500px;
|
||
}
|
||
|
||
.fht-table thead th {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 5!important;
|
||
}
|
||
|
||
</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>
|
||
|
||
<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>
|
||
|
||
<?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-3 mt-2 ">
|
||
|
||
<input type="text"
|
||
value="<?= $month; ?>" name="month"
|
||
class="form-control monthpicker" id="monthpicker">
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<button type="submit" class="btn btn-success"> Change Month </button>
|
||
</div>
|
||
|
||
<div class="col-6">
|
||
<div class="dropdown float-right mt-2">
|
||
<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 style="cursor:pointer"
|
||
class="dropdown-item" data-toggle="modal" data-target="#filterModalId">
|
||
Filter
|
||
</a>
|
||
<a style="cursor:pointer"
|
||
class="dropdown-item" id="coatingMachineDetailsExport" href="#">Export</a>
|
||
</div>
|
||
</div>
|
||
</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;">Customer Name</th>
|
||
<th class="celda_encabezado_general" style="padding: 10px;">Grade</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;">Action</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
|
||
if (!empty($coatingMachineDetails)) {
|
||
|
||
$summary = [] ;
|
||
|
||
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:eq(0) -->
|
||
<td class="celda_normal"><?php echo $date ?></td>
|
||
<!-- td:eq(1) -->
|
||
<td class="celda_normal"><?php echo $record['shift'] ?></td>
|
||
<!-- td:eq(2) -->
|
||
<td class="celda_normal"><?php echo $record['machineOnTime'] ?></td>
|
||
<!-- td:eq(3) -->
|
||
<td class="celda_normal"><?php echo $record['machineOffTime'] ?></td>
|
||
<!-- td:eq(4) -->
|
||
<td class="celda_normal"><?php echo $record['machineRunningInHrs'] ?? ' ' ?></td>
|
||
<!-- td:eq(5) -->
|
||
<td class="celda_normal"><?php echo $record['customerName'] ?? '' ?></td>
|
||
<!-- td:eq(6) -->
|
||
<td class="celda_normal"><?php echo $record['grade'] ?? ' ' ?></td>
|
||
<!-- td:eq(7) -->
|
||
<td class="celda_normal"><?php echo $record['totalCoating'] ?></td>
|
||
<!-- td:eq(8) -->
|
||
<td class="celda_normal"><?php echo $record['totalCoatingSandInKg'] ?></td>
|
||
<!-- td:eq(9) -->
|
||
<td class="celda_normal"><?php echo $record['totalGasConsumption'] ?></td>
|
||
<!-- td:eq(10) -->
|
||
<td class="celda_normal"><?php echo $record['perHourGasConsumption'] ?? '' ?></td>
|
||
<!-- td:eq(11) -->
|
||
<td class="celda_normal"><?php echo $record['perHourCoatingSandQTY'] ?? '' ?></td>
|
||
<!-- td:eq(12) -->
|
||
<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-edit"
|
||
title="Click here to Edit "></i>
|
||
|
||
</a>
|
||
|
||
</td>
|
||
<!-- td:eq(13) -->
|
||
<td style="display:none;"><?php echo $record['batchcard_files'] ?? ' ' ?></td>
|
||
</tr>
|
||
|
||
|
||
<?php
|
||
|
||
//before closing inner loop
|
||
|
||
|
||
|
||
if (!isset($summary['totalCoating'])) {
|
||
$summary['totalMachineRunningHrs'] = 0 ;
|
||
$summary['totalCoating'] = 0 ;
|
||
$summary['totalCoatingSandInKg'] = 0 ;
|
||
$summary['totalGasConsumption'] = 0 ;
|
||
$summary['perHourGasConsumption'] = 0 ;
|
||
$summary['perHourCoatingSandQTY'] = 0 ;
|
||
}
|
||
|
||
|
||
$summary['totalMachineRunningHrs'] += $record['machineRunningInHrs'] == "-" ? 0 : (float) $record['machineRunningInHrs'];
|
||
$summary['totalCoating'] += $record['totalCoating'] == "-" ? 0 : (float) $record['totalCoating'] ;
|
||
$summary['totalCoatingSandInKg'] += $record['totalCoatingSandInKg'] == "-" ? 0 : (float) $record['totalCoatingSandInKg'] ;
|
||
$summary['totalGasConsumption'] += $record['totalGasConsumption'] == "-" ? 0 :(float) $record['totalGasConsumption'] ;
|
||
$summary['perHourGasConsumption'] += $record['perHourGasConsumption'] == "-" ? 0 : (float) $record['perHourGasConsumption'] ;
|
||
$summary['perHourCoatingSandQTY'] += $record['perHourCoatingSandQTY'] == "-" ? 0 :(float) $record['perHourCoatingSandQTY'] ;
|
||
|
||
} ?>
|
||
|
||
<table id="coatingMachineStockDetailsTableSummaryId" class="fht-table table-hover table-bordered">
|
||
|
||
<thead >
|
||
|
||
<th class="celda_encabezado_total"
|
||
style="padding: 10px; background-color:#ffff;"> Date </th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Shift</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Machine On Time</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Machine Off Time</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Machine Running(hr)</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Customer Name </th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Grade</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Total Coating</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Total Coating Sand(kg)</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Total Gas Consumption</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Hour Gas</th>
|
||
<th class="celda_encabezado_total" style="padding: 10px;">Hour QTY(kg)</th>
|
||
</thead>
|
||
|
||
<tbody>
|
||
|
||
<tr>
|
||
|
||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||
<b> Total </b>
|
||
</td>
|
||
|
||
|
||
<td class="celda_normal "> - </td>
|
||
<td class="celda_normal "> - </td>
|
||
<td class="celda_normal "> - </td>
|
||
<td class="celda_normal "> <?=$summary['totalMachineRunningHrs']?></td>
|
||
<td class="celda_normal "> - </td>
|
||
<td class="celda_normal "> - </td>
|
||
<td class="celda_normal "><?=$summary['totalCoating']?></td>
|
||
<td class="celda_normal "><?=$summary['totalCoatingSandInKg']?></td>
|
||
<td class="celda_normal "><?=$summary['totalGasConsumption']?></td>
|
||
<td class="celda_normal "><?=number_format($summary['totalGasConsumption']/$summary['totalMachineRunningHrs'], 2)?> (avg)</td>
|
||
<td class="celda_normal "><?=number_format($summary['totalCoatingSandInKg']/$summary['totalMachineRunningHrs'], 2)?> (avg)</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
</div>
|
||
|
||
|
||
<?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-lg" 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"
|
||
enctype="multipart/form-data"
|
||
action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?= $month; ?>">
|
||
<div class="modal-body">
|
||
|
||
<div class="form-row">
|
||
|
||
<!-- date -->
|
||
<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>
|
||
|
||
<!-- shift -->
|
||
<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>
|
||
|
||
<!-- machine on time -->
|
||
<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>
|
||
|
||
<!-- machine off time -->
|
||
<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">
|
||
|
||
<!-- Total hours -->
|
||
<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" readonly id="machineRunningInHrsId"
|
||
name="machineRunningInHrs" required>
|
||
|
||
</div>
|
||
|
||
<!-- customer name -->
|
||
<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>
|
||
|
||
<!-- grade -->
|
||
<div class="form-group col-md-3">
|
||
<label for="gradeId">grade</label>
|
||
<span class="badge mandatory">*</span>
|
||
<input type="text" class="form-control" id="gradeId" name="grade" value=""
|
||
required>
|
||
</div>
|
||
|
||
<!-- total coating as renamed to total production -->
|
||
<div class="form-group col-md-3">
|
||
<label for="totalCoatingId">Total Production</label>
|
||
<span class="badge mandatory">*</span>
|
||
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
|
||
required>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
|
||
<!-- total coating sand in kg -->
|
||
<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>
|
||
|
||
<!-- total gas consumption -->
|
||
<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>
|
||
|
||
<!-- per hour Coating sand qty -->
|
||
<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" readonly id="perHourCoatingSandQTYId"
|
||
name="perHourCoatingSandQTY" required>
|
||
|
||
</div>
|
||
|
||
<!-- per hour gas consumption -->
|
||
<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" readonly id="perHourGasConsumptionId"
|
||
name="perHourGasConsumption" required >
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="form-row" id="batchCardRowId">
|
||
|
||
<!-- batch card file upload -->
|
||
<div class="form-group col-md-3">
|
||
|
||
<label for="">Upload Batch Card</label>
|
||
|
||
<div>
|
||
<input type="file" class="batchfile" name="batchCard[]">
|
||
</div>
|
||
|
||
<button type="button" class="btn btn-success btn-sm mt-2" id="batchCardAddBtnId">Add More</button>
|
||
|
||
</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-lg" 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"
|
||
enctype="multipart/form-data"
|
||
action="<?php echo base_url(); ?>updateCoatingMachineDetails?month=<?= $month; ?>">
|
||
<div class="modal-body">
|
||
|
||
<div class="form-row">
|
||
|
||
<!-- date -->
|
||
<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>
|
||
|
||
<!-- shift -->
|
||
<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>
|
||
|
||
<!-- machine on time -->
|
||
<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>
|
||
|
||
<!-- machine off time -->
|
||
<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">
|
||
|
||
<!-- total hours -->
|
||
<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" readonly id="editMachineRunningInHrsId"
|
||
name="machineRunningInHrs" required>
|
||
|
||
</div>
|
||
|
||
<!-- customer name -->
|
||
<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>
|
||
|
||
<!-- grade -->
|
||
<div class="form-group col-md-3">
|
||
<label for="editGradeId">grade</label>
|
||
<span class="badge mandatory">*</span>
|
||
<input type="text" class="form-control" id="editGradeId" name="grade" value=""
|
||
required>
|
||
</div>
|
||
|
||
|
||
<!-- total coating as renamed to total production -->
|
||
<div class="form-group col-md-3">
|
||
<label for="editTotalCoatingId">Total Production</label>
|
||
<span class="badge mandatory">*</span>
|
||
<input type="text" class="form-control" id="editTotalCoatingId" name="totalCoating" value=""
|
||
required>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="form-row">
|
||
|
||
<!-- total coating sand in kg -->
|
||
<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>
|
||
|
||
<!-- total gas consumption -->
|
||
<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>
|
||
|
||
<!-- per hour Coating sand qty -->
|
||
<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" readonly id="editPerHourCoatingSandQTYId"
|
||
name="perHourCoatingSandQTY" required>
|
||
|
||
</div>
|
||
|
||
<!-- per hour gas consumption -->
|
||
<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" readonly id="editPerHourGasConsumptionId"
|
||
name="perHourGasConsumption" required>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="form-row" id="editBatchCardRowId">
|
||
|
||
<!-- batch card file upload -->
|
||
<div class="form-group col-md-3">
|
||
|
||
<label for="editBatchCardId">Upload Batch Card</label>
|
||
|
||
<div>
|
||
<input type="file" class="editBatchFile " name="batchCard[]">
|
||
</div>
|
||
|
||
<button type="button" class="btn btn-success btn-sm mt-2" id="editBatchCardAddBtnId">Add More</button>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="cancelBtn">Cancel</button>
|
||
<button type="submit" class="btn btn-primary">Save </button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</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>
|
||
|
||
|
||
|
||
|
||
<!-- filter modal -->
|
||
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
|
||
<div class="modal-dialog modal-md">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="filterModalLabelId">Filter Options</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="row">
|
||
|
||
|
||
|
||
<?php
|
||
$currentDateInDmY = date('d-m-Y');
|
||
?>
|
||
|
||
<?php
|
||
$startDate = DateTime::createFromFormat('M-Y', $month);
|
||
|
||
if ($startDate) {
|
||
$startDate->modify('first day of this month');
|
||
$daysInMonth = $startDate->format('t');
|
||
$dateArray = [];
|
||
|
||
for ($i = 0; $i < $daysInMonth; $i++) {
|
||
$dateArray[] = $startDate->format('d-m-Y');
|
||
$startDate->modify('+1 day');
|
||
}
|
||
} else {
|
||
echo "Invalid date format.";
|
||
}
|
||
?>
|
||
|
||
|
||
<!-- From Date Filter -->
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<label for="fromDateFilter">Select From Date</label>
|
||
|
||
<select id="fromDateFilter" name="fromDateFilter" class="form-control">
|
||
<?php if (!empty($dateArray)) : ?>
|
||
<?php foreach ($dateArray as $index => $date) : ?>
|
||
<option value="<?= $date ?>" ><?= $date ?></option>
|
||
<?php endforeach; ?>
|
||
<?php endif; ?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- To Date Filter -->
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<label for="toDateFilter">Select Date</label>
|
||
|
||
<select id="toDateFilter" name="toDateFilter" class="form-control">
|
||
|
||
<?php if (!empty($dateArray)) : ?>
|
||
<?php foreach ($dateArray as $date) : ?>
|
||
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ?"selected" :" " ?> ><?= $date ?></option>
|
||
<?php endforeach; ?>
|
||
<?php endif; ?>
|
||
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<button class="btn btn-primary float-right" onclick="customFilterDate()">Filter</button>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</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();
|
||
$('#fromDateFilter ').select2();
|
||
$('#toDateFilter ').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 customerName = row.find('td:eq(5)').text();
|
||
var grade = row.find('td:eq(6)').text();
|
||
var totalCoating = row.find('td:eq(7)').text();
|
||
var totalCoatingSandInKg = row.find('td:eq(8)').text();
|
||
var totalGasConsumption = row.find('td:eq(9)').text();
|
||
var perHourGasConsumption = row.find('td:eq(10)').text();
|
||
var perHourCoatingSandQTY = row.find('td:eq(11)').text();
|
||
var batchCards = row.find('td:eq(13)').text().trim();
|
||
|
||
console.log(batchCards);
|
||
|
||
JSON.parse(batchCards).map(element => {
|
||
|
||
if(!element.client_given_name){
|
||
console.log("filename null")
|
||
return;
|
||
}
|
||
|
||
let fileCount = $('.editBatchFile').length; // Count existing batch files
|
||
|
||
if (fileCount >= 5) {
|
||
return;
|
||
}
|
||
|
||
|
||
let string = `<div class="form-group col-md-3 batch-container">
|
||
<label for="">Change Batch Card</label>
|
||
<input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" >
|
||
<p>( Previously Uploaded File ${element.client_given_name} )</p>
|
||
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch" data-id="${element.batchCardId}">Remove</button>
|
||
</div>`;
|
||
|
||
$('#editBatchCardRowId').append(string)
|
||
});
|
||
|
||
|
||
// Fill the modal fields with the values
|
||
|
||
//batchfile
|
||
|
||
|
||
$('#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();
|
||
$('#editGradeId').val(grade);
|
||
$('#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>
|
||
|
||
<script>
|
||
|
||
$(document).ready(function(){
|
||
$('#editCoatingMachineDetailModal').on('hidden.bs.modal', function () {
|
||
$('.batch-container').remove(); // This will remove all child elements
|
||
});
|
||
});
|
||
|
||
</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;
|
||
|
||
if(machineOnTime12 == machineOffTime12){
|
||
return `24.00`;
|
||
}
|
||
|
||
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>
|
||
|
||
<script>
|
||
function customFilterDate(){
|
||
|
||
let fromDate = $('#fromDateFilter').val(); //01-12-2024
|
||
let toDate = $('#toDateFilter').val(); //05-12-2024
|
||
|
||
$('#coatingMachineDetailTableId').find('tbody tr').each(function() {
|
||
const rowCells = $(this).find('td');
|
||
let tableDate = rowCells.eq(0).text();
|
||
let result = checkDateRange(fromDate,toDate,tableDate);
|
||
if (result) {
|
||
$(this).show();
|
||
} else {
|
||
$(this).hide();
|
||
}
|
||
|
||
});
|
||
|
||
$('#filterModalId').modal('hide');
|
||
|
||
}
|
||
|
||
|
||
|
||
function checkDateRange(fromDate, toDate, tableDate) {
|
||
// Convert the dates to a comparable format (YYYY-MM-DD)
|
||
let from = convertToDate(fromDate);
|
||
let to = convertToDate(toDate);
|
||
let table = convertToDate(tableDate);
|
||
|
||
// Return true if the table date is within the range
|
||
return table >= from && table <= to;
|
||
}
|
||
|
||
|
||
function convertToDate(dateString) {
|
||
// Convert from DD-MM-YYYY to YYYY-MM-DD for comparison
|
||
let parts = dateString.split('-');
|
||
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
|
||
}
|
||
|
||
</script>
|
||
|
||
|
||
|
||
<script>
|
||
|
||
$(document).ready(function(){
|
||
|
||
function exportTableToExcel(tableID, filename = '') {
|
||
let table = document.getElementById(tableID);
|
||
|
||
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||
|
||
// Remove hidden rows
|
||
$(cloneTable).find('tr').filter(function () {
|
||
return $(this).css('display') === 'none';
|
||
}).remove();
|
||
|
||
// Remove hidden columns
|
||
$(cloneTable).find('th, td').each(function () {
|
||
if ($(this).css('display') === 'none') {
|
||
$(this).remove();
|
||
}
|
||
});
|
||
|
||
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||
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 = 'coatingMachineDetailTableId';
|
||
|
||
document.getElementById('coatingMachineDetailsExport').addEventListener('click',function(){
|
||
|
||
exportTableToExcel(tableId,'coatingMachineDetails_<?=$month?>.xlsx');
|
||
|
||
})
|
||
|
||
|
||
})
|
||
|
||
|
||
|
||
</script>
|
||
|
||
<script>
|
||
|
||
$(document).ready(function () {
|
||
$('#batchCardAddBtnId').click(function () {
|
||
|
||
let fileCount = $('.batchfile').length; // Count existing batch files
|
||
|
||
if (fileCount >= 5) { // Set your limit here (e.g., max 5 files)
|
||
alert("You can only upload up to 5 batch files.");
|
||
return;
|
||
}
|
||
|
||
let string = `<div class="form-group col-md-3 batch-container">
|
||
<label for="">Upload Batch Card</label>
|
||
<input type="file" class="batchfile" name="batchCard[]" >
|
||
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>
|
||
</div>`;
|
||
|
||
$('#batchCardRowId').append(string);
|
||
});
|
||
|
||
// Remove batch card field dynamically
|
||
$(document).on('click', '.removeBatch', function () {
|
||
$(this).closest('.batch-container').remove();
|
||
});
|
||
});
|
||
|
||
$(document).ready(function () {
|
||
$('#editBatchCardAddBtnId').click(function () {
|
||
|
||
let fileCount = $('.editBatchFile').length; // Count existing batch files
|
||
|
||
if (fileCount >= 5) { // Set your limit here (e.g., max 5 files)
|
||
alert("You can only upload up to 5 batch files.");
|
||
return;
|
||
}
|
||
|
||
let string = `<div class="form-group col-md-3 batch-container">
|
||
<label for="">Upload Batch Card</label>
|
||
<input type="file" class="editBatchFile" name="batchCard[]" >
|
||
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch">Remove</button>
|
||
</div>`;
|
||
|
||
$('#editBatchCardRowId').append(string);
|
||
});
|
||
|
||
// Remove batch card field dynamically
|
||
$(document).on('click', '.removeBatch', function () {
|
||
let batchId = this.getAttribute('data-id'); // Get the data-id
|
||
|
||
if (confirm("Are you sure you want to delete this batch file?")) {
|
||
$.ajax({
|
||
url: "<?php echo base_url();?>/deleteBatchCardFile",
|
||
type: "POST",
|
||
data: { id: batchId },
|
||
success: function (response) {
|
||
if(response.status == "200"){
|
||
alert("Batch File Deleted Successfully!");
|
||
$(this).closest('.batch-container').remove(); // Remove from UI
|
||
location.reload(); // Reload the page
|
||
|
||
} else{
|
||
alert("Removed Empty batch file");
|
||
// alert("Error deleting batch file: " + response.message);
|
||
}
|
||
},
|
||
error: function (xhr, status, error) {
|
||
alert("Error deleting batch file: " + error);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
</script>
|