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/Tour_fb_model.php
<?php
class Tour_fb_model extends CI_Model
{
	public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = '', $order = 'asc'){
	
  $start_date = $filters['start_date'];
  $end_date   = $filters['end_date'];

    // if(!$sort){
    //   $sort = "ncd"; 
    // }

   $this->db->select('operation.tour_no,op_driver_name,vehicle_no,vch_quality,vch_media,vch_seat,driving_skill,driver_behaviour,sightseeing,from_date,to_date,customer_name,booking_type_name,frm.city_name as frm_city_name, to.city_name as to_city_name,from_date,to_date,trip_type_name,veh_type');
    $this->db->from('operation_line');
    $this->db->join('feed_back', 'feed_back.feed_op_line_id = operation_line.op_line_id','left');
    $this->db->join('operation', 'operation.operation_id = operation_line.operation_id','left');
	$this->db->join('customers', 'customers.cust_id = operation.cust_id','left');
    $this->db->join('vehicle', 'vehicle.vehicle_id = operation_line.op_vehicle_id','left');
	$this->db->join('trip_type', 'trip_type.trip_type_id = operation.trip_type','left');
	$this->db->join('veh_type', 'veh_type.veh_type_id = operation.vehicle_type','left');
	$this->db->join('booking_type', 'booking_type.booking_type_id = operation.cust_type','left');
	$this->db->join('city frm', 'frm.city_id = operation.orgin','left');
	$this->db->join('city to', 'to.city_id = operation.destination','left');	
    
    if($search){
      $this->db->group_start();
        $this->db->like('operation.tour_no',$search);
        $this->db->or_like('op_driver_name',$search);
        $this->db->or_like('vehicle_no',$search);
        $this->db->or_like('booking_type_name',$search);
        $this->db->or_like('trip_type_name',$search);
        $this->db->or_like('from_date',$search);
        $this->db->or_like('to_date',$search);
        //$this->db->or_like('frm_city_name',$search);
        //$this->db->or_like('to_city_name',$search);
        $this->db->or_like('veh_type',$search);
      $this->db->group_end(); 
    }     
    
     $this->db->group_start();
     $this->db->where('DATE_FORMAT(from_date, "%Y-%m-%d") BETWEEN '. $this->db->escape($start_date).' AND '.$this->db->escape($end_date))->or_where('DATE_FORMAT(to_date, "%Y-%m-%d") BETWEEN '. $this->db->escape($start_date).' AND '.$this->db->escape($end_date));
     $this->db->group_end(); 
    
  $this->db->where('operation_line.status',1);
  $this->db->where('operation.operation_sts',4);
    $this->db->order_by($sort,$order);
    if($rows>0){
      $this->db->limit($rows, $limit_from);
    }
    return $this->db->get();
  }



  public function get_found_rows($search, $filters){
    return $this->search($search, $filters)->num_rows();
  }

public function excel_tour_fb_report($start_date, $end_date){

   $this->db->select('operation.tour_no,op_driver_name,vehicle_no,vch_quality,vch_media,vch_seat,driving_skill,driver_behaviour,sightseeing,from_date,to_date,customer_name,phone_number,avg_km,trip_days,bus_count,operation_type,operation.tp_info,booking_type_name,frm.city_name as frm_city_name, to.city_name as to_city_name,trip_type_name,veh_type,operation_sts');
    $this->db->from('operation_line');
    $this->db->join('feed_back', 'feed_back.feed_op_line_id = operation_line.op_line_id','left');
    $this->db->join('operation', 'operation.operation_id = operation_line.operation_id','left');
	$this->db->join('customers', 'customers.cust_id = operation.cust_id','left');
    $this->db->join('vehicle', 'vehicle.vehicle_id = operation_line.op_vehicle_id','left');
	$this->db->join('trip_type', 'trip_type.trip_type_id = operation.trip_type','left');
	$this->db->join('veh_type', 'veh_type.veh_type_id = operation.vehicle_type','left');
	$this->db->join('booking_type', 'booking_type.booking_type_id = operation.cust_type','left');
	$this->db->join('city frm', 'frm.city_id = operation.orgin','left');
	$this->db->join('city to', 'to.city_id = operation.destination','left');	
	$this->db->where('operation_line.status',1);
	$this->db->where('operation.operation_sts',4);
	$excel = $this->db->get();
	return $excel->result_array();
	}
}
?>