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/Revenue_report_model.php
<?php
class Revenue_report_model extends CI_Model{
	
 //Revenue report
 
	public function revenue_report($start_date,$end_date,$mode){
		
		$this->db->select("vendor_name,sblt_booking.from_date,booking_type_name,IFNULL(sum(sblt_booking.booking_amount),0) as book_amount,IFNULL(sum(sblt_booking.catering_amount),0) as cat_amt,IFNULL(sum(sblt_booking.stay_amount),0) as stay_amt");
		$this->db->from('booking');
		$this->db->join("booking_type", "booking_type.booking_type_id = booking.cust_type","left");
		$this->db->join("operation", "sblt_operation.cust_id = booking.cust_id","left");
		$this->db->join("operation_line", "operation_line.operation_id = operation.operation_id","left");
		$this->db->join("vehicle", "vehicle.vehicle_id = sblt_operation_line.op_vehicle_id","left");
		$this->db->join("vendor", "vendor.vendor_id = vehicle.owned_by","left");
		$this->db->group_start();
		$this->db->where('DATE_FORMAT(sblt_booking.from_date, "%Y-%m-%d") BETWEEN '. $this->db->escape($start_date).' AND '.$this->db->escape($end_date));
		$this->db->group_end();
		$this->db->where('booking.booking_sts', 2);
		if($mode === 1){
			$this->db->where('vendor_name', 'sBLTT');
		}else{
			$this->db->where('vendor_name !=', 'sBLTT');
		}
		$this->db->group_by('vendor_name,booking.cust_type');
		return $this->db->get()->result();
	}
	
	public function outside_catering($start_date,$end_date){
		$this->db->select("IFNULL(sum(sblt_catering_outside.catering_amount),0) as out_cat_amt");
		$this->db->from('catering_outside');
		$this->db->where('DATE_FORMAT(sblt_catering_outside.from_date, "%Y-%m-%d") BETWEEN '. $this->db->escape($start_date).' AND '.$this->db->escape($end_date));
		$this->db->where('catering_sts', 'Confirm');
		return $this->db->get()->result();
		
	}
	
}
?>