EVOLUTION-NINJA
Edit File: Access_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Access_model extends CI_Model { public function __construct() { parent::__construct(); } public function insert($table,$data) { $this->db->insert($table,$data); } public function get_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_purchase_data($table,$where) { $this->db->select('*'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_data1($table,$where) { $this->db->select('*'); $this->db->group_by('sl_indent_no'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function Get($keyword) { $this->db->distinct(); $this->db->select('product'); $this->db->order_by('id', 'DESC'); $this->db->like("product", $keyword); $this->db->from('indent_product'); $query= $this->db->get(); return $query->result(); } public function get_customerdata($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function getsuborder1($id) { $this->db->select('*'); $this->db->from('indent_add_indent'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_indent_no', $id); $query = $this->db->get(); return $query->result(); } public function get_where_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $arr=array(); foreach($query->result() as $row) { $arr[]=$row; } $json=json_encode($arr); return $json; } public function Getsearch($keyword) { $this->db->distinct(); $this->db->select('product'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("product", $keyword); $this->db->from('indent_product'); $query= $this->db->get(); return $query->result(); } public function Getsearch_pono($keyword) { $this->db->distinct(); $this->db->select('po_no'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); $query= $this->db->get(); return $query->result(); } public function Get_search($keyword) { $this->db->distinct(); $this->db->select('name'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("name", $keyword); $this->db->from('indent_vendor_master'); $query= $this->db->get(); return $query->result(); } public function max_select_indent_no($table) { $this->db->select_max('sl_indent_no'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_indent_no_id($table) { $this->db->select_max('id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function update_data($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); } public function delete_product_vendor($where){ $this->db->where($where); $this->db->delete('indent_product'); return; } public function delete_vendor($table,$where){ $this->db->where($where); $this->db->delete($table); return; } public function max_select_purchase_no($table) { $this->db->select_max('po_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_goods($table) { $this->db->select_max('invoice_no'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function Getsearch_auto($keyword,$where) { $this->db->distinct(); $this->db->select('indent_no'); $this->db->like("indent_no", $keyword); $this->db->from('indent_add_indent'); $this->db->where($where); $query= $this->db->get(); return $query->result(); } public function Getsearch_vendorname_auto($keyword) { $this->db->distinct(); $this->db->select('name'); $this->db->like("name", $keyword); $this->db->from('indent_vendor_master'); $query= $this->db->get(); return $query->result(); } public function update_new($data,$where) { $this->db->where($where); $this->db->update('indent_add_indent',$data); } public function update_confirm_purchase($data,$where) { $this->db->where($where); $this->db->update('indent_purchase_order',$data); } public function get_where_dataa($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function getsuborder($id) { $this->db->select('*'); $this->db->from('indent_add_indent'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_indent_no', $id); $query = $this->db->get(); return $query->result(); } public function getpurchaseorder($id) { $this->db->select('*'); $this->db->from('indent_purchase_order'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_no', $id); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_where_subgrid_data1($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function update_confirm_indent($data,$where) { $this->db->where($where); $this->db->update('indent_add_indent',$data); } public function fetch_where_subgrid_data2() { $this->db->select('i.id,i.indent_no,p.po_no,p.product_name,p.confirm as pc,i.confirm as ic'); $this->db->from('indent_add_indent as i'); $this->db->join('indent_po as p', 'i.indent_no = p.indent_no'); $query = $this->db->get(); return $query->result(); } public function getproducts($type) { $query = $this->db->query('SELECT DISTINCT(product) FROM indent_product where product_type="' . $type .'"'); return $query->result(); } public function get_wish_list_data($ids) { $this->db->select('*'); $this->db->from('indent_add_indent'); $this->db->where('id', $ids); $query=$this->db->get(); return $query->row(); } public function get_data_fetch($table,$where) { $this->db->select('*'); // $this->db->group_by('sl_indent_no'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function update_po_list_confirm_purchase($table,$data,$where) { $this->db->where($where); $this->db->update($table,$data); } public function max_select_emp_id($table) { $this->db->select_max('employee_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_dept_id($table) { $this->db->select_max('user_type_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function getproduct_details() { $this->db->select('employee_details.*,swansilk_user_type.*'); $this->db->from('employee_details'); $this->db->join('swansilk_user_type', 'swansilk_user_type.user_type_id = employee_details.user_type_id'); $query = $this->db->get(); return $query->result(); } public function max_select_sub_dept_id($table) { $this->db->select_max('sub_dept_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_event_id($table) { $this->db->select_max('event_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function fetch_where_data($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function get_details($table){ $this->db->select('*'); $this->db->from($table); $query= $this->db->get(); return $query->result(); } public function delete_function($table,$where) { $this->db->where($where); $this->db->delete($table); return; } public function fetch_parent_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_all_menu($menu_id) { $this->db->select('A.*'); $this->db->from('swansilk_menu A'); $this->db->where('A.menu_id',$menu_id); $this->db->where('A.delete_status','ACTIVE'); $this->db->group_by('menu_id'); $result = $this->db->get(); return $result->row(); } } ?>