File: /home/cafsindia/crm_cafsindia_com/application/models/Bank_model.php
<?php
class Bank_model extends CI_Model
{
public function GetInfo($bank_id)
{
$this->db->from('banks');
$this->db->where('bank_id',$bank_id);
$a=$this->db->get();
if($a->num_rows() === 1)
{
return $a->row();
}
else
{
foreach ($this->db->list_fields('banks') as $field)
{
$PersonObj->field= '';
}
return $PersonObj;
}
}
public function exist($bank_id)
{
$this->db->from('banks');
$a=array('bank_name'=>$bank_id['bank_name']);
$this->db->where($a);
return $this->db->get()->num_rows();
}
public function SaveCode(&$BankData,$bank_ids= FALSE)
{
if(!$this->present($bank_ids,'True')||!$bank_ids)
{
if($this->db->insert('banks',$BankData))
{
$BankData['bank_id']=$this->db->insert_id();
return true;
}
return False;
}
$this->db->where('bank_id',$bank_ids);
return $this->db->update('banks',$BankData);
}
public function present($bank_id)
{
$this->db->from('banks');
$this->db->where('bank_id',$bank_id);
return $this->db->get()->num_rows();
}
public function search($search,$rows = 0,$limit_from= 0,$sort='id',$order='asc')
{
$this->db->select('*');
$this->db->from('banks');
$this->db->where('status',1);
$this->db->group_start();
$this->db->like('bank_id',$search);
$this->db->or_like('bank_name',$search);
$this->db->group_end();
$this->db->order_by('bank_id',$order);
if($rows>0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
public function GetFoundRows($search)
{
$this->db->select('*');
$this->db->from('banks');
$this->db->where('status',1);
return $this->db->get()->num_rows();
}
public function delete_list($code_id)
{
$this->db->from('banks');
$this->db->where_in('bank_id',$code_id);
return $this->db->update('banks',array('status'=>0));
}
public function GetMultipleInfo($code_ids)
{
$this->db->from('banks');
$this->db->where_in('bank_id', $code_ids);
return $this->db->get()->result_array();
}
}
?>