diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php index 2ff0922a..c2ad4c3c 100755 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -39,6 +39,7 @@ class inwardgateregister_model extends CI_Model $this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO'); $this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID'); $this->db->where('POM.Status',PO_RELEASED); + $this->db->where('POM.POType !=',SERVICE); $this->db->or_where('POM.Status',IGR_CREATED); $this->db->or_where('POM.Status',MRIR_CREATED); @@ -146,13 +147,14 @@ class inwardgateregister_model extends CI_Model function UpdatePOMaster($PONO,$updatedBy) { - $this->db->select('Count(*) as cnt'); + $this->db->select('*'); $this->db->from('T_PurchaseOrder_LineItem'); $this->db->where('PONO',$PONO); $this->db->where('Status !=',IGR_CREATED); $query = $this->db->get(); - //print_r($this->db->last_query()); + + if ($query->num_rows == 0) { $this->db->where('PONO', $PONO); $POStatus = array('status'=>IGR_CREATED,'UpdateBY'=>$updatedBy);