File: /home/cafsindia/allyindian_com/backend/application/models/Cancelation_model.php
<?php
class Cancelation_model extends CI_Model
{
public function search($search,$rows = 0,$limit_from= 0,$sort='cancelfeeid',$order='asc'){
$this->db->select('*');
$this->db->from('cancelfee');
$this->db->group_start();
$this->db->like('cancelfeeid',$search);
$this->db->or_like('cancelfeedetail',$search);
$this->db->group_end();
$this->db->order_by('cancelfeeid',$order);
$this->db->where('status',1);
if($rows>0){
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
public function GetInfo($cancelfeeid){
$this->db->from('cancelfee');
$this->db->where('cancelfeeid',$cancelfeeid);
$a=$this->db->get();
if($a->num_rows() === 1){
return $a->row();
}else{
foreach ($this->db->list_fields('cancelfee') as $field){
$PersonObj->field= '';
}
return $PersonObj;
}
}
public function get_found_rows($search){
$this->db->select('*');
$this->db->from('cancelfee');
$this->db->where('status',1);
return $this->db->get()->num_rows();
}
// public function exist($cancelfee_data)
// {
// $this->db->from('cancelfee');
// $cancelfeedetail = array('cancelfeedetail'=>$cancelfee_data['cancelfeedetail']);
// $this->db->where($cancelfeedetail);
// return $this->db->get()->num_rows();
// }
public function SaveCode(&$cancelfee_data,$cancelfeeid= FALSE){
if(!$this->present($cancelfeeid,'True')||!$cancelfeeid){
if($this->db->insert('cancelfee',$cancelfee_data)){
$BankData['cancelfeeid']=$this->db->insert_id();
return true;
}
return False;
}
$this->db->where('cancelfeeid',$cancelfeeid);
return $this->db->update('cancelfee',$cancelfee_data);
}
public function present($cancelfeeid){
$this->db->from('cancelfee');
$this->db->where('cancelfeeid',$cancelfeeid);
return $this->db->get()->num_rows();
}
public function delete_list($cancelfee_ids){
$this->db->where_in('cancelfeeid',$cancelfee_ids);
return $this->db->update('cancelfee',array('status'=>0));
}
}
?>