From c119edbe84caab9f509808dd0addcac8b4bb2dde Mon Sep 17 00:00:00 2001 From: gandhimathi Bharathirajan Date: Wed, 12 Jul 2017 15:22:00 +0530 Subject: [PATCH] Amendment issue --- application/models/purchaseorder_model.php | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index e8725a99..4d3214c0 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -43,6 +43,11 @@ function purchaseorderListing($forwhat='') { $this->db->where('POMast.Status',PO_RELEASED); } + else + { + $this->db->where('POMast.Status !=',PO_AMENDED); + // $this->db->order_by('POMast.Status !=',PO_AMENDED); + } $query = $this->db->get(); //print_r( $this->db->last_query()); $result = $query->result(); @@ -377,6 +382,24 @@ function purchaseorderListing($forwhat='') } + function addAmendPOMaster($POMaster,$CreatedBy,$ParentPO) + { + // print_r($POMaster); + $this->db->trans_start(); + $this->db->insert('T_PurchaseOrder_Master', $POMaster); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + if($insert_id>0) + { + $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=?'; + + $query = $this->db->query($subQuery,array($CreatedBy,$ParentPO)); + + return $query->result_array(); + } + } + /** * This function is used to add New Purchase order Line Item to the system */ @@ -605,7 +628,7 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '') { $subQuery='SELECT * from T_Currency_Details where Currency_Code=?'; $query=$this->db->query($subQuery,array($Currencycode)); - + //print_r($this->db->last_query()); return $query->result(); } @@ -670,8 +693,7 @@ function GetImportPurchaseOrderDetails($PONO = '') $subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName, Mat.UOM,Quantity,Rate,Req.Status,ROUND((Quantity *Rate),2 ) as BasicValue , - ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((Quantity *Rate)+(RMCIncludingCustomersPerKG*Quantity),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,ReceivedQuantity, - + ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((Quantity *Rate)+(RMCIncludingCustomersPerKG*Quantity),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType, Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode @@ -727,7 +749,7 @@ function GetCurrencytype() // To update Parent PO as Amended PO function updateAmendPOMaster($PONO,$PODetail) { - //echo $PONO."from model"; + echo $PONO."from model"; $this->db->where('PONO', $PONO);