FIX_issues : ps
This commit is contained in:
parent
c3e7e73142
commit
40a2cbc4d2
@ -1635,44 +1635,66 @@ function updateIGRWeight(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadFilesAsZip($igrno)
|
public function downloadFilesAsZip($igrno)
|
||||||
{
|
{
|
||||||
|
// Get all file details for the given IGR number
|
||||||
// Get all file details for the given IGR number
|
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno);
|
||||||
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno);
|
if (empty($fileDetails)) {
|
||||||
if (empty($fileDetails)) {
|
|
||||||
// Display an alert message
|
// Display an alert message
|
||||||
echo '<script>alert("There are no files.");</script>';
|
echo '<script>alert("There are no files.");</script>';
|
||||||
|
redirect('ViewIGR', 'refresh');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the root path for files
|
// Define the root path for files
|
||||||
$rootPath = ROOTPATH . 'public/uploads/Igrfiles/';
|
$rootPath = ROOTPATH . 'public/uploads/Igrfiles/';
|
||||||
|
|
||||||
// Create a new ZIP archive
|
// Create a new ZIP archive
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
|
|
||||||
// Define the name of the ZIP file
|
// Define the name of the ZIP file
|
||||||
$zipFileName = $igrno . '.zip';
|
$zipFileName = $igrno . '.zip';
|
||||||
$zipFilePath = ROOTPATH . 'public/uploads/Igrfiles/' . $zipFileName;
|
$zipFilePath = $rootPath . $zipFileName;
|
||||||
|
|
||||||
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
|
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
|
||||||
// Add each file to the ZIP archive
|
$filesAdded = false;
|
||||||
foreach ($fileDetails as $file) {
|
|
||||||
$filePath = $rootPath . $file->file;
|
|
||||||
if (file_exists($filePath)) {
|
|
||||||
$zip->addFile($filePath, $file->filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the ZIP archive
|
// Add each file to the ZIP archive
|
||||||
$zip->close();
|
foreach ($fileDetails as $file) {
|
||||||
|
$filePath = $rootPath . $file->file;
|
||||||
|
if (file_exists($filePath)) {
|
||||||
|
if (!$zip->addFile($filePath, $file->filename)) {
|
||||||
|
// Handle error when adding file to ZIP
|
||||||
|
echo '<script>alert("Failed to add file: ' . $file->filename . '");</script>';
|
||||||
|
$zip->close();
|
||||||
|
redirect('ViewIGR', 'refresh');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$filesAdded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return the ZIP file as a download
|
// Close the ZIP archive
|
||||||
return $this->response->download($zipFilePath, null)->setFileName($zipFileName);
|
$zip->close();
|
||||||
} else {
|
|
||||||
// Handle the error
|
if ($filesAdded) {
|
||||||
echo 'Failed to create ZIP file';
|
// Return the ZIP file as a download
|
||||||
}
|
return $this->response->download($zipFilePath, null)->setFileName($zipFileName);
|
||||||
|
} else {
|
||||||
|
// Delete the empty ZIP file
|
||||||
|
if (file_exists($zipFilePath)) {
|
||||||
|
unlink($zipFilePath);
|
||||||
|
}
|
||||||
|
echo '<script>alert("There are no files.");</script>';
|
||||||
|
redirect('ViewIGR', 'refresh');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<script>alert("Failed to create ZIP file");</script>';
|
||||||
|
redirect('ViewIGR', 'refresh');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -205,15 +205,15 @@
|
|||||||
<table class="table table-bordered" id="Inwardgateregistertable1 table-hover" style="background-color:#fff; font-size:12px;">
|
<table class="table table-bordered" id="Inwardgateregistertable1 table-hover" style="background-color:#fff; font-size:12px;">
|
||||||
<thead style="background-color:#ddd !important">
|
<thead style="background-color:#ddd !important">
|
||||||
<tr>
|
<tr>
|
||||||
<th>SNo</th>
|
<th style="width: 50px;">SNo</th>
|
||||||
<th>Item Code</th>
|
<th style="width: 100px;">Item Code</th>
|
||||||
<th>Item Description</th>
|
<th style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">Item Description</th>
|
||||||
<th>UOM</th>
|
<th style="width: 50px;">UOM</th>
|
||||||
<th>Ordred Qty</th>
|
<th style="width: 100px;">Ordered Qty</th>
|
||||||
<th>Received Qty</th>
|
<th style="width: 100px;">Received Qty</th>
|
||||||
<th id="pendingQuantityHeader" style="display:none;">Pending Qty</th>
|
<th id="pendingQuantityHeader" style="display:none; width: 100px;">Pending Qty</th>
|
||||||
<th>Remarks</th>
|
<th style="width: 150px;">Remarks</th>
|
||||||
<th></th>
|
<th style="width: 50px;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbleIGRAppend">
|
<tbody id="tbleIGRAppend">
|
||||||
@ -610,15 +610,15 @@ console.log(parsedData);
|
|||||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||||
|
|
||||||
trIGRHTML += '<tr>' +
|
trIGRHTML += '<tr>' +
|
||||||
'<td align="right">' + i + '</td>' +
|
'<td style="width: 50px;" align="right">' + i + '</td>' +
|
||||||
'<td name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
||||||
'<td>' + item.MaterialName + '</td>' +
|
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
|
||||||
'<td name="UOM">' + item.UOM + '</td>' +
|
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
|
||||||
'<td align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
|
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
|
||||||
'<td align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
|
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
|
||||||
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
|
||||||
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
|
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||||
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||||
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||||
@ -641,14 +641,14 @@ console.log(parsedData);
|
|||||||
} else {
|
} else {
|
||||||
$("#pendingQuantityHeader").css("display", "none");
|
$("#pendingQuantityHeader").css("display", "none");
|
||||||
trIGRHTML += '<tr>' +
|
trIGRHTML += '<tr>' +
|
||||||
'<td align="right">' + i + '</td>' +
|
'<td style="width: 50px;" align="right">' + i + '</td>' +
|
||||||
'<td name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
|
||||||
'<td>' + item.MaterialName + '</td>' +
|
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
|
||||||
'<td name="UOM">' + item.UOM + '</td>' +
|
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
|
||||||
'<td align="right" name="Quantity">' + item.Quantity + '</td>' +
|
'<td style="width: 100px;" align="right" name="Quantity">' + item.Quantity + '</td>' +
|
||||||
'<td align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
'<td style="width: 100px;" align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
||||||
'<td>' + item.Remarks + '</td>' +
|
'<td style="width: 150px;">' + item.Remarks + '</td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||||
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||||
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user