From bef33dc5cd6c475ef6cd1a26b4f449a08c85e7a9 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 3 Dec 2024 18:01:58 +0530 Subject: [PATCH] Emergency PO changes-1 vadivel J 03-12--2024 --- app/Controllers/Emergencypurchaseorder.php | 120 +- app/Views/alterpurchaseorder.php | 2035 +++++++++----------- app/Views/editRevenuepurchaseorder.php | 2 +- 3 files changed, 988 insertions(+), 1169 deletions(-) diff --git a/app/Controllers/Emergencypurchaseorder.php b/app/Controllers/Emergencypurchaseorder.php index 37785a4a..c18be944 100755 --- a/app/Controllers/Emergencypurchaseorder.php +++ b/app/Controllers/Emergencypurchaseorder.php @@ -297,34 +297,22 @@ class Emergencypurchaseorder extends BaseController } if ($POStatus == SPECIAL_PO) { - $count = $this->request->getPost('hidecounters'); - $constant = $this->request->getPost('hideconstants'); + $serviceFilesLength = $this->request->getPost('serviceFilesLength'); + $file = $this->request->getFiles(); + + + if($serviceFilesLength > 0){ $listOfFiles = $serviceFilesLength ;} $arr = []; $prefile = array(); - for ($i = 1; $i <= $constant; $i++) { + for ($i = 1; $i <= $listOfFiles; $i++) { $file = $this->request->getFile('browseFiles' . $i); $requestfilename = $file->getName(); if (!empty($requestfilename)) { - $files = str_replace(" ", "", $requestfilename); - - $fcount = 0; - - foreach ($prefile as $value) { - - if ($value == $files) { - - $fcount++; - } - } - - if ($fcount == 0) { - - if ($file->isValid() && !$file->hasMoved()) { $path = ROOTPATH.'public/uploads/BillFiles/'; if(!is_dir($path)) { mkdir($path, 0777, true); } @@ -334,28 +322,14 @@ class Emergencypurchaseorder extends BaseController //echo $Picture; $arr[] = array($Picture); } - - $prefile[] = $files; - } + $prefile[] = trim($requestfilename); } - //print_r($arr); if (!empty($arr)) { - foreach ($arr as $ma) { - - - $index = 0; - foreach ($ma as $key => $value) { - $index++; - if ($index == 1) { - $filename = $value; - } - } - if (!empty($filename)) { - + foreach ($arr as $filename) { $myfile = array('FilePath' => $filename, 'PONO' => $PONO); $this->purchaseorder_model->fileupload($myfile); - } + } } } @@ -723,7 +697,7 @@ class Emergencypurchaseorder extends BaseController //echo $PendingQty.'ReceivedQty'.$ReceivedQty; //echo ' '; - if (strlen((string)$QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') { + if (strlen((string)$QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') { $Remarks = "Special PO Created"; $ItemStatus = ''; //if($QuantityAsPerInvoice == $OrderedQuantity) @@ -740,14 +714,9 @@ class Emergencypurchaseorder extends BaseController $igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt); - //print_r($igrDetails); - - - $igrD = $this->inwardgateregister_model->addigrD($igrDetails); $IGRItemNo = !empty($igrD) ? $igrD : ''; - //echo $IGRItemNo; $MaterialstockHistoryadd = array('Ref_No' => $IGRItemNo, 'MaterialCode' => $MaterialCode, 'Transaction_type' => 'Add', 'Ref_Type' => 'IGR', 'SupplierID' => $SupplierID, 'Quantity' => $QuantityAsPerInvoice, 'ItemValue' => $itemRate, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt); @@ -797,77 +766,52 @@ class Emergencypurchaseorder extends BaseController } - //$myfile = array('FilePath'=>$filename); - // $emergencyitemcode = $this->request->getPost('emergencyitemcode'.$i); - // ($this->request->getPost('materialCode'.$i)); - } - $counts = $this->request->getPost('hidecounter'); - $constants = $this->request->getPost('hideconstant'); + $revenueFilesLength = $this->request->getPost('revenueFilesLength'); + $serviceFilesLength = $this->request->getPost('serviceFilesLength'); $file = $this->request->getFiles(); - - dd($file); $arr = []; $prefile = array(); - for ($i = 1; $i <= $constants; $i++) { + $listOfFiles = 0 ; + + if($revenueFilesLength > 0){ $listOfFiles = $revenueFilesLength ;} + if($serviceFilesLength > 0){ $listOfFiles = $serviceFilesLength ;} + + + + for ($i = 1; $i <= $listOfFiles; $i++) { $file = $this->request->getFile('browseFiles' . $i); $requestfilename = $file->getName(); - + if (!empty($requestfilename)) { - - $files = str_replace(" ", "", $requestfilename); - - $fcount = 0; - - foreach ($prefile as $value) { - - - if ($value == $files) { - - - $fcount++; - } - } - - if ($fcount == 0) { - if ($file->isValid() && !$file->hasMoved()) { + + if ($file->isValid() && !$file->hasMoved()){ $path = ROOTPATH.'public/uploads/BillFiles/'; - if(!is_dir($path)) { mkdir($path, 0777, true); } + if(!is_dir($path)) { mkdir($path, 0777, true);} $Picture = $file->getName(); $file->move($path,$Picture); - } - //echo $Picture; - $arr[] = array($Picture); - } + } - $prefile[] = $files; + $arr[] = array($Picture); + + $prefile[] = trim($requestfilename); } } if (!empty($arr)) { - foreach ($arr as $ma) { - - - $index = 0; - $filename = null; - foreach ($ma as $key => $value) { - $index++; - if ($index == 1) { - $filename = $value; - } - } - if (!empty($filename)) { - + foreach ($arr as $filename) { $myfile = array('FilePath' => $filename, 'PONO' => $PONO, 'IGRNO' => $IGRNO); $this->purchaseorder_model->fileupload($myfile); - } } } + + + } diff --git a/app/Views/alterpurchaseorder.php b/app/Views/alterpurchaseorder.php index 987c7ea5..8e62d866 100755 --- a/app/Views/alterpurchaseorder.php +++ b/app/Views/alterpurchaseorder.php @@ -1422,8 +1422,6 @@ if (!empty($INRSYMBOL)) { function SpecialPOcheck() { - // alert('splpo') - //$('#content').loader('show'); POcheck = $("input:radio[name='Quality']:checked").val(); console.log(POcheck); @@ -1432,24 +1430,8 @@ if (!empty($INRSYMBOL)) { var row = $('#txtRowCount1').val(); var PO = $('#POType').val(); - // $('#hideconstants').val(counterConstants); - var file1 = $('#images1' + counterConstants).val() - var file = $('#imag' + counterConstant).val() - - // if(splrow!=row) - // { - // alert("You havent add all the material details") - // return false; - // } - - // else - // { if (PO == 'REVENUE') { - var images = $('#imag').val(); - - // $('#content').loader('show'); - if (POcheck == 0) { $('#txtSpecial').val(1); $('#txtQuality').val(1); @@ -4860,17 +4842,23 @@ if (!empty($INRSYMBOL)) {