From 1d6bf0206fa85ce148c44d8441f534d6e1473f91 Mon Sep 17 00:00:00 2001 From: gandhimathi Bharathirajan Date: Tue, 4 Jul 2017 11:44:41 +0530 Subject: [PATCH] 'Importoptionchange' --- application/models/purchaseorder_model.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 157042cd..419cc62b 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -30,10 +30,10 @@ class purchaseorder_model extends CI_Model * @return array $result : This is result */ -function purchaseorderListing($forwhat='') +function purchaseorderListing() { $this->db->distinct(); - $this->db->select('POMast.PONO,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Stat.StatusCode,Req.ReqType,DeliveryDate,DeliverySchedule,DeliveryOption'); + $this->db->select('POMast.PONO,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Stat.StatusCode,POMast.POType as ReqType,DeliveryDate,DeliverySchedule,DeliveryOption'); $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'); @@ -169,10 +169,15 @@ function purchaseorderListing($forwhat='') return $query->result_array(); */ - $subQuery ='select BudgetAmount, (select ifnull(sum(TotalOrderValue),0) as Totalvalue from + /* $subQuery ='select BudgetAmount, (select ifnull(sum(TotalOrderValue),0) as Totalvalue from T_PurchaseOrder_Master PO join T_PurchaseOrder_LineItem Item on Item.PONO = PO.PONO join T_Requestion_Master mast on mast.ReqNo = Item.ReqNo where Item.CostCenterCode=? and mast.ReqType=?)as Totalvalue from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and + BudgetYear = ? and BudgetType =?'; */ + + $subQuery ='select BudgetAmount, (select ifnull(sum(Quantity*Rate),0) as Totalvalue from + T_PurchaseOrder_LineItem Item join T_Requestion_Master mast on mast.ReqNo = Item.ReqNo where Item.CostCenterCode=? and mast.ReqType=?)as Totalvalue + from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and BudgetYear = ? and BudgetType =?'; $query = $this->db->query($subQuery,array($CostCode,$BudgetType,$CostCode,$Year,$BudgetType)); @@ -446,7 +451,7 @@ function purchaseorderListing($forwhat='') 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,POMast.PaymentTerms,POMast.PaymentDays,POMast.PayableAT,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus'); + $this->db->select('ReqNo,POMast.PONO,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.PaymentDays,POMast.PayableAT,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*'); $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'); @@ -622,9 +627,10 @@ 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,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((ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType, + 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 join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo @@ -1032,9 +1038,10 @@ function getCapitalPurchaseOrderDetails($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((ServiceTax.ServiceTax + ServiceTax.EducessTax + ServiceTax.SecHigherEducessTax + ServiceTax.KrishiKalyantax + ServiceTax.SwachhBharattax),2) as ServiceTaxamount ,ServiceTax.TotalValue,ServiceTax,EducessTax,ServiceTax.SecHigherEducessTax,ServiceTax.KrishiKalyantax,ServiceTax.SwachhBharattax, - ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,CurrencyType, + 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((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,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 join T_Service_Tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo