db->select('*'); $this->db->from('T_MaterialMaster'); if(!empty($searchText)) { $likeCriteria = "(MaterialCode LIKE '%".$searchText."%' OR MaterialName LIKE '%".$searchText."%' OR MaterialType LIKE '%".$searchText."%' OR UOM LIKE '%".$searchText."%')"; $this->db->where($likeCriteria); } //$this->db->where('BaseT.isDeleted', 0); //$this->db->where('BaseT.userId !=', 1); $query = $this->db->get(); return count($query->result()); } /** * This function is used to get the user listing count * @param string $searchText : This is optional search text * @param number $page : This is pagination offset * @param number $segment : This is pagination limit * @return array $result : This is result */ function rawmaterialListing($searchText = '', $page, $segment) { $this->db->select('*'); $this->db->from('T_MaterialMaster'); if(!empty($searchText)) { $likeCriteria = "(MaterialCode LIKE '%".$searchText."%' OR MaterialName LIKE '%".$searchText."%' OR MaterialType LIKE '%".$searchText."%' OR UOM LIKE '%".$searchText."%')"; $this->db->where($likeCriteria); } $this->db->limit($page, $segment); $query = $this->db->get(); $result = $query->result(); return $result; } function getUOM($UOM = '') { $ConfigID = 'C001'; $this->db->select('ConfigValue'); $this->db->from('T_ConfigDetails'); $this->db->where('Config_id ',$ConfigID ); if($UOM != '') { $this->db->where('ConfigValue !=',$UOM ); } $query = $this->db->get(); return $query->result(); } function getmaterialType($MaterialType = '') { $Config_ID = 'C003'; $this->db->select('Config_ID,ConfigValue'); $this->db->from('T_ConfigDetails'); $this->db->where('Config_id',$Config_ID ); if($MaterialType != '') { $this->db->where('ConfigValue !=',$MaterialType ); } $query = $this->db->get(); return $query->result(); } /** * This function used to get user information by id * @param number $userId : This is user id * @return array $result : This is user information */ function addNewRawMaterial($RawMaterial='') { $this->db->insert('T_MaterialMaster', $RawMaterial); return TRUE; } /** * This function used to get user information by id * @param number $userId : This is user id * @return array $result : This is user information */ function getMaterialDetails($MaterialCode) { $this->db->select('*'); $this->db->from('T_MaterialMaster'); $this->db->where('MaterialCode', $MaterialCode); $query = $this->db->get(); //sprint_r($this->db->last_query()); return $query->result(); } function editRawmaterial($RawMaterial, $MaterialCode) { $this->db->where('MaterialCode', $MaterialCode); $this->db->update('T_MaterialMaster', $RawMaterial); return TRUE; } function viewrawmaterial($RawMaterial, $MaterialCode) { echo $MaterialCode; //."and".$RawMaterial ; $this->db->where('MaterialCode', $MaterialCode); $this->db->update('T_MaterialMaster', $RawMaterial); return TRUE; } /** * This function is used to delete the user information * @param number $userId : This is user id * @return boolean $result : TRUE / FALSE function deletePO($PO, $POinfo) { $this->db->where('PO', $PO); $this->db->update('T_PurchaseOrderDetails', $POInfo); return $this->db->affected_rows(); }*/ } ?>