<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Mod_home extends CI_Model
{
	function __construct(){
    	parent::__construct();
	}
	
	public function get_all_courses(){
		$this->db->select('bt.*,'.'ex.name as course_name');
		$this->db->from('crm_batch_details as bt');
		$this->db->join('crm_exam_details as ex','ex.id = bt.course_id', 'left');
		$this->db->where('bt.status', 1);
		$this->db->where('bt.course_id', 1);
		$this->db->order_by('bt.id', 'desc');
		return $this->db->get()->result_array();
	}
	
	public function get_all_courses_zolo(){
		$this->db->select('bt.*,'.'ex.name as course_name');
		$this->db->from('crm_batch_details as bt');
		$this->db->join('crm_exam_details as ex','ex.id = bt.course_id', 'left');
		$this->db->where('bt.status', 1);
		$this->db->where('bt.course_id', 2);
		$this->db->order_by('bt.id', 'desc');
		return $this->db->get()->result_array();
	}
	
	public function get_particalur_batch($param){
		$this->db->select('bt.*,'.'ex.name as course_name');
		$this->db->from('crm_batch_details as bt');
		$this->db->join('crm_exam_details as ex','ex.id = bt.course_id', 'left');
		$this->db->where('bt.status', 1);
		$this->db->where('bt.id', $param);
		$this->db->order_by('bt.id', 'desc');
		return $this->db->get()->row_array();
	}
	
	public function checkTransactionIdExist($trans){
		$this->db->select('id');
		$this->db->from('crm_offline_transaction_details');
		$this->db->where('transaction_no', $trans);
		return $this->db->get()->row_array();
	}	
	
	public function add_new_user($dataa){
		$this->db->insert('crm_offline_transaction_details',$dataa);
		return $this->db->insert_id();
	}
   
    public function get_transaction($useridd){
		$this->db->select('*');
		$this->db->from('crm_offline_transaction_details');
		$this->db->where('id', $useridd);
		return $this->db->get()->row_array();
	}	
	
	public function set_transaction_status($id){
		$this->db->where('id', $id);
		return $this->db->update('crm_offline_transaction_details', array('status' => 1));
	}
	
	
	
  
}


