<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admin_Request_Model extends CI_Model {  
function __construct() 
  {
	 /* Call the Model constructor */
    parent::__construct();
  }	
/*templte function */
function  insert_master_data($data){
	$this->db->insert('master_table_name',$data);
}
function  insert_item_data($data){
	$this->db->insert('item_table_name',$data);
}
function update_master_table($id,$data){
	$this->db->where('master_primary_id_colom_name',$id);
	return $this->db->update('master_table_name',$data);
}
function update_item_table($id,$data){
	$this->db->where('item_secondary_id_colom_name',$id);
	return $this->db->update('master_table_name',$data);
}
public function get_table_data($condtion_1)
	{
	  $this->db->select('*,u.invoice_name,u.user_first_name,u.user_last_name,w.name,w.address,w.phone,w.email,mt.invoice_type_name,r.area_name');
	  $this->db->from('table_name t');
	  $this->db->join('table2 t2','t2.primary_id=t.secondary_id','inner');
	  $this->db->where('t.condition_coloum_date',$condtion_1);
	  $query=$this->db->get();
	  return $query->row_array();	
	}
/* teplmate function */	

public function get_product_id($product_code)
	{
	  $this->db->select('product_id');
	  $this->db->from('product p');
	 $this->db->where('p.product_code',$product_code);
	  $query=$this->db->get();
	  $result= $query->row_array();
	  if (isset( $result['product_id'])){
	      return $result['product_id'];
	  }
	  else{ 
	      return 0;
	  }
	      
	 
	}















	
		
	
}