<?php
class Data_model extends CI_Model
{
  function __construct()
  {
    parent::__construct();
  }

  public function select_meter_makes($columns = "*", $data = "")
  {
    $this->db->select($columns)->from('data_meter_makes');
    if (!empty($data)) {
      $this->db->where($data);
    }
    $query = $this->db->get();
    return $query;
  }
  public function insert_meter_makes($data)
  {
    $query = $this->db->insert('data_meter_makes', $data);
    $result = array();
    $result['insert_id'] = $this->db->insert_id();
    $result['status'] = $query;
    return $result;
  }
  public function update_meter_makes($data)
  {
    $this->db->where('meter_id', $data['meter_id']);
    $query = $this->db->update('data_meter_makes', $data);
    return $query;
  }

  public function select_companies($columns = "*", $data = "")
  {
    $this->db->select($columns)->from('companies');
    if (!empty($data)) {
      $this->db->where($data);
    }
    $query = $this->db->get();
    return $query;
  }
  public function insert_companies($data)
  {
    $query = $this->db->insert('companies', $data);
    $result = array();
    $result['insert_id'] = $this->db->insert_id();
    $result['status'] = $query;
    return $result;
  }
  public function update_companies($data)
  {
    $this->db->where('company_id ', $data['company_id']);
    $query = $this->db->update('companies', $data);
    return $query;
  }
}
