stock module latest today vadivel J 11-02-2025
This commit is contained in:
parent
baec260422
commit
a58de98aa7
@ -472,6 +472,7 @@ $routes->match(['GET', 'POST'], 'coatingMachineDetails', 'StockController::loadV
|
|||||||
$routes->post('addNewCoatingMachineDetails', 'StockController::addNewCoatingMachineDetails');
|
$routes->post('addNewCoatingMachineDetails', 'StockController::addNewCoatingMachineDetails');
|
||||||
$routes->post('updateCoatingMachineDetails', 'StockController::updateCoatingMachineDetails');
|
$routes->post('updateCoatingMachineDetails', 'StockController::updateCoatingMachineDetails');
|
||||||
$routes->post('deleteBatchCardFile','StockController::deleteBatchCardFile');
|
$routes->post('deleteBatchCardFile','StockController::deleteBatchCardFile');
|
||||||
|
$routes->get('download-batchcard-zip','StockController::downloadBatchCardZip');
|
||||||
|
|
||||||
//drier machine details
|
//drier machine details
|
||||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'drierMachineDetails', 'StockController::drierMachineDetails');
|
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'drierMachineDetails', 'StockController::drierMachineDetails');
|
||||||
|
|||||||
@ -168,7 +168,8 @@ class StockController extends BaseController
|
|||||||
JSON_OBJECT(
|
JSON_OBJECT(
|
||||||
"client_given_name", t_batchcard_files.client_file_name,
|
"client_given_name", t_batchcard_files.client_file_name,
|
||||||
"filename", t_batchcard_files.filename,
|
"filename", t_batchcard_files.filename,
|
||||||
"batchCardId" , t_batchcard_files.id
|
"batchCardId" , t_batchcard_files.id,
|
||||||
|
"coating_id", t_batchcard_files.coating_id
|
||||||
)
|
)
|
||||||
) as batchcard_files')
|
) as batchcard_files')
|
||||||
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingMachineDetails.id', 'left')
|
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingMachineDetails.id', 'left')
|
||||||
@ -439,6 +440,59 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function downloadBatchcardZip()
|
||||||
|
{
|
||||||
|
$coatingId = $this->request->getGet('coating_id');
|
||||||
|
$date = $this->request->getGet('date');
|
||||||
|
$batchCardFiles = $this->getBatchCardFiles($coatingId); // Fetch files from DB
|
||||||
|
|
||||||
|
if (empty($batchCardFiles)) {
|
||||||
|
return redirect()->back()->with('error', 'No batchcard files found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$zipFileName = 'batchcard_files_' . $date . '.zip';
|
||||||
|
$zipFilePath = WRITEPATH . 'uploads/batchcard' . $zipFileName; // CI4 WRITEPATH safe directory
|
||||||
|
|
||||||
|
$zip = new \ZipArchive();
|
||||||
|
if ($zip->open($zipFilePath, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === true) {
|
||||||
|
foreach ($batchCardFiles as $file) {
|
||||||
|
$originalFilePath = WRITEPATH . 'uploads/batchcard/' . $file['filename']; // Actual stored file
|
||||||
|
$clientFileName = $file['client_file_name'] ?? $file['filename']; // Use client name if available
|
||||||
|
|
||||||
|
if (file_exists($originalFilePath)) {
|
||||||
|
$zip->addFile($originalFilePath, $clientFileName); // Rename inside ZIP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
$response = $this->response->download($zipFilePath, null)->setFileName($zipFileName);
|
||||||
|
|
||||||
|
// Delete ZIP after response is sent
|
||||||
|
register_shutdown_function(function () use ($zipFilePath) {
|
||||||
|
if (file_exists($zipFilePath)) {
|
||||||
|
unlink($zipFilePath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('error', 'Failed to create ZIP file.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example function to get batchcard files from DB
|
||||||
|
private function getBatchCardFiles($coatingId)
|
||||||
|
{
|
||||||
|
$batchCardFiles = $this->db->table('t_batchcard_files')
|
||||||
|
->where('coating_id', $coatingId)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
return $batchCardFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//incoming Silica Sand Details starts
|
//incoming Silica Sand Details starts
|
||||||
public function loadView_incomingSilicaSandDetails()
|
public function loadView_incomingSilicaSandDetails()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -356,6 +356,9 @@
|
|||||||
$summary = [] ;
|
$summary = [] ;
|
||||||
|
|
||||||
foreach ($coatingMachineDetails as $record) {
|
foreach ($coatingMachineDetails as $record) {
|
||||||
|
|
||||||
|
$batchCardFiles =json_decode($record['batchcard_files'],true);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr data-id="<?php echo $record['id']; ?>"
|
<tr data-id="<?php echo $record['id']; ?>"
|
||||||
<?php
|
<?php
|
||||||
@ -394,7 +397,10 @@
|
|||||||
<!-- td:eq(11) -->
|
<!-- td:eq(11) -->
|
||||||
<td class="celda_normal"><?php echo $record['perHourCoatingSandQTY'] ?? '' ?></td>
|
<td class="celda_normal"><?php echo $record['perHourCoatingSandQTY'] ?? '' ?></td>
|
||||||
<!-- td:eq(12) -->
|
<!-- td:eq(12) -->
|
||||||
|
<!-- edit and download option..!! -->
|
||||||
<td class="celda_normal" style="background-color:white;">
|
<td class="celda_normal" style="background-color:white;">
|
||||||
|
|
||||||
|
|
||||||
<a data-toggle="tooltip" class="edit-btn"
|
<a data-toggle="tooltip" class="edit-btn"
|
||||||
data-target="editCoatingMachineDetailModal" data-toggle="modal"
|
data-target="editCoatingMachineDetailModal" data-toggle="modal"
|
||||||
style="cursor:pointer;">
|
style="cursor:pointer;">
|
||||||
@ -403,6 +409,22 @@
|
|||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ($batchCardFiles as $index => $files) {
|
||||||
|
if ($index === 0 && !empty($files['batchCardId']) && $files['coating_id'] == $record['id'])
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<a href="<?= base_url('download-batchcard-zip?coating_id='.$record['id'].'&date='.$date); ?>"
|
||||||
|
data-toggle="tooltip" title="Download Batch Card" >
|
||||||
|
<i class="fa fa-download"></i>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<!-- td:eq(13) -->
|
<!-- td:eq(13) -->
|
||||||
<td style="display:none;"><?php echo $record['batchcard_files'] ?? ' ' ?></td>
|
<td style="display:none;"><?php echo $record['batchcard_files'] ?? ' ' ?></td>
|
||||||
|
|||||||
@ -1036,4 +1036,42 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1360,4 +1360,42 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -650,3 +650,41 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1142,3 +1142,41 @@ function convertToDate(dateString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1756,3 +1756,42 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1344,4 +1344,39 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -953,4 +953,42 @@ foreach ($period as $day) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -706,3 +706,43 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
|
||||||
|
let activeElement = document.activeElement;
|
||||||
|
|
||||||
|
// Check if the focused element is inside a table
|
||||||
|
let cell = activeElement.closest("td, th");
|
||||||
|
let table = activeElement.closest("table");
|
||||||
|
|
||||||
|
if (table && cell) {
|
||||||
|
event.preventDefault(); // Prevent form submission
|
||||||
|
|
||||||
|
let columnIndex = cell.cellIndex; // Get the current column index
|
||||||
|
|
||||||
|
let currentRow = cell.parentElement; // Get the current row
|
||||||
|
|
||||||
|
let nextRow = currentRow.nextElementSibling; // Get the next row
|
||||||
|
|
||||||
|
|
||||||
|
// Move to the same column in the next row if available
|
||||||
|
if (nextRow) {
|
||||||
|
|
||||||
|
|
||||||
|
let nextCell = nextRow.cells[columnIndex];
|
||||||
|
|
||||||
|
if (nextCell) {
|
||||||
|
|
||||||
|
nextCell.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user