MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/allyindian_com/sbltt/application/models/Vendor_model.php
<?php
class Vendor_model extends CI_Model
{
	public function search($search,$rows = 0,$limit_from= 0,$sort='vendor_id',$order='asc'){
		$this->db->from('vendor');
		$this->db->where('vendor.status',1);
		$this->db->group_start();
		$this->db->like('vendor_id',$search);
		$this->db->or_like('vendor_name',$search);
		$this->db->group_end();
		$this->db->order_by('vendor_id',$order);
		if($rows>0)
		{
			$this->db->limit($rows, $limit_from);
		}
		return $this->db->get();
	}
	
	public function get_found_rows($search){
		$this->db->from('vendor');
		$this->db->where('status',1);
		return $this->db->get()->num_rows();
	}

	public function get_info($vendor_id)	
	{
		$this->db->from('vendor');
		$this->db->where('vendor_id',$vendor_id);
		$a=$this->db->get();
		if($a->num_rows() === 1)
		{
			return $a->row();
		
		}
		else
		{
			foreach ($this->db->list_fields('vendor') as $field)
			{
				$PersonObj->field= '';
			}
			return $PersonObj;
		}
	}

	public function exists($vendor_id){
		$this->db->from('vendor');
		$this->db->where('vendor_id', $vendor_id);

		return ($this->db->get()->num_rows() == 1);
	}

	/*
	Inserts or updates a vendor
	*/
	public function save_vendor(&$vendor_data, $vendor_id = FALSE){

		if(!$vendor_id || !$this->exists($vendor_id, TRUE))
		{
			if($this->db->insert('vendor', $vendor_data))
			{
				$vendor_data['vendor_id'] = $this->db->insert_id();

				return TRUE;
			}

			return FALSE;
		}

		$this->db->where('vendor_id', $vendor_id);

		return $this->db->update('vendor', $vendor_data);

}

	public function delete_list($vendor_id){
		$this->db->where_in('vendor_id',$vendor_id);
		return $this->db->update('vendor',array('status'=>0,'deleted_by'=>$this->session->userdata('emp_id'),'deleted_date'=>date('Y-m-d h:i:s')));
	}

	public function get_multiple_info($cat_ids){
		$this->db->from('vendor');
		$this->db->where_in('vendor_id', $cat_ids);
		return $this->db->get()->result_array();
	}
}
?>