Status change

This commit is contained in:
gandhimathi Bharathirajan 2017-08-16 10:57:30 +05:30
parent 0f5b870d64
commit b62bdfb824

View File

@ -310,14 +310,35 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
function UpdatePOMaster($PONO,$PoMrirStatus,$updatedBy)
{
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',MRIR_APPROVED);
$query = $this->db->get();
$ApprovedCnt = $query->num_rows;
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',MRIR_REJECTED);
$query1 = $this->db->get();
$RejectedCnt = $query1->num_rows;
if ($ApprovedCnt == 0) {
$this->db->where('PONO', $PONO);
$POStatus = array('status'=>$PoMrirStatus,'UpdateBY'=>$updatedBy);
$POStatus = array('status'=>MRIR_APPROVED,'UpdateBY'=>$updatedBy);
$this->db->update('T_PurchaseOrder_Master', $POStatus);
}
elseif ($RejectedCnt == 0) {
$this->db->where('PONO', $PONO);
$POStatus = array('status'=>MRIR_REJECTED,'UpdateBY'=>$updatedBy);
$this->db->update('T_PurchaseOrder_Master', $POStatus);
}
return TRUE;
}
}
?>