File: //var/www/html/taxicamera/application/models/admin/Mcompany.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Mcompany extends CI_Model {
/*
Author: soumya Hazra
purpose: insert new car details
date:6-9-2019
*/
public function submitcompany($data)
{
$this->db->insert('master_company', $data);
return true;
}
/*
Author: soumya Hazra
purpose: get active company
date:6-9-2019
*/
public function get_company()
{
$result = array();
$this->db->select('mc.*,get_full_address_company(mc.company_id) as full_address');
$this->db->from('master_company mc');
$this->db->where('mc.company_status',1);
$this->db->order_by('mc.company_id','DESC');
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
/*
Author: soma
purpose: get inactive company
date:18-9-2019
*/
public function get_inactive_company()
{
$result = array();
$this->db->select('mc.*,get_full_address_company(mc.company_id) as full_address');
$this->db->from('master_company mc');
$this->db->where('mc.company_status',0);
$this->db->order_by('mc.company_id','DESC');
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
/*
Author: soumya Hazra
purpose: get single company
date:6-9-2019
*/
public function get_single_company($cid)
{
$result = array();
$this->db->select('*');
$this->db->from('master_company');
$this->db->where('company_id',$cid);
$query = $this->db->get();
$result = $query->row_array();
return $result;
}
/*
Author: soumya Hazra
purpose: get single company
date:6-9-2019
*/
public function updatecompany($cid,$data)
{
$result = array();
$this->db->select('*');
$this->db->from('master_company');
$this->db->where('company_id',$cid);
$this->db->update('master_company',$data);
return true;
}
/*
Author: soumya Hazra
purpose: Remove Company
date:6-9-2019
*/
public function delcompany($cid)
{
$this->db->set('company_status',0);
$this->db->where('company_id',$cid);
$this->db->update('master_company');
return true;
}
/*
author: soma
purpose: Set a company deactive
date: 18-9-2019
*/
public function set_deactive_company($company_id)
{
$this->db->set('company_status',0);
$this->db->set('updated_by',$this->session->userdata('user_data'));
$this->db->set('updated_ts',date('Y-m-d H:i:s'));
$this->db->where('company_id',$company_id);
$this->db->update('master_company');
// echo $this->db->last_query();die;
return true;
}
/*
author: soma
purpose: Set a company active
date: 18-9-2019
*/
public function set_active_company($company_id)
{
$this->db->set('company_status',1);
$this->db->set('updated_by',$this->session->userdata('user_data'));
$this->db->set('updated_ts',date('Y-m-d H:i:s'));
$this->db->where('company_id',$company_id);
$this->db->update('master_company');
return true;
}
/*
author: soma
purpose: delete company
date: 18-9-2019
*/
public function delete_company($company_id)
{
$this->db->set('is_delete',1);
$this->db->set('company_status',0);
$this->db->where('company_id',$company_id);
$this->db->update('master_company');
return true;
}
/*
author: soma
purpose: restore company
date: 18-9-2019
*/
public function restore_company($company_id)
{
$this->db->set('is_delete',0);
$this->db->set('company_status',1);
$this->db->where('company_id',$company_id);
$this->db->update('master_company');
return true;
}
}