FIX_rcvqtyonlydisplayed

This commit is contained in:
VE10-Sanjeev 2024-08-19 11:33:00 +00:00
parent cc5bc95757
commit 7708d522c1
2 changed files with 89 additions and 73 deletions

View File

@ -371,11 +371,12 @@ class Inwardgateregister extends BaseController
foreach ($files['emp_file'] as $index => $file) { foreach ($files['emp_file'] as $index => $file) {
if ($file->isValid() && !$file->hasMoved()) { if ($file->isValid() && !$file->hasMoved()) {
// Move the file to the desired directory // Move the file to the desired directory
$finallyfilename = (!empty($fileNames[$index])) ? $fileNames[$index] : $file->getName();
$newName = $file->getRandomName(); $newName = $file->getRandomName();
$file->move($path, $newName); $file->move($path, $newName);
// Store the file information in the database // Store the file information in the database
$additionalFiles = array( $additionalFiles = array(
'Remarks' => $fileNames[$index], 'Remarks' => $finallyfilename,
'FilePath' => $newName, 'FilePath' => $newName,
'IGRNO' => $IGRNO, 'IGRNO' => $IGRNO,
'PONO' => $PONO 'PONO' => $PONO
@ -383,7 +384,7 @@ class Inwardgateregister extends BaseController
$lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles); $lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles);
if ($lastInsertFileId) { if ($lastInsertFileId) {
$fileupdated_count++; $fileupdated_count++;
$fileupdated_name[] = $fileNames[$index]; $fileupdated_name[] = $finallyfilename;
} }
} }
} }
@ -478,11 +479,17 @@ class Inwardgateregister extends BaseController
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails)); log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
$igrlineno = ""; $igrlineno = "";
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0' && ((int)$IsThisOpenOrderPO != 1)){
$igrD = $this->inwardgateregister_model->addigrD($igrDetails); $igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$igrlineno = !empty($igrD) ? $igrD : ''; $igrlineno = !empty($igrD) ? $igrD : '';
}else if((int)$IsThisOpenOrderPO == 1){
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$igrlineno = !empty($igrD) ? $igrD : '';
}
if($igrlineno){
$itemvalue = ''; $itemvalue = '';
$SupplierId = ''; $SupplierId = '';
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode); $polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode);
foreach ($polineitemvalue as $it) { foreach ($polineitemvalue as $it) {
$itemvalue = $it->Rate; $itemvalue = $it->Rate;
@ -536,7 +543,7 @@ class Inwardgateregister extends BaseController
$av_qty = $gt->Current_stock; $av_qty = $gt->Current_stock;
} }
} }
$currentav_qty = $QuantityAsPerInvoice + $av_qty; $currentav_qty = (int)$QuantityAsPerInvoice + (int)$av_qty;
$current_qty = array('Current_stock' => $currentav_qty); $current_qty = array('Current_stock' => $currentav_qty);
$this->inwardgateregister_model->addmaterialmaster($current_qty, $MaterialCode); $this->inwardgateregister_model->addmaterialmaster($current_qty, $MaterialCode);
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO, $MaterialCode); $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO, $MaterialCode);
@ -546,10 +553,16 @@ class Inwardgateregister extends BaseController
$ReceivedQuantity = $key->ReceivedQuantity; $ReceivedQuantity = $key->ReceivedQuantity;
} }
} }
$totalReceivedqty = (int)$IsThisOpenOrderPO == 1 ? 0 : $ReceivedQuantity + $QuantityAsPerInvoice ; $totalReceivedqty = (int)$IsThisOpenOrderPO == 1 ? 0 : (int)$ReceivedQuantity + (int)$QuantityAsPerInvoice ;
// $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; // $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
if(((int)$totalReceivedqty > 0) && ((int)$IsThisOpenOrderPO != 1)){
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt); $POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode); $this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
}else if((int)$IsThisOpenOrderPO == 1){
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
}
}
} }
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy,$IGRStatus); $this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy,$IGRStatus);
@ -710,11 +723,12 @@ function viewIGRDetails()
if ($file->isValid() && !$file->hasMoved()) { if ($file->isValid() && !$file->hasMoved()) {
// Move the file to the desired directory // Move the file to the desired directory
$finallyfilename = (!empty($fileNames[$index])) ? $fileNames[$index] : $file->getName();
$newName = $file->getRandomName(); $newName = $file->getRandomName();
$file->move($path, $newName); $file->move($path, $newName);
// Store the file information in the database // Store the file information in the database
$additionalFiles = array( $additionalFiles = array(
'Remarks' => $fileNames[$index], 'Remarks' => $finallyfilename,
'FilePath' => $newName, 'FilePath' => $newName,
'IGRNO' => $IGRNo, 'IGRNO' => $IGRNo,
'PONO' => $PONo 'PONO' => $PONo
@ -722,7 +736,7 @@ function viewIGRDetails()
$lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles); $lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles);
if ($lastInsertFileId) { if ($lastInsertFileId) {
$fileupdated_count++; $fileupdated_count++;
$fileupdated_name[] = $fileNames[$index]; $fileupdated_name[] = $finallyfilename;
} }
} }
} }

View File

@ -700,6 +700,7 @@ console.log(parsedData);
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") { if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile); modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File'); modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
modal.find('#MasterFileLabel a').attr('target', '_blank');
modal.find('#MasterFileLabel a span').text('previously uploaded - '); modal.find('#MasterFileLabel a span').text('previously uploaded - ');
modal.find('#MasterFileLabel a small').text(item.MasterFile); modal.find('#MasterFileLabel a small').text(item.MasterFile);
modal.find('#MasterFileLabel').show(); modal.find('#MasterFileLabel').show();
@ -1283,6 +1284,7 @@ function deleteBill(Billno,i){
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") { if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File'); modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>'+'public/uploads/Igrfiles/'+fileName); modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>'+'public/uploads/Igrfiles/'+fileName);
modal.find('#WeightFileLabel a').attr('target', '_blank');
modal.find('#WeightFileLabel a span').text('previously uploaded - '); modal.find('#WeightFileLabel a span').text('previously uploaded - ');
modal.find('#WeightFileLabel a small').text(fileName); modal.find('#WeightFileLabel a small').text(fileName);
modal.find('#WeightFileLabel').show(); modal.find('#WeightFileLabel').show();