Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
aa1feea067
@ -463,8 +463,7 @@ $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR');
|
||||
$routes->match(['GET', 'POST'], 'coatingMachineDetails', 'StockController::loadView_coatingMachineDetails');
|
||||
$routes->post('addNewCoatingMachineDetails', 'StockController::addNewCoatingMachineDetails');
|
||||
$routes->post('updateCoatingMachineDetails', 'StockController::updateCoatingMachineDetails');
|
||||
$routes->get('deleteCoatingMachineDetails', 'StockController::deleteCoatingMachineDetails');
|
||||
|
||||
$routes->post('deleteBatchCardFile','StockController::deleteBatchCardFile');
|
||||
|
||||
//drier machine details
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'drierMachineDetails', 'StockController::drierMachineDetails');
|
||||
|
||||
@ -688,7 +688,7 @@ class Payslip extends BaseController
|
||||
|
||||
|
||||
|
||||
if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $ESI_Rate / 100; } else { $esiAmount = 0; }
|
||||
if ($value->esi_applicable == 1) { $esiAmount = ($currentDayBasic + $currentDayHra) * $ESI_Rate / 100; } else { $esiAmount = 0; }
|
||||
if ($value->pf_applicable == 1) { $pfAmount = $currentDayBasic * $PF_Rate / 100; } else { $pfAmount = 0; }
|
||||
|
||||
/** pf amount per day**/
|
||||
@ -830,7 +830,7 @@ class Payslip extends BaseController
|
||||
//$totalSalary = $currentDayBasic + $currentDayHra + $totSalayOT;
|
||||
|
||||
|
||||
if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $ESI_Rate / 100; } else { $esiAmount = 0;}
|
||||
if ($value->esi_applicable == 1) { $esiAmount = ($currentDayBasic + $currentDayHra) * $ESI_Rate / 100; } else { $esiAmount = 0;}
|
||||
if ($value->pf_applicable == 1) { $pfAmount = $currentDayBasic * $PF_Rate / 100; } else { $pfAmount = 0;}
|
||||
|
||||
/** pf amount per day**/
|
||||
|
||||
@ -149,11 +149,21 @@ class StockController extends BaseController
|
||||
$startDate = "$month-01";
|
||||
$endDate = date("Y-m-t", strtotime($startDate));
|
||||
$data['coatingMachineDetails'] = $this->coatingMachineDetails_model
|
||||
->where('date >=', $startDate)
|
||||
->where('date <=', $endDate)
|
||||
->where('is_active', 1)
|
||||
->orderBy('date', 'asc')
|
||||
->findAll();
|
||||
->select('t_coatingMachineDetails.*,
|
||||
JSON_ARRAYAGG(
|
||||
JSON_OBJECT(
|
||||
"client_given_name", t_batchcard_files.client_file_name,
|
||||
"filename", t_batchcard_files.filename,
|
||||
"batchCardId" , t_batchcard_files.id
|
||||
)
|
||||
) as batchcard_files')
|
||||
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingMachineDetails.id', 'left')
|
||||
->where('t_coatingMachineDetails.date >=', $startDate)
|
||||
->where('t_coatingMachineDetails.date <=', $endDate)
|
||||
->groupBy('t_coatingMachineDetails.id')
|
||||
->orderBy('t_coatingMachineDetails.date', 'asc')
|
||||
->findAll();
|
||||
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
|
||||
@ -181,8 +191,8 @@ class StockController extends BaseController
|
||||
$sameShiftOnDateExists = $this->coatingMachineDetails_model
|
||||
->where('date', $date)
|
||||
->where('shift', $shift)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if (!empty($sameShiftOnDateExists)) {
|
||||
return redirect()->back()->with('error', 'Already same shift exists on the same date ..!!');
|
||||
@ -193,9 +203,9 @@ class StockController extends BaseController
|
||||
|
||||
try {
|
||||
// Insert into coating machine details table
|
||||
$inserted = $this->coatingMachineDetails_model->insert($postData);
|
||||
$insertedId = $this->coatingMachineDetails_model->insert($postData);
|
||||
|
||||
if ($inserted !== false && $inserted > 0) {
|
||||
if ($insertedId !== false && $insertedId > 0) {
|
||||
|
||||
$message1 = 'Coating Machine details updated successfully';
|
||||
|
||||
@ -214,6 +224,37 @@ class StockController extends BaseController
|
||||
throw new \Exception('Failed to insert Coating machine details.');
|
||||
}
|
||||
|
||||
if ($insertedId !== false && $insertedId > 0) {
|
||||
|
||||
$batchCardFiles = $this->request->getFileMultiple('batchCard');
|
||||
|
||||
if (!empty($batchCardFiles) && !($batchCardFiles[0]->getError() === UPLOAD_ERR_NO_FILE)) {
|
||||
|
||||
foreach ($batchCardFiles as $file) {
|
||||
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$clientGivenName = $file->getClientName(); // User-given filename
|
||||
$newName = $file->getRandomName();
|
||||
|
||||
if ($file->move(WRITEPATH . 'uploads/batchcard', $newName)) {
|
||||
// Only save to DB if file moved successfully
|
||||
$db = \Config\Database::connect();
|
||||
$builder = $db->table('t_batchcard_files');
|
||||
|
||||
$data = [
|
||||
'client_file_name' => $clientGivenName,
|
||||
'filename' => $newName,
|
||||
'coating_id' => $insertedId
|
||||
];
|
||||
|
||||
$builder->insert($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
@ -236,6 +277,8 @@ class StockController extends BaseController
|
||||
|
||||
public function updateCoatingMachineDetails()
|
||||
{
|
||||
|
||||
|
||||
$message1 = '';
|
||||
$message2 = '';
|
||||
$message3 = '';
|
||||
@ -250,13 +293,48 @@ class StockController extends BaseController
|
||||
$this->db->transBegin();
|
||||
try {
|
||||
$updated = $this->coatingMachineDetails_model->update($id, $putData);
|
||||
|
||||
|
||||
|
||||
if ($updated !== false && $updated > 0) { // Assuming $id is the record ID being updated
|
||||
|
||||
$batchCardFiles = $this->request->getFileMultiple('batchCard');
|
||||
|
||||
|
||||
// Step 4: Upload new files and insert into DB
|
||||
foreach ($batchCardFiles as $index => $file) {
|
||||
|
||||
if ( !empty($batchCardFiles[$index]) && !($batchCardFiles[$index]->getError() === UPLOAD_ERR_NO_FILE)) {
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$builder = $db->table('t_batchcard_files');
|
||||
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$clientGivenName = $file->getClientName(); // User-given filename
|
||||
$newName = $file->getRandomName(); // Randomized unique filename
|
||||
|
||||
// Move the new file to storage
|
||||
if ($file->move(WRITEPATH . 'uploads/batchcard', $newName)) {
|
||||
// Insert new file record into the database
|
||||
$data = [
|
||||
'client_file_name' => $clientGivenName,
|
||||
'filename' => $newName,
|
||||
'coating_id' => $id
|
||||
];
|
||||
$builder->insert($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($updated !== false && $updated > 0) {
|
||||
$message1 = "successfully updated Coating machineDetail .";
|
||||
//update Gas stock consumption if update is successfull..!!
|
||||
$dateToBeUpdated = $putData['date'];
|
||||
|
||||
$existingCoatingGasConsumption = $putData['existingTotalGasConsumption'];
|
||||
$updatedCoatingGasConsumption = $putData['totalGasConsumption'];
|
||||
$updatedCoatingGasConsumption = $putData['totalGasConsumption'];
|
||||
|
||||
if ($existingCoatingGasConsumption != $updatedCoatingGasConsumption) {
|
||||
|
||||
@ -288,29 +366,67 @@ class StockController extends BaseController
|
||||
} else {
|
||||
throw new \Exception('Failed to update Coating machine details.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (\Exception $error) {
|
||||
$this->db->transRollback();
|
||||
return redirect()->back()->with('error', ' ' . $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCoatingMachineDetails()
|
||||
public function deleteBatchCardFile()
|
||||
{
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
$data['is_active'] = 0;
|
||||
|
||||
$updated = $this->coatingMachineDetails_model->update($id, $data);
|
||||
|
||||
if ($updated) {
|
||||
// Set flashdata for success message
|
||||
return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details deleted successfully');
|
||||
} else {
|
||||
// Set flashdata for error message
|
||||
return redirect()->back()->with('error', 'Failed to delete Coating machine details');
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if (!empty($data)) {
|
||||
|
||||
$batchId = $data['id'];
|
||||
$db = \Config\Database::connect();
|
||||
$builder = $db->table('t_batchcard_files');
|
||||
|
||||
// Step 1: Fetch the filename from DB before deleting
|
||||
$fileRecord = $builder->select('filename')->where('id', $batchId)->get()->getRow();
|
||||
|
||||
if ($fileRecord) {
|
||||
$filePath = WRITEPATH . 'uploads/batchcard/' . $fileRecord->filename;
|
||||
|
||||
// Step 2: Delete the file from storage
|
||||
if (file_exists($filePath)) {
|
||||
unlink($filePath);
|
||||
}
|
||||
|
||||
// Step 3: Delete the record from the database
|
||||
$sql = "DELETE FROM t_batchcard_files WHERE id = ?";
|
||||
$deleted = $db->query($sql, [$batchId]);
|
||||
|
||||
if ($deleted) {
|
||||
return $this->response->setJSON([
|
||||
'status' => '200',
|
||||
'message' => "Deleted Batch Card File Successfully..!!"
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'status' => '400',
|
||||
'message' => "Failed to Delete..!! Try Again Later"
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'status' => '404',
|
||||
'message' => "File Not Found..!!"
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => '400',
|
||||
'message' => "Invalid Request..!!"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
//incoming Silica Sand Details starts
|
||||
public function loadView_incomingSilicaSandDetails()
|
||||
|
||||
@ -13,7 +13,7 @@ class CoatingMachineDetailsModel extends Model
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['shift','machineOnTime','machineOffTime','totalCoating','date',
|
||||
'machineRunningInHrs' , 'perHourCoatingSandQTY' , 'perHourGasConsumption' ,
|
||||
'machineRunningInHrs' , 'perHourCoatingSandQTY' , 'perHourGasConsumption' ,'grade',
|
||||
'totalCoatingSandInKg','totalGasConsumption','customerName', 'is_active','created_at','updated_at'];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
|
||||
@ -327,12 +327,13 @@
|
||||
<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;">Customer Name</th>
|
||||
<th class="celda_encabezado_general" style="padding: 10px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -357,18 +358,31 @@
|
||||
<?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 class="celda_normal"><?php echo $record['machineRunningInHrs'] ?? '' ?></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 class="celda_normal"><?php echo $record['customerName']; ?></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"
|
||||
@ -379,6 +393,8 @@
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<!-- td:eq(13) -->
|
||||
<td style="display:none;"><?php echo $record['batchcard_files'] ?? ' ' ?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -389,14 +405,16 @@
|
||||
|
||||
|
||||
if (!isset($summary['totalCoating'])) {
|
||||
$summary['totalMachineRunningHrs'] = 0 ;
|
||||
$summary['totalCoating'] = 0 ;
|
||||
$summary['totalCoatingSandInKg'] = 0 ;
|
||||
$summary['totalGasConsumption'] = 0 ;
|
||||
$summary['perHourGasConsumption'] = 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'] ;
|
||||
@ -415,6 +433,8 @@
|
||||
<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>
|
||||
@ -434,12 +454,14 @@
|
||||
<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 "><?=$summary['perHourGasConsumption']?></td>
|
||||
<td class="celda_normal "><?=$summary['perHourCoatingSandQTY']?></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>
|
||||
@ -492,7 +514,9 @@
|
||||
</div>
|
||||
|
||||
<!-- form -->
|
||||
<form method="post" action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?= $month; ?>">
|
||||
<form method="post"
|
||||
enctype="multipart/form-data"
|
||||
action="<?php echo base_url(); ?>addNewCoatingMachineDetails?month=<?= $month; ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-row">
|
||||
@ -594,7 +618,7 @@
|
||||
<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"
|
||||
<input type="text" class="form-control" readonly id="machineRunningInHrsId"
|
||||
name="machineRunningInHrs" required>
|
||||
|
||||
</div>
|
||||
@ -609,9 +633,9 @@
|
||||
|
||||
<!-- grade -->
|
||||
<div class="form-group col-md-3">
|
||||
<label for="totalCoatingId">grade</label>
|
||||
<label for="gradeId">grade</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
|
||||
<input type="text" class="form-control" id="gradeId" name="grade" value=""
|
||||
required>
|
||||
</div>
|
||||
|
||||
@ -644,21 +668,21 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- per hour Coating sand qty -->
|
||||
<!-- 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" id="perHourCoatingSandQTYId"
|
||||
<input type="text" class="form-control" readonly id="perHourCoatingSandQTYId"
|
||||
name="perHourCoatingSandQTY" required>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- per hour gas consumption -->
|
||||
<!-- 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" id="perHourGasConsumptionId"
|
||||
name="perHourGasConsumption" required>
|
||||
<input type="text" class="form-control" readonly id="perHourGasConsumptionId"
|
||||
name="perHourGasConsumption" required >
|
||||
|
||||
</div>
|
||||
|
||||
@ -666,18 +690,25 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<!-- batch card file upload -->
|
||||
<div class="form-group col-md-3">
|
||||
<label for="totalCoatingSandId">upload batch card</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
<input type="text" class="form-control" id="totalCoatingSandId" name="totalCoatingSandInKg"
|
||||
value="" required>
|
||||
<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>
|
||||
<div class="modal-footer">
|
||||
@ -693,7 +724,7 @@
|
||||
<!-- 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-dialog modal-lg" style="width:1060px !important ;" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
||||
@ -707,21 +738,28 @@
|
||||
|
||||
<!-- 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>
|
||||
@ -758,6 +796,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- machine off time -->
|
||||
<div class="form-group col-md-3">
|
||||
<label for="editMachineOffTimeHrId">Machine Off Time</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
@ -796,24 +835,55 @@
|
||||
</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="editTotalCoatingId">Total Coating</label>
|
||||
<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>
|
||||
@ -823,35 +893,45 @@
|
||||
name="existingTotalGasConsumption" value="">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<!-- per hour Coating sand qty -->
|
||||
<div class="form-group col-md-3">
|
||||
<label for="editMachineRunningInHrsId"> Machine Running In Hrs</label>
|
||||
<label for="editPerHourCoatingSandQTYId">Per Hour Coating Sand QTY</label>
|
||||
<span class="badge mandatory">*</span>
|
||||
<input type="text" class="form-control" id="editMachineRunningInHrsId"
|
||||
name="machineRunningInHrs" required>
|
||||
<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" id="editPerHourGasConsumptionId"
|
||||
<input type="text" class="form-control" readonly 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 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>
|
||||
@ -1141,29 +1221,60 @@
|
||||
|
||||
// Get values from the row
|
||||
|
||||
var date = row.find('td:eq(0)').text().split('-');
|
||||
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();
|
||||
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
|
||||
$('#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);
|
||||
@ -1180,6 +1291,16 @@
|
||||
});
|
||||
</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>
|
||||
@ -1509,4 +1630,76 @@
|
||||
|
||||
|
||||
|
||||
</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
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert("Error deleting batch file: " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user