<?php
class Branches_model extends CI_Model
{
  function __construct()
  {
    parent::__construct();
  }
  public function select_branches($columns='*',$data='')
  {
    $this->db->select($columns)->from('branches b');
    $this->db->join('tax_state_codes tsc','tsc.state_id=b.tax_state_id','left');
    if(!empty($data)){
      $this->db->where($data);
    }
    $this->db->where("b.delete_status",0);
    $query = $this->db->get();
    return $query;
  }
  public function create_branch($data){
    $query = $this->db->insert('branches', $data);
    $result=array();
    $result['insert_id']=$this->db->insert_id();
    $result['status']=$query;
    return $result;
  }
  public function update_branch($data)
  {
    $this->db->where('branch_id', $data['branch_id']);
    $query=$this->db->update('branches', $data);
    return $query;
  }

}
?>
