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/crm_cafsindia_com/application/models/Amc_model.php
<?php
class Amc_model extends CI_Model{
	
	public function search($search,$rows = 0,$limit_from= 0,$sort='amc_id',$order='asc'){
		$this->db->from('amc');
		$this->db->where('amc.status',1);
		$this->db->group_start();
			$this->db->like('amc_id',$search);
			$this->db->or_like('amc_name',$search);
		$this->db->group_end();
		$this->db->order_by('amc_id',$order);
		if($rows>0){
			$this->db->limit($rows, $limit_from);
		}
		return $this->db->get();
	}
	
	public function get_found_rows($search){
		$this->db->from('amc');
		$this->db->where('status',1);
		return $this->db->get()->num_rows();
	}

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

	public function exists($amc_id){
		$this->db->from('amc');
		$this->db->where('amc_id', $amc_id);
		return ($this->db->get()->num_rows() == 1);
	}

	public function save_amc(&$amc_data, $amc_id = FALSE){
		if(!$amc_id || !$this->exists($amc_id, TRUE)){
			$amc_data['created_by']   = $this->session->userdata('emp_id');
			$amc_data['created_date'] = date("Y-m-d h:i:s");
			if($this->db->insert('amc', $amc_data)){
				$amc_data['amc_id'] = $this->db->insert_id();
				return TRUE;
			}
			return FALSE;
		}
		$amc_data['updated_by']   = $this->session->userdata('emp_id');
		$amc_data['updated_date'] = date("Y-m-d h:i:s");
		$this->db->where('amc_id', $amc_id);
		return $this->db->update('amc', $amc_data);
	}

	public function delete_list($amc_id){
		$this->db->where_in('amc_id',$amc_id);
		return $this->db->update('amc',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('amc');
		$this->db->where_in('amc_id', $cat_ids);
		return $this->db->get()->result_array();
	}
}
?>