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('updateCoatingMachineDetails', 'StockController::updateCoatingMachineDetails');
|
||||
$routes->post('deleteBatchCardFile','StockController::deleteBatchCardFile');
|
||||
$routes->get('download-batchcard-zip','StockController::downloadBatchCardZip');
|
||||
|
||||
//drier machine details
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'drierMachineDetails', 'StockController::drierMachineDetails');
|
||||
|
||||
@ -168,7 +168,8 @@ class StockController extends BaseController
|
||||
JSON_OBJECT(
|
||||
"client_given_name", t_batchcard_files.client_file_name,
|
||||
"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')
|
||||
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingMachineDetails.id', 'left')
|
||||
@ -437,6 +438,59 @@ class StockController extends BaseController
|
||||
'message' => "Invalid Request..!!"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
@ -356,6 +356,9 @@
|
||||
$summary = [] ;
|
||||
|
||||
foreach ($coatingMachineDetails as $record) {
|
||||
|
||||
$batchCardFiles =json_decode($record['batchcard_files'],true);
|
||||
|
||||
?>
|
||||
<tr data-id="<?php echo $record['id']; ?>"
|
||||
<?php
|
||||
@ -394,7 +397,10 @@
|
||||
<!-- td:eq(11) -->
|
||||
<td class="celda_normal"><?php echo $record['perHourCoatingSandQTY'] ?? '' ?></td>
|
||||
<!-- td:eq(12) -->
|
||||
<!-- edit and download option..!! -->
|
||||
<td class="celda_normal" style="background-color:white;">
|
||||
|
||||
|
||||
<a data-toggle="tooltip" class="edit-btn"
|
||||
data-target="editCoatingMachineDetailModal" data-toggle="modal"
|
||||
style="cursor:pointer;">
|
||||
@ -403,6 +409,22 @@
|
||||
|
||||
</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:eq(13) -->
|
||||
<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>
|
||||
@ -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>
|
||||
@ -650,3 +650,41 @@
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
@ -1141,4 +1141,42 @@ function convertToDate(dateString) {
|
||||
return input;
|
||||
}
|
||||
|
||||
</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>
|
||||
@ -1755,4 +1755,43 @@ $(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>
|
||||
@ -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>
|
||||
@ -706,3 +706,43 @@
|
||||
</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