| Server IP : 162.214.74.102 / Your IP : 216.73.216.36 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/ |
Upload File : |
<?php
include("includes/main_init.php");
$myarray= array();
if(isset($_POST["driver_id"]) && $_POST["driver_id"] != "")
{
$driverId = $_POST["driver_id"];
$getDriverAvlDetails = find("first", DRIVER_AVAILABLE_SCHEDULE, "schedule_date", " where driver_id = :driver_id AND date(schedule_date) = :schedule_date", array(":schedule_date"=>date("Y-m-d"), ":driver_id"=>$driverId));
$getDriverDetails = find("first", DRIVER, "driver_availability_status", " where driver_id = :driver_id ", array(":driver_id"=>$driverId));
if($getDriverDetails["driver_availability_status"] != 1)
{
$myarray['success'] = 0;
$myarray['message'] = 'Change your status to available.';
}
else if(count($getDriverAvlDetails) > 0)
{
$execute = array();
$sitesettings = find("first", GENERAL_SETTINGS, "estimated_delivery_time", " where 1 ", $execute);
$estimated_delivery_time = $sitesettings['estimated_delivery_time'];
$execute = array();
$chk_for_orders = find("all", ORDER, "*", " WHERE isdriver_assign=1 AND driverid=0 AND date(driver_assign_time) = '".date('Y-m-d')."' ORDER BY driver_assign_time DESC ", $execute);
//print_r($chk_for_orders);
//exit;
if($chk_for_orders)
{
$myarray['success'] = 1;
foreach($chk_for_orders AS $k=>$order) {
$myarray['details'][$k]['order_id'] = $order['orderid'];
$myarray['details'][$k]['display_order_id'] = $order['ordergenerateid'];
$myarray['details'][$k]['delivery_completed_date'] = date('jS M', strtotime($order['delivery_completed_date']));
$myarray['details'][$k]['delivery_completed_time'] = date('h:i A', strtotime($order['delivery_completed_date']));
$myarray['details'][$k]['ordertotalprice'] = $order['ordertotalprice'];
$myarray['details'][$k]['restaurant_id'] = $order['restaurant_id'];
$execute1 = array(':restaurant_id' => $order['restaurant_id']);
$res = find("first", RESTAURANT, " restaurant_name,restaurant_logo,restaurant_streetaddress,restaurant_city,restaurant_state,restaurant_zip,restaurant_delivery_charge, restaurant_phone, latitude, longitude, restaurant_estimated_time ", "where restaurant_id =:restaurant_id", $execute1);
if($res) {
$myarray['details'][$k]['restaurant_name'] = $res['restaurant_name'];
if($res['restaurant_estimated_time']!='' && $res['restaurant_estimated_time']>0) {
$estimated_delivery_time = $res['restaurant_estimated_time'];
}
$restaurantAddress = '';
if($res['restaurant_streetaddress']!='') {
$restaurantAddress .= $res['restaurant_streetaddress'].', ';
}
if($res['restaurant_city']!='') {
//$restaurantAddress .= $res['restaurant_city'].', ';
$execute_city = array(':city_id' => $res['restaurant_city']);
$get_city = find("first", CITY, "*", "where city_id =:city_id ", $execute_city);
if($get_city) {
$restaurantAddress .= $get_city['cityname'].', ';
}
}
if($res['restaurant_state']!='') {
$restaurantAddress .= $res['restaurant_state'].', ';
}
if($res['restaurant_zip']!='') {
$restaurantAddress .= $res['restaurant_zip'].' ';
}
$myarray['details'][$k]['restaurant_streetaddress'] = $restaurantAddress;
$myarray['details'][$k]['restaurant_phone'] = $res['restaurant_phone'];
}
$myarray['details'][$k]['customername'] = $order['customername'].' '.$order['customerlastname'];
$myarray['details'][$k]['customeremail'] = $order['customeremail'];
$myarray['details'][$k]['customercellphone'] = $order['customercellphone'];
$deliveryAddress = '';
if($order['deliverystreet']!='') {
$deliveryAddress = $order['deliverystreet'];
}
$myarray['details'][$k]['customeraddress'] = $deliveryAddress;
$date1 = strtotime($order['orderdate']);
$expected_order_time = date('h:i A', mktime(date("H", $date1), (date("i", $date1)+$estimated_delivery_time), date("s", $date1), date("m", $date1), date("d", $date1), date("Y", $date1)));
//$expected_order_time = '1:20 PM';
$myarray['details'][$k]['delivery_completed_time'] = $expected_order_time;
}
}
else
{
$myarray['success'] = 0;
$myarray['message'] = 'No pending notification';
}
}
else
{
$myarray['success'] = 0;
$myarray['message'] = 'Please add your schedule in my calendar section.';
}
}
else{
$myarray['success'] = 0;
$myarray['message'] = 'You are not authorized.';
}
echo json_encode($myarray);
exit;
?>