diff --git a/app/Controllers/Amendmentpurchaseorder.php b/app/Controllers/Amendmentpurchaseorder.php index b61ba103..4d154ed3 100644 --- a/app/Controllers/Amendmentpurchaseorder.php +++ b/app/Controllers/Amendmentpurchaseorder.php @@ -291,19 +291,25 @@ class Amendmentpurchaseorder extends BaseController $POMaster = array('PONO' =>$AmendmentNewPoNo,'ParentPO' => $PONO, 'SupplierID' => $SupplierID, 'POType' => $POType, 'PORange' => $PoRange, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => PO_RELEASED, 'PaymentTerms' => $PaymentTerms, 'PaymentOtherDescription' => $Otherpayment, 'Mode_Of_Shipment' => $Modeofshipment, 'Supplier_Reference' => $supplierreference, 'Supplier_Offer_No' => $supplieroffno, 'Other_Reference' => $otherreference, 'Fincap' => $fincap, 'InsuranceStatus' => $insurancestatus, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $revenuetype, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpecialInstruction, 'CreatedBy' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'UpdatedOn' => $updateddt, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'AmendedDetails' => $MAD, 'IsQualityChkReqired' => $qtycheckresult); $file = $this->request->getFile('POFile'); - $requestfilename = $file->getName(); + $requestfilename = $file->getName(); + $PrePOFile = $this->request->getPost('PrePOFile'); if (!empty($requestfilename)) { - if ($file && $file->isValid() && !$file->hasMoved()) { - $path = ROOTPATH.'public/uploads/POfiles/'; - if(!is_dir($path)) { mkdir($path, 0777, true); } - if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { - log_message('error', 'File already exists in the database'.$requestfilename); - } - else{ - $file->move($path, $requestfilename); - $POMaster['POFile'] = $requestfilename; - } - } + if ($file && $file->isValid() && !$file->hasMoved()) { + $path = ROOTPATH.'public/uploads/POfiles/'; + if(!is_dir($path)) { mkdir($path, 0777, true); } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + else{ + $file->move($path, $requestfilename); + $POMaster['POFile'] = $requestfilename; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; } $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster, $updatedBy, $PONO); if (count($LastPO) > 0) { @@ -636,21 +642,27 @@ class Amendmentpurchaseorder extends BaseController } $AmendmentNewPoNo = generate_amendment_po_number($PONO); - $POMaster = array('PONO' =>$AmendmentNewPoNo,'ParentPO' => $PONO, 'POType' => $POType, 'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => PO_RELEASED, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $scopeofwork, 'CreatedBy' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'PaymentOtherDescription' => $Otherpayment, 'ServiceWorkStatus' => $WorkStatus, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'AmendedDetails' => $MAD, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'IsQualityChkReqired' => $qtycheckresult); + $POMaster = array('PONO' =>$AmendmentNewPoNo,'ParentPO' => $PONO, 'POType' => $POType, 'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => PO_RELEASED, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $scopeofwork, 'CreatedBy' => $updatedBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $updateddt, 'PaymentTerms' => $PaymentTerms, 'PaymentOtherDescription' => $Otherpayment, 'ServiceWorkStatus' => $WorkStatus, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'AmendedDetails' => $MAD, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => strip_tags((string)$DescriptionOfPo), 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'IsQualityChkReqired' => $qtycheckresult); $file = $this->request->getFile('POFile'); + $PrePOFile = $this->request->getPost('PrePOFile'); $requestfilename = $file->getName(); if (!empty($requestfilename)) { if ($file && $file->isValid() && !$file->hasMoved()) { $path = ROOTPATH.'public/uploads/POfiles/'; if(!is_dir($path)) { mkdir($path, 0777, true); } - if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { - log_message('error', 'File already exists in the database'.$requestfilename); - } - else{ - $file->move($path, $requestfilename); - $POMaster['POFile'] = $requestfilename; - } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + else{ + $file->move($path, $requestfilename); + $POMaster['POFile'] = $requestfilename; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; } $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster, $updatedBy, $PONO); @@ -953,18 +965,24 @@ class Amendmentpurchaseorder extends BaseController $POMaster = array('PONO' =>$AmendmentNewPoNo,'ParentPO' => $PONO, 'SupplierID' => $SupplierID, 'TotalOrderValue' => $FinalTotalOrder, 'POType' => $POType, 'PODate' => $PODate, 'Status' => PO_RELEASED, 'CapitalRange' => $PoRange, 'ExchangeRate' => $ExchangeRate, 'ExchangeRateCalculatedon' => $ExchangeRateOn, 'PaymentTerms' => $PaymentMethod, 'PaymentOtherDescription' => $Otherpayment, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'CurrencyType' => $currencytypeID, 'AmendedDetails' => $MAD, 'Import_DispatchDetails' => $curdispatch, 'Import_PlaceofOrgin' => $PlaceOforigin, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'IsQualityChkReqired' => $qtycheckresult); $file = $this->request->getFile('POFile'); $requestfilename = $file->getName(); + $PrePOFile = $this->request->getPost('PrePOFile'); if (!empty($requestfilename)) { if ($file && $file->isValid() && !$file->hasMoved()) { $path = ROOTPATH.'public/uploads/POfiles/'; if(!is_dir($path)) { mkdir($path, 0777, true); } - if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { - log_message('error', 'File already exists in the database'.$requestfilename); - } - else{ - $file->move($path, $requestfilename); - $POMaster['POFile'] = $requestfilename; - } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + else{ + $file->move($path, $requestfilename); + $POMaster['POFile'] = $requestfilename; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; } @@ -1341,6 +1359,27 @@ class Amendmentpurchaseorder extends BaseController } $AmendmentNewPoNo = generate_amendment_po_number($PONO); $POMaster = array('PONO' =>$AmendmentNewPoNo,'ParentPO' => $PONO, 'SupplierID' => $SupplierID, 'POType' => $POType, 'TotalOrderValue' => $TotalOrder, 'PODate' => $PODate, 'Status' => $POStatus, 'PORange' => $PoRange, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'Import_DispatchDetails' => $Dispatch, 'CreatedDate' => $createddt, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ExchangeRate' => $Exchangerate, 'ExchangeRateCalculatedon' => $ExchangeRateCalculatedon, 'CurrencyType' => $CurrencyType, 'PaymentTerms' => $PaymentTerms, 'ReleasedBy' => $updatedBy, 'ReleasedOn' => $updateddt, 'Import_PlaceofOrgin' => $Palaceoforigin, 'Mode_Of_Shipment' => $Shipmentmode, 'Supplier_Reference' => $SupplierRef, 'Supplier_Offer_No' => $SupplierOffer, 'Other_Reference' => $otherRef, 'Fincap' => $finCap, 'AmendedDetails' => $MAD, 'PaymentOtherDescription' => $OtherPayment, 'InsuranceStatus' => $insurestatus, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $importoption, 'IsQualityChkReqired' => $qtycheckresult); + $file = $this->request->getFile('POFile'); + $requestfilename = $file->getName(); + $PrePOFile = $this->request->getPost('PrePOFile'); + if (!empty($requestfilename)) { + if ($file && $file->isValid() && !$file->hasMoved()) { + $path = ROOTPATH.'public/uploads/POfiles/'; + if(!is_dir($path)) { mkdir($path, 0777, true); } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + else{ + $file->move($path, $requestfilename); + $POMaster['POFile'] = $requestfilename; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } + }else{ + $POMaster['POFile'] = $PrePOFile ? $PrePOFile : null; + } $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster, $CreateBy, $PONO); $NewPO = ''; // if (count($LastPO) > 0) { diff --git a/app/Controllers/Emergencypurchaseorder.php b/app/Controllers/Emergencypurchaseorder.php index d76f84e0..671ee3ed 100644 --- a/app/Controllers/Emergencypurchaseorder.php +++ b/app/Controllers/Emergencypurchaseorder.php @@ -208,7 +208,26 @@ class Emergencypurchaseorder extends BaseController $newPONO = generate_po_number($lastPONO); // PO Master $POList = array('PONO'=>$newPONO,'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'PaymentTerms' => $PaymentTerms, 'ServiceWorkStatus' => $ServiceWorkStatus, 'POType' => $POType, 'PaymentOtherDescription' => $OtherPayment, 'Supplier_Reference' => $SupplierReference, 'Mode_Of_Shipment' => $ModeOfShipment, 'Supplier_Offer_No' => $SuppliersOfferNo, 'Other_Reference' => $OtherReferences, 'Fincap' => $Fincap, 'Description_Of_Service' => $DescriptionOfPo, 'InsuranceStatus' => $InsuranceOptions, 'InsuranceNumber' => $InsuranceNumber, 'POSubType' => $ServiceTypeOptions, 'BudgetType' => $BudgetType,'IsOpenOrder'=>$IsOpenOrder); - + $file = $this->request->getFile('POFile'); + $requestfilename = $file->getName(); + if (!empty($requestfilename)) { + + if ($file->isValid() && !$file->hasMoved()) { + $path = ROOTPATH.'public/uploads/POfiles/'; + if(!is_dir($path)) { mkdir($path, 0777, true); } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POList['POFile'] = NULL; + }else{ + $file->move($path, $requestfilename); + $POList['POFile'] = $requestfilename; + } + }else{ + $POList['POFile'] = NULL; + } + + } + $POMaster = $this->purchaseorder_model->addPOMaster($POList, $POType, $ServiceTypeOptions); $PONO = $POMaster ? $newPONO : ""; @@ -463,7 +482,25 @@ class Emergencypurchaseorder extends BaseController $lastPONO = $this->purchaseorder_model->lastPONO(); $newPONO = generate_po_number($lastPONO); $POList = array('PONO'=>$newPONO,'SupplierID' => $SupplierID, 'TotalOrderValue' => $TotalOrderValueSummary, 'PODate' => $PODate, 'Status' => $POStatus, 'DeliverySchedule' => $DeliverySchedule, 'DeliveryOption' => $DeliveryOption, 'PORange' => $Local_Interstate, 'ServiceDescription' => $SpcialInstruction, 'CreatedBy' => $CreateBy, 'DeliveryAddress' => $DeliveryAddr, 'DeliveryDate' => $Deliverydt, 'CreatedDate' => $createddt, 'PaymentTerms' => $PaymentTerms, 'POType' => $POType, 'CapitalRange' => $Local_Interstate, 'PaymentOtherDescription' => $OtherPayment, 'Mode_Of_Shipment' => $Modeofshipment, 'Supplier_Offer_No' => $supplieroffno, 'Supplier_Reference' => $supplierreference, 'Other_Reference' => $otherreference, 'InsuranceNumber' => $InsuranceNumber, 'InsuranceStatus' => $insurancestatus, 'Fincap' => $fincap, 'POSubType' => $revenuetype, 'IsQualityChkReqired' => $Qualitycheck, 'BudgetType' => $BudgetType,'IsOpenOrder'=>$IsOpenOrder); - //print_r($POList); + $file = $this->request->getFile('POFiles'); + $requestfilename = $file->getName(); + if (!empty($requestfilename)) { + + if ($file->isValid() && !$file->hasMoved()) { + $path = ROOTPATH.'public/uploads/POfiles/'; + if(!is_dir($path)) { mkdir($path, 0777, true); } + if (!empty($this->purchaseorder_model->isFileExists($requestfilename))) { + log_message('error', 'File already exists in the database'.$requestfilename); + $POList['POFile'] = NULL; + }else{ + $file->move($path, $requestfilename); + $POList['POFile'] = $requestfilename; + } + }else{ + $POList['POFile'] = NULL; + } + + } $POMaster = $this->purchaseorder_model->addPOMaster($POList, $POType, $revenuetype); $PONO = $POMaster ? $newPONO : ""; // $PONO = ''; @@ -847,7 +884,7 @@ class Emergencypurchaseorder extends BaseController //$this->purchaseorder_model->UpdateRequistItemStatus(); $this->purchaseorder_model->UpdateRequistionStatus(); $data['POData'] = $this->purchaseorder_model->purchaseorderListing(); - + print_r($data['POData']);die; $this->global['pageTitle'] = 'Purchase Orders'; $this->loadViews("POlist", $this->global, $data, NULL); diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index 4539a280..89944b62 100644 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -2436,8 +2436,11 @@ $mpdf->use_kwt = true; // $data['Status']= $this->purchaseorder_model->getStatus(); $userID = $this->session->get('userId'); //print_r($data['Status']);echo "CON"; - $data['AppList'] = $this->purchaseorder_model->getPOList($q); - + $appList = $this->purchaseorder_model->getPOList($q); + $filteredAppList = array_filter($appList, function($item) { + return $item->Status !== PO_DRAFT; + }); + $data['AppList'] = $filteredAppList; $this->loadViews("porelease_view", $this->global, $data, NULL); } diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index 22399862..c5f79f4f 100644 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -1418,8 +1418,8 @@ if (!empty($getlogpodtl)) {
@@ -2429,21 +2429,26 @@ if (!empty($getlogpodtl)) {