From 2ac3a878b5f6f8b66d108799c8ab91c288f8a39d Mon Sep 17 00:00:00 2001 From: gandhimathi Bharathirajan Date: Sun, 30 Jul 2017 03:41:24 +0530 Subject: [PATCH] Department Issue fixed --- application/models/purchaseorder_model.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 85b4b278..8ff6d3f2 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -242,8 +242,10 @@ function purchaseorderListing($forwhat='') 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 + $subQuery ='select BudgetAmount, (select ifnull(sum(Quantity*Rate)-tax.AfterDiscount,0) as Totalvalue from + T_PurchaseOrder_LineItem Item join T_Requestion_Master mast + on mast.ReqNo = Item.ReqNo left join T_Revenue_Tax tax on + tax.LineItemNo = Item.LineItemNo where Item.CostCenterCode=? and mast.ReqType=?)as Totalvalue from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and BudgetYear = ? and BudgetType =?'; @@ -253,7 +255,7 @@ function purchaseorderListing($forwhat='') } - + function GetAvailableImportBudgetAmount($CostCode,$Year,$BudgetType) { $subQuery='select BudgetAmount,(select ifnull(sum((Quantity*Rate*ExchangeRate)),0)as TValue from T_PurchaseOrder_LineItem LineItem @@ -1242,13 +1244,14 @@ function GetCurrencytype() $this->db->from('T_PurchaseOrder_Master mast'); // $this->db->order_by('mast.Status',"PO_CREATED"); $this->db->join('T_Status st', 'st.StatusCode=mast.Status'); - $this->db->join('tbl_users tbl', 'mast.createdby=tbl.userid'); - $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid'); - $this->db->join('T_DepartmentDetails as Dep','Dep.DEPCode=emp.Departmentcode'); + $this->db->join('T_PurchaseOrder_LineItem req', 'req.PONO= mast.PONO'); $this->db->join('T_Requestion_Master rmast','rmast.ReqNo=req.ReqNo'); //$this->db->join('T_CostCenter_Budget bud','bud.CostCenterCode = req.CostCenterCode and bud.BudgetType = rmast.ReqType'); $this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode'); + $this->db->join('tbl_users tbl', 'rmast.createdby=tbl.userid'); + $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid'); + $this->db->join('T_DepartmentDetails as Dep','Dep.DEPCode=emp.Departmentcode'); // $this->db->where('mast.Status',PO_AMENDED); // EMERGENGY PO if($Amendment=='A'){ //A- Approved $this->db->or_where('mast.Status',PO_CREATED);//PO CREATED