MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/allyindian_com/sbltt/application/models/Live_chart_model.php
<?php
class Live_chart_model extends CI_Model{
	
	public function get_vehicle(){
		$this->db->from('vehicle');
		$this->db->join('veh_type', 'veh_type.veh_type_id = vehicle.vehicle_type','left');
		$this->db->where('vehicle.status',1);
		$this->db->where('vehicle.live_chart',1);
		$this->db->order_by('vehicle_id', 'asc');
		return $this->db->get()->result();
	}
	public function vehicle_id_group(){
		$query = $this->db->query("SELECT GROUP_CONCAT(vehicle_id) as vehicle_ids FROM sblt_vehicle where status = '1' and live_chart = '1' order by vehicle_id asc");
		return  $query->row();
	}
	public function booking_chart_exist($chart_month,$vehicle_id){
		$this->db->from('booking_chart');
		$this->db->where('chart_month',$chart_month);
		$this->db->where('chart_vehicle_id',$vehicle_id);
		return $this->db->get()->num_rows();
	}
	public function get_booking_chart_date($year_month,$col,$vehicle_ids){
		$query = $this->db->query("SELECT $col as days,mode,chart_vehicle_id FROM sblt_booking_chart where chart_vehicle_id in ($vehicle_ids) and chart_month = '$year_month' and status = '1' order by CAST(chart_vehicle_id as SIGNED INTEGER),mode ASC");
		return $query->result();
	}
	public function get_booking_chart($chart_month,$vehicle_id,$vehicle_type){
		$count = $this->booking_chart_exist($chart_month,$vehicle_id);
		if((int)$count === 0){
			$this->db->insert('booking_chart', array('chart_month'=>$chart_month,'chart_vehicle_id'=>$vehicle_id,'chart_vehicle_type'=>$vehicle_type,'mode'=>"SALES"));
			$this->db->insert('booking_chart', array('chart_month'=>$chart_month,'chart_vehicle_id'=>$vehicle_id,'chart_vehicle_type'=>$vehicle_type,'mode'=>"OPERATION"));
		}
		$this->db->from('booking_chart');
		$this->db->where('chart_month',$chart_month);
		$this->db->where('chart_vehicle_id',$vehicle_id);
		return $this->db->get()->result();
	}
	public function get_demand_date($demand_month){
		$this->db->from('demand_date');
		$this->db->where('demand_month',$demand_month);
		return $this->db->get()->row();
	}
}
?>