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/Stat_customers_m.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Stat_customers_m extends MY_Model {
	
	function __construct() {
		parent::__construct();	
	}	
	
	//pagination included
	function get_customers_spent($start_date, $end_date) {
		/*$this->db->select('o.customer_id, c.name, c.email , c.province, SUM(total_amount) total_spent');
		$this->db->from('orders o, customers c');
		$this->db->where(' ( payment_status = 1 or payment_status = 3 or payment_status = 4 ) 
			and o.order_date >= "'.$start_date.'" and o.order_date <= "'.$end_date.'" 
			and c.id_customers = o.customer_id');
		$this->db->group_by('o.customer_id');
		$this->db->order_by(' total_spent', 'desc');*/

		$start_date = str_replace("/","-",$start_date);
		$end_date = str_replace("/","-",$end_date);

		$this->db->select('
			DATE_FORMAT(b.order_date, "%d-%m-%Y") as tgl,
			c.name,
			c.email,
			c.province,
			e.brand,
			g.category,
			a.item_name,
			a.quantity,
			a.subtotal
		')
		->from('orders_detail a')
		->join('orders b','a.orders_id=b.id_orders','left')
		->join('customers c','b.customer_id=c.id_customers','left')
		->join('products d','a.item_id=d.id_products','left')
		->join('brands e','d.brand_id=e.id_brands','left')
		->join('category_product f','a.item_id=f.id_product','left')
		->join('categories g','f.id_category=g.id_categories','left')
		->where(' ( b.payment_status = 1 or b.payment_status = 3 or b.payment_status = 4 ) 
			and date(b.order_date) >= "'.$start_date.'" and date(b.order_date) <= "'.$end_date.'" ')
		->group_by('a.id_orders_detail')
		->order_by('b.order_date', 'asc');

		$query = $this->db->get();
		return $query->result();
	}

	function get_spent_per_province($start_date, $end_date) {
		$this->db->select('c.province, SUM(o.total_amount) total_province, m.id_province');
		$this->db->from('orders o, customers c, map_province m');
		$this->db->where(' ( payment_status = 1 or payment_status = 3 or payment_status = 4 ) and o.order_date >= "'.$start_date.'" and o.order_date <= "'.$end_date.'" and c.id_customers = o.customer_id and o.province = m.label');
		$this->db->group_by('o.province');
		$this->db->order_by(' total_province', 'desc');
		$query = $this->db->get();
		return $query->result();
	}

}

https://t.me/RX1948 - 2025