diff --git a/application/controllers/report.php b/application/controllers/report.php index 6f01c19f..54e6001a 100644 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -128,7 +128,7 @@ class report extends BaseController public function purchase() { - $this->global['pageTitle'] = 'Resico : Reports'; + $this->global['pageTitle'] = 'Resico : Reports '; //$this->input->post('btn_submit'); $cname = $this->input->post('client_name'); $prod = $this->input->post('item_name'); @@ -244,7 +244,7 @@ class report extends BaseController public function purchase_supplier() { - $this->global['pageTitle'] = 'Resico : Reports'; + $this->global['pageTitle'] = 'Resico : Supplier-wise Reports'; //$this->input->post('btn_submit'); $cname = $this->input->post('client_name'); $ab=$this->input->post('financialyear'); @@ -266,7 +266,7 @@ class report extends BaseController public function consolidate() { - $this->global['pageTitle'] = 'Resico : Reports'; + $this->global['pageTitle'] = 'Resico : Consolidated Reports'; //$this->input->post('btn_submit'); $cname = $this->input->post('client_name'); $ab=$this->input->post('financialyear'); @@ -285,7 +285,7 @@ class report extends BaseController public function cumulative() { - $this->global['pageTitle'] = 'Resico : Reports'; + $this->global['pageTitle'] = 'Resico : Cumulative Reports'; //print_r($prod); @@ -296,7 +296,7 @@ class report extends BaseController public function cum_month() { - $this->global['pageTitle'] = 'Siddharth : Reports'; + $this->global['pageTitle'] = 'Resico : Cumulative Month-wise Reports'; $last = $this->uri->segment_array(); $sup = $last[3]; @@ -310,7 +310,7 @@ class report extends BaseController public function cum_year() { - $this->global['pageTitle'] = 'Siddharth : Reports'; + $this->global['pageTitle'] = 'Resico : Cumulative Year-wise Reports'; $last = $this->uri->segment_array(); $sup = $last[3]; @@ -325,7 +325,7 @@ class report extends BaseController public function cum_day() { - $this->global['pageTitle'] = 'Siddharth : Reports'; + $this->global['pageTitle'] = 'Resico : Cumulative Day-wise Reports'; $last = $this->uri->segment_array(); $sup = $last[3]; diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php index 29514826..e15251de 100644 --- a/application/models/assetdetails_model.php +++ b/application/models/assetdetails_model.php @@ -77,7 +77,8 @@ class assetdetails_model extends CI_Model $this->db->from('T_PurchaseOrder_Master POM'); //$this->db->join ('T_PurchaseOrder_LineItem POL ',' POL.PONO = POM.PONO'); //$this->db->join ('T_SupplierDetailsN sup ',' sup.SupplierID = POM.SupplierID'); - $this->db->where('POM.status',MRIR_APPROVED); + $this->db->where('POM.status',MRIR_APPROVED); + $this->db->where('POM.POType','CAPITAL'); if(!empty($PO)){ $this->db->where('POM.PONO',$PO); } @@ -139,22 +140,21 @@ class assetdetails_model extends CI_Model } function getlineitemcap($line){ - $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(ser.TotalValue+imp.TotalValue) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID'); - $this->db->from('T_PurchaseOrder_LineItem POL'); - $this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left'); - $this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left'); - $this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left'); - $this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left'); - $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left'); - $this->db->join ('T_Import_Tax imp','imp.LineItemNo = POL.LineItemNo','left'); - $this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left'); - $this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left'); - $this->db->where('POL.LineItemNo',$line); - - $query = $this->db->get(); - - $result = $query->result(); - return $result; + + $sql="SELECT POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(coalesce(ser.TotalValue,0) + coalesce((POL.Quantity*POL.Rate*POM.ExchangeRate),0)) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID + from T_PurchaseOrder_LineItem POL + left join T_Requestion_Master req on req.ReqNo = POL.ReqNo + left join T_PurchaseOrder_Master POM on POM.PONO= POL.PONO + left join T_MaterialMaster MM on MM.MaterialCode = POL.MaterialCode + left join T_Employee_Details emp on emp.EmpID = req.Requestedby + left join T_DepartmentDetails dep on dep.DEPCode = emp.Departmentcode + left join T_Service_Tax ser on ser.LineItemNo = POL.LineItemNo + left join T_Import_Tax imp on imp.LineItemNo = POL.LineItemNo + left join T_SupplierDetailsN sup on sup.SupplierID = POM.SupplierID + where POL.LineItemNo = ? "; + $query = $this->db->query($sql,array($line)); + return $query->result(); + } function gettyp($type) {