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/ntc_cafsinfotech_in_bk/application/controllers/Trip_exception.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Trip_exception  extends Action_controller{	
	public function __construct(){
		parent::__construct('trip_exception');
		$this->collect_base_info();
	}
	
	// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
	public function index(){
		$customer_type[""] = "--Select Customer--";
	    $this->db->from('cw_ntc_load');
	    $this->db->join('cw_load_customer_type', 'cw_load_customer_type.prime_load_customer_type_id = cw_ntc_load.load_customer_type','inner');
	    $this->db->where('cw_load_customer_type.trans_status',1);
	     $this->db->group_by('cw_ntc_load.load_customer_type');
	    $customer_type_result =  $this->db->get()->result();
		foreach($customer_type_result as $value){
			 $customer_type[$value->load_customer_type] = $value->load_customer_type;
		}
		$data['load_customer_type'] = $customer_type;
		$this->load->view("$this->control_name/manage",$data);

	}
	//GET REPORT
	public function get_report(){
		$from_date = date('Y-m-d',strtotime($this->input->post("from_date")));
		$to_date = date('Y-m-d',strtotime($this->input->post("to_date")));
		$load_customer_arr= $this->input->post("load_customer_type");
		$array_filter       = array_filter($load_customer_arr);
		$load_customer_type = implode('","', $array_filter);
	    $this->db->select('*');
		$this->db->from('cw_ntc_load');
		$this->db->join('cw_load_customer_type', 'cw_load_customer_type.prime_load_customer_type_id = cw_ntc_load.load_customer_type','left');
        $this->db->join('cw_ntc_load_trailer', 'cw_ntc_load_trailer.ntc_load_id_trailer = cw_ntc_load.prime_ntc_load_id','left');
        $this->db->join('cw_vehicle_trip_info', 'cw_vehicle_trip_info.prime_vehicle_info_id = cw_ntc_load.prime_ntc_load_id','left');
        $this->db->join(' cw_ntc_pickup_drop', ' cw_ntc_pickup_drop.prime_pickup_drop_id = cw_ntc_load.prime_ntc_load_id','left');
        $this->db->join(' cw_vehicle_master', ' cw_vehicle_master.prime_vehicle_master_id = cw_ntc_load.prime_ntc_load_id','left');
        $this->db->join('cw_order_receiving', 'cw_order_receiving.order_receiving_id = cw_ntc_load.trans_created_by','left');
        $this->db->where('from_date >=',$from_date);
        $this->db->where('to_date <=',$to_date);
		$this->db->where('cw_ntc_load.trans_status',1);
		$get_data_rslt  =  $this->db->get()->result();
		 $trip_info = array(1=>"Schedule",2=>"Confirm",3=>"Onprogress",4=>"Cancelled",5=>"Completed",6=>"Incompleted"); 
		$tr_line	= "";
		foreach ($get_data_rslt as $key => $value) {
			$trip_sts = "-";
			if($trip_info[(int)$value->trip_status]){
				$trip_sts = $trip_info[(int)$value->trip_status];
			}
			

		$tr_line .="<tr>
			<td>".$from_date	      = date('d-m-Y',strtotime($value->from_date))."</td>
			<td>".$to_date	          = date('d-m-Y',strtotime($value->to_date))."</td>
			<td>".$load_customer_type = $value->load_customer_type."</td>
			<td>".$horse              = $value->reg_no."</td>
			<td>".$driver_name        = $value->driver_name."</td>
			<td>".$trip_status        = $trip_sts."</td>
			<td>".$vehicle_no         = $value->vehicle_no."</td>
			<td>".$number             = $value->number."</td>
			<td>".$ntc_load_id_trailer= $value->register_no."</td>
			<td>".$trailer_id         = $value->chassis_no."</td>		
			<td>".$shipment_number    = $value->shipment_number."</td>
			<td>".$delivery_note      = $value->delivery_note."</td>
			<td>".$mass               = $value->mass."</td>
			<td>".$product            = $value->product."</td>
			</tr>";


		}

		if($get_data_rslt){
			$table_content = "<div style='margin:20px;'>
							<table class='table table-striped table-bordered' id='trip_report'>
								<thead>
									<tr>
									<td>FROM DATE</td>
									<td>TO DATE</td>
									<td>CUMSTOMER</td>
									<td>HORSE REG</td>
									<td>DRIVER</td>
									<td>TRIP STATUS</td>
									<td>VEHICLE NO</td>
									<td>LOAD NO</td>
									<td>TRAILER REG 1</td>
									<td>TRAILER REG 2</td>
									<td>SHIPMENT</td>
									<td>NTC Delivery Note</td>
									<td>MASS</td>
									<td>PRODUCT</td>
									</tr>
								</thead>
								<tbody>
									$tr_line
								</tbody>
							</table>
						</div>";
		echo json_encode(array('success'=>true,'table_content'=>$table_content));
         }else{
			echo json_encode(array('success'=>false,'message'=>'NO DATA AVAILABLE','table_content'=>$table_content));
		}
	}

}