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/Fuel_consumption.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Fuel_consumption  extends Action_controller{	
	public function __construct(){
		parent::__construct('fuel_consumption');
		$this->collect_base_info();
	}
	
	// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
	public function index(){
		$this->load->view("$this->control_name/manage");
	}
	
	//LOAD TABEL WITH FILTERS
	public function check_log_details(){
		$start_date        = str_replace("/","-",$this->input->post('start_date'));
		$end_date          = str_replace("/","-",$this->input->post('end_date'));
		$from_date         = date('Y-m-d',strtotime($start_date));
		$to_date           = date('Y-m-d',strtotime($end_date));
		$this->db->select('*');
		$this->db->from('cw_maintenance_job_schedule');
		$this->db->join('cw_fuel_outward','cw_fuel_outward.prime_fuel_outward_id = cw_maintenance_job_schedule.prime_maintenance_job_schedule_id','left');
	    $this->db->join('cw_fuel_inward','cw_fuel_inward.prime_fuel_inward_id = cw_maintenance_job_schedule.prime_maintenance_job_schedule_id','inner');
        $this->db->join('cw_vehicle_trip_info','cw_vehicle_trip_info.prime_vehicle_info_id = cw_maintenance_job_schedule.prime_maintenance_job_schedule_id','inner');
        $this->db->join('cw_vehicle_master','cw_vehicle_master.prime_vehicle_master_id = cw_maintenance_job_schedule.prime_maintenance_job_schedule_id','inner');
          $this->db->where('cw_maintenance_job_schedule.date between "'.$from_date.'" and "'.$to_date.'"');
         	$get_data_rslt  =  $this->db->get()->result();
		$tr_line	= "";
			foreach ($get_data_rslt as $key => $value) {	
			$tr_line .="<tr>
			<td>".$date_time	   = date('d-m-Y H:i:s',strtotime($value->date_time))."</td>
			<td>".$vehicle_no      = $value->vehicle_no."</td>
			<td>".$reg_no          = $value->reg_no."</td>
			<td>".$driver_name     = $value->driver."</td>
			<td>".$total_litres    = $value->total_litres."</td>
			<td>".$km              = $value->km."</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>DATE AND TIME</td>
									<td>FLEET NO</td>
									<td>HORSE REG</td>
									<td>DRIVER</td>
									<td>TOTAL LITRES</td>
									<td>KM</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));
		}
    }	
}
?>