diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index 93783349..95543c8c 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -565,8 +565,8 @@ function GetPOType($ReqNo) // print_r($this->db->last_query()); if($insert_id>0) { - $subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where POType=? and POSubType=?'; - + //$subQuery = 'select max(PONO) as PONO from T_PurchaseOrder_Master where POType=? and POSubType=?'; + $subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? order by CreatedDate desc limit 1'; $query = $this->db->query($subQuery,array($POType,$POSubtype)); return $query->result_array();