From 3974533a8d53e3e9e0606cb5391b075665ff3e25 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 29 Jun 2017 13:28:32 +0530 Subject: [PATCH] import po edit --- application/controllers/purchaseorder.php | 49 +++++++++++++++++-- application/models/purchaseorder_model.php | 13 ++++- application/views/editimportpo.php | 55 ++++++++++++++++++--- application/views/importpo.php | 56 ++++++++++++++-------- application/views/purchaseorder.php | 2 + 5 files changed, 143 insertions(+), 32 deletions(-) diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index e70cf170..59ec12c9 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -253,6 +253,22 @@ class purchaseorder extends BaseController Start here */ $ReqDetails = $this->purchaseorder_model->getRequistDetails($ReqArray); $data['RequistionDetails'] = $ReqDetails; + foreach ($data['RequistionDetails'] as $ReqDet) + { + + $Status=$ReqDet->Status; + } + + //print_r($Status); + $data['POSTATUS']=$this->purchaseorder_model->GetPOStatus($Status); + //print_r($data['POSTATUS']); + + foreach ($data['POSTATUS'] as $POST) + { + $Status=$POST->StatusName; + } + + //print_r($Status); $CostCode = ''; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); @@ -272,6 +288,8 @@ class purchaseorder extends BaseController /* End Here */ $data['POMaster'] = $this->purchaseorder_model->GetServicePurchaseOrder($PONO); + + //$data['POSTATUS']=$this->purchaseorder_model->GetServicePurchaseOrder($PONO); //print_r($data['POMaster']); foreach ($data['POMaster'] as $Exc) { @@ -964,7 +982,20 @@ function addNewImportPurchaseOrder() $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; } - + + $PaymentDate=$this->input->post('Payment'); + if($PaymentDate==1) + { + $PaymentDays='After'; + } + else + { + $PaymentDays='Before'; + } + + //echo $PaymentDays; + //die(); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); $TotalOrder = $this->input->post('txtToatlOrder'); $POStatus = $this->input->post('textStatus'); @@ -988,9 +1019,9 @@ function addNewImportPurchaseOrder() - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays); - //print_r($POList); + //print_r($POList);PaymentDays //die(); $POMaster = $this->purchaseorder_model->addPOMaster($POList); @@ -1129,7 +1160,15 @@ $createddt=''; $Deliverydt = $this->getDateformat($dt); $DeliverySchedule = ''; } - + $PaymentDate=$this->input->post('Payment'); + if($PaymentDate==1) + { + $PaymentDays='After'; + } + else + { + $PaymentDays='Before'; + } $SpcialInstruction = $this->input->post('txtSpcialInstruction'); $TotalOrder = $this->input->post('txtToatlOrder'); @@ -1147,7 +1186,7 @@ $createddt=''; $Payableat=$this->input->post('PayableAT'); // PO Master // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrder,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'ExchangeRate'=>$Exchangerate,'ExchangeRateCalculatedon'=>$ExchangeRateCalculatedon,'CurrencyType'=>$CurrencyType,'PaymentTerms'=>$PaymentTerms,'PayableAT'=>$Payableat,'PaymentDays'=>$PaymentDays); //echo $PONO; //echo $TotalOrder; //print_r($POList); diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 5746c3a4..40e3e57b 100644 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -188,7 +188,7 @@ function purchaseorderListing() function getRequistDetails($ReqNoList='') { $this->db->distinct(); - $this->db->select('ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName,mast.ReqDate,mast.CostCenterCode'); + $this->db->select('ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName,mast.ReqDate,mast.CostCenterCode,mast.Status'); $this->db->from('T_Requestion_Master mast'); $this->db->join('T_Employee_Details emp', 'mast.Requestedby = emp.EmpID'); $this->db->join('T_DepartmentDetails Dept', 'emp.Departmentcode = Dept.DEPCode'); @@ -443,7 +443,7 @@ function purchaseorderListing() function GetServicePurchaseOrder($PONO = '') { $this->db->distinct(); - $this->db->select('ReqNo,POMast.PONO,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,Stat.StatusCode,POMast.ExchangeRateCalculatedon,POMast.ExchangeRate,POMast.CurrencyType,POMast.PaymentTerms,POMast.PayableAT'); + $this->db->select('ReqNo,POMast.PONO,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,Stat.StatusCode,POMast.ExchangeRateCalculatedon,POMast.ExchangeRate,POMast.CurrencyType,POMast.PaymentTerms,POMast.PayableAT,POMast.PaymentDays'); $this->db->from('T_PurchaseOrder_Master POMast'); $this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID'); $this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status'); @@ -571,6 +571,15 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '') } + function GetPOStatus($Status='') + { + $subQuery='SELECT StatusName from T_Status where StatusCode=?'; + $query=$this->db->query($subQuery,array($Status)); + return $query->result(); + + } + + function GetPaymentTerms($PONO='') { $subQuery='SELECT PaymentTerms from T_PurchaseOrder_Master where PONO=?'; diff --git a/application/views/editimportpo.php b/application/views/editimportpo.php index 9fd87470..c9ea08fc 100644 --- a/application/views/editimportpo.php +++ b/application/views/editimportpo.php @@ -107,9 +107,32 @@ if(!empty($POMaster)) $ExchangeRateCalculatedon=$Req->ExchangeRateCalculatedon; $PaymentTerms=$Req->PaymentTerms; $PayableAT=$Req->PayableAT; + $PaymentDays=$Req->PaymentDays; } } + +//echo $PaymentDays; + + +if(!empty($RequistionDetails)) +{ + + foreach ($RequistionDetails as $ReqDet) + { + $Reqon=$ReqDet->ReqDate; + $Requestedby=$ReqDet->Requestedby; + //$Status=$ReqDet->Status; + } +} + + +foreach ($POSTATUS as $PST ) +{ + $POStatus=$PST->StatusName; +} + +//echo "$POStatus"; ?>