https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/models/Order_m.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Order_m extends MY_Model {

	protected $_table_name = 'orders';
	protected $_primary_key = 'id_orders';
	protected $_order_by = 'id_orders';

	function __construct() {
		parent::__construct();		
	}

	//function count all record for orders 
	public function record_count($type = '', $param = '') {
		switch ($type) {
			case 'orderId':
				return $this->db->select('id_orders')->from('orders')->where('id_orders', (int) $param)->get()->num_rows();
				break;
			case 'customerName':
					return $this->db->select('id_orders')->from('orders')->like('recipient_name', $param)->get()->num_rows();
					break;
			case 'orderStatus':
				return $this->db->select('id_orders')->from('orders')->where('payment_status', (int) $param)->get()->num_rows();
				break;
			default:
				return $this->db->get('orders')->num_rows();
				break;
		}
  }

  //pagination included
	function get_all_orders($type = '', $param = '', $start, $limit) {
		
		$this->db->select('*');
		$this->db->from('orders');
		$this->db->join('customers', 'customers.id_customers = orders.customer_id');
		switch ($type) {
			case 'orderId':
				$this->db->where('id_orders', (int) $param);
				break;
			case 'customerName':
				$this->db->like('orders.recipient_name', $param);
				break;
			case 'orderStatus':
				$this->db->where('payment_status', (int) $param);
				break;
		}
		$this->db->limit($start, $limit);
		$this->db->order_by('id_orders', 'desc');
		$query = $this->db->get();		
		return $query->result();
	}

	//pagination included
	function report_get_all_orders($limit, $start) {
		$this->db->select('*');
		$this->db->from('orders');
		$this->db->join('customers', 'customers.id_customers = orders.customer_id');
		$this->db->where('payment_status', 1);
		$this->db->order_by('id_orders', 'desc');
		$this->db->limit($limit, $start);
		$query = $this->db->get();		
		return $query->result();
	}

	function excel_export() {
		$this->db->select('id_orders, order_date, total_amount, payment_type, payment_date, recipient_name, address, city, state, country, postcode, phone');
		$this->db->from('orders');
		$this->db->order_by('id_orders', 'desc');
		$query = $this->db->get();		
		return $query->result();
	}

	//get specific order with its customer details 
	function get_order($id) {
		$this->db->select('c.brand,c.kanva_group');
		$this->db->from('orders_detail a'); 
		$this->db->join('products b','a.item_id=b.id_products','left');
		$this->db->join('brands c','b.brand_id=c.id_brands','left');
		$this->db->where('a.orders_id', $id);
		$this->db->group_by('c.brand');
		$this->db->order_by('c.kanva_group desc, c.brand asc');
		$brand = $this->db->get();
		$no=1;
		$list_brand = '';
		$kanva_group = '';
		foreach ($brand->result() as $row) {
			if($row->kanva_group == '1' && $kanva_group == ''){
				$kanva_group = '1';
				if($no == 1){
					$list_brand .= 'Kanva';
				}else{
					$list_brand .= ';Kanva';
				}
			}
			if($row->kanva_group == '0'){
				if($no == 1){
					$list_brand .= $row->brand;
				}else{
					$list_brand .= ';'.$row->brand;
				}
			}
			$no++;
		}	

		$this->db->select("a.*,b.id_district,'$list_brand' as list_brand");
		$this->db->from('orders a'); 
		$this->db->join('customers b','a.customer_id=b.id_customers','left');
		$this->db->where('a.id_orders', $id);
		$query = $this->db->get();		
		return $query->row();
	}
	
	//update credit card payment status
	function update_payment_status($id, $data) {
		$this->db->where('id_orders', $id);
		$this->db->update('orders', $data);	
	}

	function get_order_history($id_customer) {
		$this->db->select('*');
		$this->db->from('orders'); 
		$this->db->where('customer_id', $id_customer);
		$query = $this->db->get();		
		return $query->result();
	}

	//function count record based on chosen date range
	function record_count_search_date($date_start, $date_end) {

		$this->db->select('*');
		$this->db->from('orders');
		$this->db->where('payment_status', 1);
		$this->db->where('order_date >=', $date_start);
		$this->db->where('order_date <=', $date_end);
		$query = $this->db->get();		
		return $query->num_rows();
	}

	//function find store by filtering between 2 dates
	function find_order_by_date($limit, $start, $date_start, $date_end) {
		$this->db->select('*');
		$this->db->from('orders');
		$this->db->where('payment_status', 1);
		$this->db->where('order_date >=', $date_start);
		$this->db->where('order_date <=', $date_end);
		$this->db->order_by('order_date', 'DESC');
		$this->db->limit($limit, $start);
		$query = $this->db->get();		
		return $query->result();
	}


}

https://t.me/RX1948 - 2025