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/Utilization_model.php
<?php
class Utilization_model extends CI_Model{
		
	public function search($start_date,$end_date){
		// $type_qry = "";
		// if($vehicle_type){
		// 	$vehicle_type = implode(",",$vehicle_type);
		// 	$type_qry = "and sblt_operation.vehicle_type in ($vehicle_type)";
		// }
		// $vch_qry = "";
		// if($vehicle_no){
		// 	$vehicle_no = implode(",",$vehicle_no);
		// 	$vch_qry = "and sblt_operation_line.op_vehicle_id in ($vehicle_no)";
		// }
		
		$query = "SELECT first_name as d_name,op_driver_id,SUM(CASE WHEN sblt_booking.cust_type !='1' and sblt_booking.trip_type != '2' THEN sblt_booking.trip_days ELSE 0 END) tour_days, SUM(CASE WHEN sblt_booking.trip_type NOT IN ('1','6') and sblt_booking.cust_type !='1' THEN sblt_booking.trip_days ELSE 0 END) local_days, SUM(CASE WHEN sblt_booking.cust_type ='1' THEN sblt_booking.trip_days ELSE 0 END) trip_days, SUM(CASE WHEN sblt_booking.trip_type ='6' THEN sblt_booking.trip_days ELSE 0 END) company_days  FROM `sblt_operation_line` INNER JOIN sblt_operation on sblt_operation.operation_id =sblt_operation_line.operation_id INNER JOIN sblt_booking on sblt_booking.booking_id =sblt_operation.booking_id inner join sblt_vehicle on sblt_vehicle.vehicle_id = sblt_operation_line.op_vehicle_id inner join sblt_veh_type on sblt_veh_type.veh_type_id = sblt_vehicle.vehicle_type inner join sblt_employees on sblt_employees.id = op_driver_id inner join sblt_people on sblt_people.person_id = sblt_employees.person_id where (DATE_FORMAT(sblt_operation.from_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date' or DATE_FORMAT(sblt_operation.to_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date') and sblt_operation_line.status = '1' and operation_sts in ('4','5') GROUP BY d_name";
			
		$query_info = $this->db->query($query);
		return $query_info->result();
	}
}
?>