0){ foreach($getVehId as $keyId=>$valueId){ $getSysSerId.=$valueId['sys_service_id'].","; } $getSysSerId=substr($getSysSerId,0,strlen($getSysSerId)-1); } if($_SESSION['sys_group_id'] == 54173) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status='Break Down' group by sys_service_id "; } else if($_SESSION['sys_group_id'] == 54174) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status='Repair' group by sys_service_id "; } else if($_SESSION['sys_group_id'] == 54175) { $VehicleidQry = "select sys_service_id,vehicle_no,trip_status from matrix.client_veh_trip_status where sys_service_id IN (".$getSysSerId.") and is_active=1 and trip_status in ('Tyre Change','Tyre burst') group by sys_service_id "; } $VehicleId = db__select($VehicleidQry, ""); $_SESSION['Total_vehicle']=count($VehicleId); if(count($VehicleId)>0){ foreach($VehicleId as $key=>$value){ $_SESSION['vehId'].=$value['sys_service_id'].","; } $_SESSION['vehId']=substr($_SESSION['vehId'],0,strlen($_SESSION['vehId'])-1); } } $pointLocation = new pointLocation(); $_SESSION['clientid'] =$obj->ClientUniqueID(); $date = date('Y-m-d', strtotime('-1 day', strtotime(date('Y-m-d')))); $UserId = $_SESSION['UserId']; $AllvehicleDetails = $masterObj->getAllVechiles($_SESSION['vehId'],$date); $allSeesionData=$AllvehicleDetails; //echo "
";print_r($AllvehicleDetails);die();
 
if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)){
    $content= " 'number', 'string', 'string', 'string', 'string', 'string', 'number', 'number', 'number', 'string', 'string', 'number','number', 'number', 'number'";
} else {
    $content= " 'string', 'string', 'string', 'string', 'number', 'number', 'string', 'string', 'string', 'number', 'number', 'number','number', 'number', 'number'";
}
 function GetSourceDispatchtime($service_id)
{
			  $vehicleList = $service_id;
 
			 $GetLoadingpoint= db__select_staging("select sys_ServicE_id,location,sum(journey_in_sec) as total_halt from matrix.journey_tbl_ideal  where sys_ServicE_id=".$vehicleList." and location!='' and location NOT IN ('Dharuhera','Vasai Point','Pataudi Hub','BIHARI HOTEL','PANIPAT PUMP') and end_time>curdate() - INTERVAL DAYOFWEEK(curdate())+4 DAY  group by location having total_halt>21600  ");
			$location="";
			 
			$obj = new MyClass();
			foreach($GetLoadingpoint as $key=>$value){
                                                    $location.="'".$value['location']."',";

                                            } 
                                              $location=substr($location,0,strlen($location)-1); 
			  if( count($GetLoadingpoint)>0)
			  {
				  $chkrowlast=count($GetLoadingpoint)-1; 
				   $GetLoadingpointsingls= db__select_staging("select * from matrix.journey_tbl_ideal  where sys_ServicE_id=".$vehicleList." and location in(".$location.") and start_time>curdate() - INTERVAL DAYOFWEEK(curdate())+4 DAY     order by start_time "); 
  
						  $lastrow=count($GetLoadingpointsingls)-1;
						$idleTImesec= $obj->dateDifferenceSecond($GetLoadingpointsingls[0]["start_time"], $GetLoadingpointsingls[$lastrow]["end_time"]);
$ideal_time_show = $obj->minDifferenceForJourney($idleTImesec);
					  return $GetLoadingpointsingls[0]["veh_reg"]."##".$GetLoadingpointsingls[0]["start_time"]."##".$GetLoadingpointsingls[$lastrow]["end_time"]."##".$GetLoadingpointsingls[$lastrow]["location"]."##".$ideal_time_show; 
			 

						 
			  }
			
			
}
function Get_LatLng_From_Google_Maps($address) {
 If(trim($address)=="UP BORDER")
    {
        $LatLng = array(
            'lat' => '28.676298141',
            'lng' => '77.330680847',
        );
    }
    else
    {
 
    $Poito = db__select("select * from  `pois` where name like '%".trim($address)."%' and sys_user_id='".$_SESSION['UserId']."'", "");
    //echo "
";print_r($Poito);die;
 
        if(count($Poito)>0)
        {
       
            $LatLng = array(
                'lat' => $Poito[0]["gps_latitude"],
                'lng' => $Poito[0]["gps_longitude"],
                        'formatted_address' => $address
   
            );
        }
        else
        {
            $address=str_Replace(" ","+",$address);
   
                 $url = "https://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=false";
   
            // Make the HTTP request
            $data = @file_get_contents($url);
   
            // Parse the json response
            $jsondata = json_decode($data,true);
   
   
   
            $LatLng = array(
                'lat' => $jsondata["results"][0]["geometry"]["location"]["lat"],
                'lng' => $jsondata["results"][0]["geometry"]["location"]["lng"],
                        'formatted_address' => $jsondata["results"][0]["formatted_address"]
   
            );
        }
    }
 
    return $LatLng;
}
//echo "
";print_r($allSeesionData);die();
 
function SetTempGreateVal($set_temp,$set_temp_to,$temprature)
{
    if($set_temp == 18 && $set_temp_to == 25)
    {
        if($temprature>25 && $temprature<=28)
        {
            $temprature = 24;
        }
        else if($temprature>28 && $temprature<=30)
        {
            $temprature = 24.3;
        }
        else if($temprature>30 && $temprature<=35)
        {
            $temprature = 24.6;
        }
        else if($temprature>35 && $temprature<45)
        {
            $temprature = 25;
        }
    }
    else if($set_temp == 18 && $set_temp_to == 22)
    {
        if($temprature>22 && $temprature<=22.5)
        {
            $temprature = 18.1;
        }
        else if($temprature>22.5 && $temprature<=23)
        {
            $temprature = 18.2;
        }
        else if($temprature>23 && $temprature<=23.5)
        {
            $temprature = 18.3;
        }
        else if($temprature>23.5 && $temprature<=24)
        {
            $temprature = 18.4;
        }
        else if($temprature>24 && $temprature<=24.5)
        {
            $temprature = 18.5;
        }
        else if($temprature>24.5 && $temprature<=25)
        {
            $temprature = 18.6;
        }
        else if($temprature>25 && $temprature<=25.5)
        {
            $temprature = 18.7;
        }
        else if($temprature>25.5 && $temprature<=26)
        {
            $temprature = 18.8;
        }
        else if($temprature>26 && $temprature<=26.5)
        {
            $temprature = 18.9;
        }
        else if($temprature>26.5 && $temprature<=27)
        {
            $temprature = 19;
        }
        else if($temprature>27 && $temprature<=27.5)
        {
            $temprature = 19.1;
        }
        else if($temprature>27.5 && $temprature<=28)
        {
            $temprature = 19.2;
        }
        else if($temprature>28 && $temprature<=28.5)
        {
            $temprature = 19.3;
        }
        else if($temprature>28.5 && $temprature<=29)
        {
            $temprature = 19.4;
        }
        else if($temprature>29 && $temprature<=29.5)
        {
            $temprature = 19.5;
        }
        else if($temprature>29.5 && $temprature<=30)
        {
            $temprature = 19.6;
        }
        else if($temprature>30 && $temprature<=30.5)
        {
            $temprature = 19.7;
        }
        else if($temprature>30.5 && $temprature<=31)
        {
            $temprature = 19.8;
        }
        else if($temprature>31 && $temprature<=31.5)
        {
            $temprature = 19.9;
        }
        else if($temprature>31.5 && $temprature<=32)
        {
            $temprature = 20;
        }
        else if($temprature>32 && $temprature<=32.5)
        {
            $temprature = 20.1;
        }
        else if($temprature>32.5 && $temprature<=33)
        {
            $temprature = 20.2;
        }
        else if($temprature>33 && $temprature<=33.5)
        {
            $temprature = 20.3;
        }
        else if($temprature>33.5 && $temprature<=34)
        {
            $temprature = 20.4;
        }
        else if($temprature>34 && $temprature<=34.5)
        {
            $temprature = 20.5;
        }
        else if($temprature>34.5 && $temprature<=35)
        {
            $temprature = 20.6;
        }
        else if($temprature>35 && $temprature<=35.5)
        {
            $temprature = 20.7;
        }
        else if($temprature>35.5 && $temprature<=36)
        {
            $temprature = 20.8;
        }
        else if($temprature>36 && $temprature<=36.5)
        {
            $temprature = 20.9;
        }
        else if($temprature>36.5 && $temprature<=37)
        {
            $temprature = 21;
        }
        else if($temprature>37 && $temprature<=37.5)
        {
            $temprature = 21.1;
        }
        else if($temprature>37.5 && $temprature<=38)
        {
            $temprature = 21.2;
        }
        else if($temprature>38 && $temprature<=38.5)
        {
            $temprature = 21.3;
        }
        else if($temprature>38.5 && $temprature<=39)
        {
            $temprature = 21.4;
        }
        else if($temprature>39 && $temprature<=39.5)
        {
            $temprature = 21.5;
        }
        else if($temprature>39.5 && $temprature<=40)
        {
            $temprature = 21.6;
        }
        else if($temprature>40)
        {
            $temprature = 22;
        }
    }
    elseif($set_temp == 0 && $set_temp_to == 4)
    {
        if($temprature > 4 && $temprature <= 8)
        {
            $temprature = 3;
        }
        else if($temprature > 8 && $temprature <= 12)
        {
            $temprature = 3.3;
        }
        else if($temprature > 12 && $temprature <= 16)
        {
            $temprature = 3.7;
        }
        else if($temprature > 16 && $temprature <= 20)
        {
            $temprature = 4;
        }
    }
    elseif($set_temp == -25 && $set_temp_to == -18)
    {
       if($temprature > -8.5 && $temprature <= -8)
        {
            $temprature = -18.1;
        }
        else if($temprature > -9 && $temprature <= -8.5)
        {
            $temprature = -18.3;
        }
        else if($temprature > -9.5 && $temprature <= -9)
        {
            $temprature = -18.6;
        }
        else if($temprature > -10 && $temprature <=-9.5)
        {
            $temprature = -18.9;
        }
else if($temprature > -10.5 && $temprature <= -10)
        {
            $temprature = -19.3;
        }
        else if($temprature > -11 && $temprature <= -10.5)
        {
            $temprature = -19.6;
        }
        else if($temprature > -11.5 && $temprature <=-11)
        {
            $temprature = -20;
        }
        else if($temprature > -12 && $temprature <= -11.5)
        {
            $temprature = -20.7;
        }
        else if($temprature > -12.5 && $temprature <=-12)
        {
            $temprature = -21;
        }
else if($temprature > -13 && $temprature <= -12.5)
        {
            $temprature = -20.7;
        }
        else if($temprature > -13.5 && $temprature <=-13)
        {
            $temprature = -21.5;
        }
else if($temprature > -14 && $temprature <= -13.5)
        {
            $temprature = -20.7;
        }
        else if($temprature > -14.5 && $temprature <=-14)
        {
            $temprature = -21.5;
        }
else if($temprature > -15 && $temprature <=-14.5)
        {
            $temprature = -21.5;
        }
else if($temprature > -6.5 && $temprature <=-6)
        {
            $temprature = -21.2;
        }
else if($temprature > -7 && $temprature <=-6.5)
        {
            $temprature = -21.8;
        }
}
    elseif($set_temp == 4 && $set_temp_to == 8)
    {
        if($temprature >= 0 && $temprature <= 4)
        {
            $temprature = 4;
        }
        else if($temprature > 4 && $temprature <= 8)
        {
            $temprature = $temprature;
        }
        else if($temprature>8 && $temprature<=9)
        {
            $temprature = 4.1;
        }
        else if($temprature>9 && $temprature<=10)
        {
            $temprature = 4.2;
        }
        else if($temprature>10 && $temprature<=11)
        {
            $temprature = 4.3;
        }
        else if($temprature>11 && $temprature<=12)
        {
            $temprature = 4.4;
        }
        else if($temprature>12 && $temprature<=13)
        {
            $temprature = 4.5;
        }
        else if($temprature>13 && $temprature<=14)
        {
            $temprature = 4.6;
        }
        else if($temprature>14 && $temprature<=15)
        {
            $temprature = 4.7;
        }
        else if($temprature>15 && $temprature<=16)
        {
            $temprature = 4.8;
        }
        else if($temprature>16 && $temprature<=17)
        {
            $temprature = 4.9;
        }
        else if($temprature>17 && $temprature<=18)
        {
            $temprature = 5;
        }
        else if($temprature>18 && $temprature<=19)
        {
            $temprature = 5.1;
        }
        else if($temprature>19 && $temprature<=20)
        {
            $temprature = 5.2;
        }
        else if($temprature>20 && $temprature<=21)
        {
            $temprature = 5.3;
        }
        else if($temprature>21 && $temprature<=22)
        {
            $temprature = 5.4;
        }
        else if($temprature>22 && $temprature<=23)
        {
            $temprature = 5.5;
        }
        else if($temprature>23 && $temprature<=24)
        {
            $temprature = 5.6;
        }
        else if($temprature>24 && $temprature<=25)
        {
            $temprature = 5.7;
        }
        else if($temprature>25 && $temprature<=26)
        {
            $temprature = 5.8;
        }
        else if($temprature>26 && $temprature<=27)
        {
            $temprature = 5.9;
        }
        else if($temprature>27 && $temprature<=28)
        {
            $temprature = 6;
        }
        else if($temprature>28 && $temprature<=29)
        {
            $temprature = 6.1;
        }
        else if($temprature>29 && $temprature<=30)
        {
            $temprature = 6.2;
        }
        else if($temprature>30 && $temprature<=31)
        {
            $temprature = 6.3;
        }
        else if($temprature>31 && $temprature<=32)
        {
            $temprature = 6.4;
        }
        else if($temprature>32 && $temprature<=33)
        {
            $temprature = 6.5;
        }
        else if($temprature>33 && $temprature<=34)
        {
            $temprature = 6.6;
        }
        else if($temprature>34 && $temprature<=35)
        {
            $temprature = 6.7;
        }
        else if($temprature>35 && $temprature<=36)
        {
            $temprature = 6.8;
        }
        else if($temprature>36 && $temprature<=37)
        {
            $temprature = 6.9;
        }
        else if($temprature>37 && $temprature<=38)
        {
            $temprature = 7;
        }
        else if($temprature>38 && $temprature<=39)
        {
            $temprature = 7.1;
        }
        else if($temprature>39 && $temprature<=40)
        {
            $temprature = 7.2;
        }
        else if($temprature>40 && $temprature<=41)
        {
            $temprature = 7.3;
        }
        else if($temprature>41 && $temprature<=42)
        {
            $temprature = 7.4;
        }
        else if($temprature>42)
        {
            $temprature = 7.5;
        }
    }
 
    return $temprature;
}
 
function SetTempLessVal($set_temp,$set_temp_to,$temprature)
{
    if($set_temp == 18 && $set_temp_to == 25)
    {
        if($temprature>=0 && $temprature<=8)
        {
            $temprature = 18;
        }
        else if($temprature>8 && $temprature<=12)
        {
            $temprature = 18.3;
        }
        else if($temprature>12 && $temprature<=14)
        {
            $temprature = 18.5;
        }
        else if($temprature>14 && $temprature<18)
 
        {
            $temprature = 19;
        }
    }
    else if($set_temp == 18 && $set_temp_to == 22)
    {
        if($temprature>=0 && $temprature<=8)
        {
            $temprature = 18;
        }
        else if($temprature>8 && $temprature<=12)
        {
            $temprature = 18.5;
        }
        else if($temprature>12 && $temprature<=14)
        {
            $temprature = 19;
        }
        else if($temprature>14 && $temprature<18)
        {
            $temprature = 19.5;
        }
        else if($temprature > -40 && $temprature<0)
        {
            $temprature = 18.2;
        }
    }
    elseif($set_temp == 0 && $set_temp_to == 4)
    {
        if($temprature < 0 && $temprature >= -8)
        {
            $temprature = 0;
        }
        else if($temprature < -8 && $temprature >= -12)
        {
            $temprature = 0.3;
        }
        else if($temprature < -12 && $temprature >= -14)
        {
            $temprature = 0.5;
        }
        else if($temprature < -14 && $temprature > -18)
        {
            $temprature = 1;
        }
        else if($temprature < -18 && $temprature > -40)
        {
            $temprature = 0;
        }
        /*else if($navData[$na]["tel_temperature"] < -18 && $navData[$na]["tel_temperature"] > -40)
        {
            $navData[$na]["tel_temperature"] = 0;
        }*/
    }
    elseif($set_temp == -25 && $set_temp_to == -18)
    {
        if($temprature > -8.5 && $temprature <= -1)
        {
            $temprature = -18.1;
        }
        else if($temprature > -9 && $temprature <= -8.5)
        {
            $temprature = -18.3;
        }
        else if($temprature > -9.5 && $temprature <= -9)
        {
            $temprature = -18.6;
        }
        else if($temprature > -10 && $temprature <=-9.5)
        {
            $temprature = -18.9;
        }
else if($temprature >= -10.5 && $temprature <= -10)
        {
            $temprature = -19.3;
        }
else if($temprature >= -10.34 && $temprature <= -10.2)
        {
            $temprature = -19.4;
        }
        else if($temprature > -11 && $temprature <= -10.25)
        {
            $temprature = -19.6;
        }
        else if($temprature > -11.25 && $temprature <=-11)
        {
            $temprature = -20;
        }
        else if($temprature >= -12 && $temprature <= -11.25)
        {
            $temprature = -20.7;
        }
        else if($temprature > -12.5 && $temprature <=-12.1)
        {
            $temprature = -21;
        }
else if($temprature > -13 && $temprature <= -12.5)
        {
            $temprature = -20.7;
        }
        else if($temprature > -13.5 && $temprature <=-13)
        {
            $temprature = -21.5;
        }
else if($temprature > -14 && $temprature <= -13.5)
        {
            $temprature = -20.7;
        }
        else if($temprature > -14.5 && $temprature <=-14)
        {
            $temprature = -21.5;
        }
else if($temprature > -15 && $temprature <=-14.5)
        {
            $temprature = -21.5;
        }
else if($temprature > -6.5 && $temprature <=-6)
        {
            $temprature = -21.2;
        }
else if($temprature > -7 && $temprature <=-6.5)
        {
            $temprature = -21.8;
        }
    }
    elseif($set_temp == 4 && $set_temp_to == 8)
    {
        if($temprature >= 0 && $temprature <= 4)
        {
            $temprature = 4;
        }
        else if($temprature < 0 && $temprature >= -8)
        {
            $temprature = 4;
        }
        else if($temprature < -8 && $temprature >= -12)
        {
            $temprature = 4.3;
        }
        else if($temprature < -12 && $temprature >= -14)
        {
            $temprature = 4.5;
        }
        else if($temprature < -14 && $temprature > -18)
        {
            $temprature = 5;
        }
        else if($temprature < -18 && $temprature > -40)
        {
            $temprature = 0.1;
        }
    }
 
    return $temprature;
}
 
$southLat = array("15.623037 73.916016","16.045813 74.179688","16.720385 74.707031","16.972741 75.322266","17.308688 75.761719","17.392579 76.201172","17.978733 76.904297","18.145852 77.167969","18.479609 77.695313","19.062118 77.958984","19.642588 78.310547","19.642588 79.189453","19.559790 79.277344","19.311143 79.716797","18.812718 80.068359","18.562947 80.244141","18.145852 80.507813","17.727759 80.947266","17.811456 81.474609","17.895114 81.738281","18.229351 82.177734","18.479609 82.529297","18.812718 83.056641","18.979026 83.496094","18.979026 83.847656","19.062118 84.462891","19.062118 84.726563","18.646245 84.902344","18.312811 84.287109","17.560247 83.847656","15.961329 82.177734","14.859850 81.562500","14.264383 81.562500","12.897489 81.123047","11.523088 80.859375","10.833306 80.859375","10.055403 79.892578","9.362353 79.365234","8.667918 78.662109","7.798079 78.222656","7.798079 76.376953","8.146243 75.585938","9.709057 75.234375","10.487812 75.058594","12.897489 74.179688","13.838080 73.740234","14.859850 73.564453","15.284185 73.037109","15.707663 73.300781","15.707663 73.740234");
 
$NorthLat = array(  "24.607069 71.279297","24.607069 71.718750","24.447150 72.333984","24.287027 72.949219","24.126702 73.212891","23.725012 73.564453","23.483401 73.828125","23.160563 74.267578","23.241346 74.443359","23.402765 74.707031","23.644524 74.970703","24.287027 74.970703","24.527135 75.058594","24.686952 75.058594","24.846565 75.234375","24.846565 75.410156","24.447150 75.673828","24.367114 76.113281","24.287027 76.640625","24.447150 76.992188","24.926295 77.080078","25.165173 77.255859","25.403585 76.904297","25.562265 76.816406","25.878994 76.816406","26.194877 77.255859","26.588527 77.871094","26.824071 78.134766","26.745610 78.486328","26.509905 79.101563","26.115986 79.189453","25.799891 79.189453","25.562265 78.837891","25.085599 78.486328","24.686952 78.486328","24.287027 78.750000","24.367114 79.013672","24.846565 79.013672","25.165173 79.277344","25.165173 79.716797","25.165173 80.156250","25.244696 80.332031","25.005973 80.507813","24.766785 80.947266","24.846565 81.298828","24.926295 81.562500","25.085599 81.826172","24.926295 82.265625","24.527135 82.617188","24.287027 82.968750","24.206890 83.496094","24.766785 83.408203","25.085599 83.408203","25.244696 83.759766","25.403585 84.111328","25.562265 84.375000","25.799891 84.462891","26.115986 84.375000","26.431228 84.111328","26.980829 84.023438","27.293689 83.759766","27.605671 82.792969","28.071980 81.562500","28.459033 80.507813","28.998532 80.156250","29.611670 80.595703","30.069094 80.859375","30.297018 80.947266","30.600094 80.419922","31.052934 79.804688","31.353637 79.277344","31.802893 79.013672","32.324276 78.837891","32.620870 79.101563","32.842674 79.541016","33.358062 79.453125","34.016242 79.541016","34.524661 79.892578","35.029996 80.507813","35.460670 80.595703","35.889050 79.980469","36.031332 79.013672","36.031332 78.134766","36.315125 77.343750","36.668419 76.728516","37.090240 75.673828","37.230328 74.882813","36.949892 73.652344","36.456636 72.949219","35.960223 72.597656","35.317366 72.949219","34.379713 73.125000","33.504759 73.564453","32.768800 74.091797","32.101190 74.267578","31.203405 74.267578","30.902225 74.091797","30.524413 73.740234","30.297018 73.476563","29.764377 73.037109","29.305561 72.773438","28.921631 71.894531","28.613459 71.542969","28.226970 70.664063","28.149503 69.785156","27.916767 69.521484","26.902477 69.345703","25.878994 69.697266","25.482951 70.136719","25.085599 70.400391","24.686952 70.839844","24.527135 71.191406");
 
$EastLat = array("30.069094 81.035156","29.993002 80.595703","29.458731 80.332031","29.075375 80.332031","28.690588 80.332031","28.381735 81.035156","28.226970 81.474609","27.916767 82.177734","27.527758 82.968750","27.293689 84.111328","26.667096 84.287109","25.799891 84.375000","25.562265 83.847656","24.846565 83.496094","24.206890 83.583984","23.483401 83.759766","22.998852 84.111328","22.593726 84.199219","21.698265 83.671875","21.043491 82.968750","20.797201 82.353516","20.550509 82.353516","20.220966 82.177734","19.890723 82.089844","19.559790 82.089844","18.979026 81.826172","18.479609 81.650391","18.062312 81.562500","17.644022 81.298828","17.978733 82.265625","18.479609 83.056641","18.979026 83.583984","18.979026 84.023438","19.062118 84.726563","19.311143 85.429688","19.559790 86.132813","20.468189 87.099609","20.715015 87.187500","21.207459 87.626953","21.371244 88.593750","21.534847 89.912109","21.453069 91.054688","20.961440 91.142578","20.385825 91.933594","20.138470 92.988281","20.550509 94.306641","22.674847 94.921875","25.562265 96.416016","26.194877 96.767578","29.688053 96.679688","30.221102 95.537109","30.297018 94.658203","30.221102 93.515625","29.916852 91.230469","29.611670 89.208984","29.458731 86.835938","29.611670 84.726563","30.675715 82.792969","30.751278 81.474609","29.840644 80.683594");
 
$WESTLat = array("24.447150 71.367188","24.447150 71.103516","24.367114 70.751953","24.447150 70.224609","24.447150 69.345703","24.447150 68.818359","24.046464 68.378906","23.725012 68.115234","23.322080 68.115234","22.593726 68.642578","22.105999 68.730469","21.453069 69.082031","21.043491 69.960938","20.961440 70.576172","20.550509 71.103516","20.468189 71.630859","19.808054 71.894531","19.228177 71.894531","17.727759 72.246094","16.804541 72.509766","16.299051 72.773438","15.792254 72.949219","15.368950 73.212891","15.538376 73.740234","15.707663 74.179688","16.383391 74.355469","16.636192 74.707031","17.140790 75.322266","17.392579 76.025391","17.727759 76.464844","18.062312 77.343750","18.562947 77.871094","19.311143 78.222656","19.725342 78.574219","19.725342 79.541016","19.394068 80.068359","18.729502 80.419922","18.396230 80.771484","18.062312 81.210938","18.229351 81.386719","19.062118 82.001953","19.890723 82.177734","20.055931 82.177734","20.055931 82.529297","20.632784 82.441406","20.961440 82.792969","21.207459 83.232422","21.943046 83.408203","22.268764 83.759766","22.674847 84.023438","22.917923 84.375000","23.644524 84.023438","24.287027 83.583984","24.287027 83.320313","24.126702 82.968750","24.367114 82.617188","24.846565 82.353516","25.165173 81.474609","25.165173 80.771484","25.324167 79.980469","25.403585 79.541016","25.562265 79.365234","25.799891 79.277344","26.273714 79.189453","26.588527 79.013672","26.667096 78.310547","26.667096 78.046875","26.667096 77.607422","26.431228 77.080078","26.115986 76.904297","25.878994 76.728516","25.482951 76.992188","25.244696 77.167969","24.846565 77.167969","24.527135 76.728516","24.447150 76.640625","24.287027 76.025391","24.287027 75.849609","24.367114 75.322266","24.206890 75.146484","23.885838 74.882813","23.563987 74.794922","23.322080 74.443359","23.402765 73.740234","23.885838 73.476563","24.527135 73.125000","24.686952 72.246094","24.766785 71.718750","24.527135 71.455078");
 
if($_REQUEST['RefTime'] == "")
{
    if(in_array($_SESSION['sys_group_id'], $refresh30sec) || in_array($_SESSION['sys_group_id_parent'], $refresh30sec)) {
		$RefTime = 0.5;
	} else {
		$RefTime = 30;
	}
}
else
{
    $RefTime = $_REQUEST['RefTime'];
}
 
$Action = isset($_GET['request']) ? $_GET['request'] : "";
if($Action!="")
{
     $html.= '';
 
 
     if($_SESSION['UserId']==79938 || $_SESSION['UserId']==79949 || $_SESSION['UserId']==79950 || $_SESSION['UserId']==79951 || $_SESSION['sys_group_id']==51352) {
 
 
            $html.= '';
       
 
            }
                       
    if( in_array($_SESSION['sys_group_id'], $extraShowInBranch))
    {
        //$controlling_branch=$allSeesionData[$r]["thana_name"];
        $html.= '';
    }
 
    if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type))
    {
        $html.= '';
    }
       
    $html.= '';
   
if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT))
{
 $html.= '';
}

    if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)){
     
	} else if ($_SESSION['Vehicle_type']=="1"){ 
       $html.= '';
    } else {
        $html.= '';
        $html.= '';
    }
 
 
    if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" )
    {
        $html.= '';
    }
    else  if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
    {
        $html.= '';
    }
    else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
    {
        $html.= '';
    }
    else if(in_array($_SESSION['sys_group_id'], $journeyMapinall) or in_array($_SESSION['sys_group_id_parent'], $journeyMapinall))
    {
        $html.= '';
    }
    else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow))
    {
        $html.= '';
    }
    if($_SESSION['UserId']=="79749" || $_SESSION['UserId']=="79748" )
    {
        $html.= '';
    }
 
    else
    {
        $html.= '';
    }
           
           
    if( in_array($_SESSION['sys_group_id'], $extraShowInall))
    {
            if($_SESSION['sys_group_id']=="6364")
            {
                    $html.= '';
            }
            else if($_SESSION['sys_group_id']=="6173")
            {
                $html.= '';
            }
            else if($_SESSION['sys_group_id']=="7502")
            {
                $html.= '';
            }
            else if($_SESSION['sys_group_id']=="4563")
            {
                $html.= '';
            }
			else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow))
			{
                $html.= '';
            }
            else if($_SESSION['sys_group_id']=="3171")
            {
                $html.= '';
            }
    }
 
     if(in_array($_SESSION['sys_group_id'], $notWorkingComment))
     {
             $html.= '';
     }
 
    $html.= '';
 
    $htmlpdf.= '
SNo Vehicle NumberRun Type Vendor Name Controlling BranchTypeLocation Name Last update Halting Hour SpeedBattery Status Headlight StatusVehicle StatusNearest POIZoneIdle TimeTemperatureAC StatusTrip on mapCircle NameSDOVendor NameDestinationOwner Transporter NameSupllier TypeParty NameRunning StatusDistrict StateModelDriver NumberService Comment
'; if( in_array($_SESSION['sys_group_id'], $extraShowInBranch)) { //$controlling_branch=$allSeesionData[$r]["thana_name"]; $htmlpdf.= ''; } if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type)) { $htmlpdf.= ''; } $htmlpdf.= ''; if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) { $htmlpdf.= ''; } if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)){ } else if ($_SESSION['Vehicle_type']=="1"){ $htmlpdf.= ''; } else { $htmlpdf.= ''; $htmlpdf.= ''; } if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" ) { $htmlpdf.= ''; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { $htmlpdf.= ''; } else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $htmlpdf.= ''; } else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { $htmlpdf.= ''; } else { $htmlpdf.= ''; } if( in_array($_SESSION['sys_group_id'], $extraShowInall)) { if($_SESSION['sys_group_id']=="6364") { $htmlpdf.= ''; } else if($_SESSION['sys_group_id']=="6173") { $htmlpdf.= ''; } else if($_SESSION['sys_group_id']=="7502") { $htmlpdf.= ''; } else if($_SESSION['sys_group_id']=="4563") { $htmlpdf.= ''; } else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) { $htmlpdf.= ''; } else if($_SESSION['sys_group_id']=="3171") { $htmlpdf.= ''; } } if(in_array($_SESSION['sys_group_id'], $notWorkingComment)) { $htmlpdf.= ''; } $htmlpdf.= ''; for ($i = 0; $i < count($_POST['vehicleno']); ++$i) { $html.=''; if($_SESSION['UserId']==79938 || $_SESSION['UserId']==79949 || $_SESSION['UserId']==79950 || $_SESSION['UserId']==79951 || $_SESSION['sys_group_id']==51352) { $html.=''; $html.=''; } if( in_array($_SESSION['sys_group_id'], $extraShowInBranch)) { $html.=''; } if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type)) { $html.=''; } $html.=''; if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) { $html.=''; $html.=''; } if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { } else if ($_SESSION['Vehicle_type']=="1"){ $html.=''; } else { $html.=''; $html.=''; } if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" ) { $html.=''; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { $html.=''; } else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $html.=''; } else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { $html.= ''; } else { $html.=''; } if(in_array($_SESSION['sys_group_id'], $extraShowInall)) { if($_SESSION['sys_group_id']=="6173") { $html.=''; } else if($_SESSION['sys_group_id']=="7502") { $html.=''; } else if($_SESSION['sys_group_id']=="4563") { $html.=''; } else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) { $html.=''; } else if($_SESSION['sys_group_id']=="3171") { $html.= ''; } } if(in_array($_SESSION['sys_group_id'], $notWorkingComment)) { $html.= ''; } $html.=''; $htmlpdf.=''; if( in_array($_SESSION['sys_group_id'], $extraShowInBranch)) { $htmlpdf.=''; } if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type)) { $htmlpdf.=''; } $htmlpdf.=''; if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) { $htmlpdf.=''; $htmlpdf.=''; } if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { } else if ($_SESSION['Vehicle_type']=="1"){ $htmlpdf.=''; } else { $htmlpdf.=''; $htmlpdf.=''; } if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" ) { $htmlpdf.=''; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { $htmlpdf.=''; } else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $htmlpdf.=''; } else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { $htmlpdf.= ''; } else { $htmlpdf.=''; } if( in_array($_SESSION['sys_group_id'], $extraShowInall)) { if($_SESSION['sys_group_id']=="6173") { $htmlpdf.=''; } else if($_SESSION['sys_group_id']=="7502") { $htmlpdf.=''; } else if($_SESSION['sys_group_id']=="4563") { $htmlpdf.=''; } else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) { $htmlpdf.=''; } else if($_SESSION['sys_group_id']=="3171") { $htmlpdf.= ''; } } if(in_array($_SESSION['sys_group_id'], $notWorkingComment)) { $htmlpdf.= ''; } $htmlpdf.=''; } $reportHeader='All vehicle detail generated at '.date("Y-m-d H:i").'

'; $mainHeader = '
Vehicle NumberControlling BranchTypeLocation Name Last update Halting Hour SpeedBattery Status Headlight StatusVehicle StatusNearest POIZoneIdle TimeTemperatureAC StatusCircle NameSDODestinationOwner Transporter NameSupllier TypeParty NameRunning StatusDistrict StateModelDriver Name Driver NumberService Comment
'.$_POST['sr_no'][$i].' '.$_POST['vehicleno'][$i].''.$_POST['runtype'][$i].''.$_POST['vendorName'][$i].''.$_POST['controlling_branch'][$i].''.$_POST['vehicle_type'][$i].''.$_POST['location'][$i].' '.$_POST['lastupdate'][$i].' '.$_POST['halted_hour'][$i].' '.$_POST['speed'][$i].''.$_POST['battery_status'][$i].''.$_POST['headlight'][$i].''.$_POST['trip_status'][$i].''.$_POST['poiname'][$i].''.$_POST['Zone'][$i].''.$_POST['idletime'][$i].''.$_POST['destination'][$i].''.$_POST['destination'][$i].''.$_POST['aconoff'][$i].''.$_POST['circle_name'][$i].' '.$_POST['sdo_name'][$i].''.$_POST['destination'][$i].''.$_POST['gaddimalik'][$i].''.$_POST['gaddimalik'][$i].''.$_POST['running_status'][$i].''.$_POST['District'][$i].' '.$_POST['State'][$i].''.$_POST['model'][$i].''.$_POST['driver'][$i].' '.$_POST['number'][$i].''.$_POST['comment'][$i].'
'.$_POST['vehicleno'][$i].''.$_POST['controlling_branch'][$i].''.$_POST['vehicle_type'][$i].''.$_POST['location'][$i].' '.$_POST['lastupdate'][$i].' '.$_POST['halted_hour'][$i].' '.$_POST['speed'][$i].''.$_POST['battery_status'][$i].''.$_POST['headlight'][$i].''.$_POST['trip_status'][$i].''.$_POST['poiname'][$i].''.$_POST['Zone'][$i].''.$_POST['destination'][$i].''.$_POST['destination'][$i].''.$_POST['aconoff'][$i].''.$_POST['circle_name'][$i].' '.$_POST['sdo_name'][$i].''.$_POST['destination'][$i].''.$_POST['gaddimalik'][$i].''.$_POST['gaddimalik'][$i].''.$_POST['running_status'][$i].''.$_POST['District'][$i].' '.$_POST['State'][$i].''.$_POST['model'][$i].''.$_POST['driver'][$i].' '.$_POST['number'][$i].''.$_POST['comment'][$i].'

All vehicle detail generated at '.date("Y-m-d H:i").'

'; $finalHtml= $mainHeader.$html; $finalPDF= $reportHeader.$htmlpdf; if(substr($finalHtml,(strlen($finalHtml)-8),strlen($finalHtml))!="") { $finalHtml=$finalHtml.""; } if(substr($finalPDF,(strlen($finalPDF)-8),strlen($finalPDF))!="") { $finalPDF=$finalPDF.""; } if($_POST['AllVehicleExcel'] == "AllVehicleExcel") { $filepointer=fopen(__DOCUMENT_ROOT.'/reports/excel_reports/all_vehicle'.$_SESSION['clientid'].".xls",'w'); fwrite($filepointer,$finalHtml); fclose($filepointer); header("location:".__SITE_URL."/reports/excel_reports/all_vehicle".$_SESSION['clientid'].".xls"); } elseif($_POST['AllVehiclePDF'] == "AllVehiclePdf") { require(__DOCUMENT_ROOT.'/html2fpdf/html2fpdf.php'); require(__DOCUMENT_ROOT.'/html2fpdf/fpdf.php'); $pdf=new HTML2FPDF("p","mm","A3"); $pdf->AddPage(); $pdf->Image(__DOCUMENT_ROOT."/reports/gtrac-logo.jpg",10,10); $pdf->WriteHTML($finalPDF); //$pdf->Output(reportFileLocation.$_SESSION['clientid'].".pdf"); //echo "pdf_reports/".$_SESSION['clientid'].".pdf"; $pdf->Output(__DOCUMENT_ROOT."/reports/pdf_reports/all_vehicle".$_SESSION['clientid'].".pdf"); header("location:".__SITE_URL."/reports/pdf_reports/all_vehicle".$_SESSION['clientid'].".pdf"); } } ?>

All Vehicles

pointInPolygon($point, $southLat); $statusNorth=$pointLocation->pointInPolygon($point, $NorthLat); $statusEast=$pointLocation->pointInPolygon($point, $EastLat); $statuswest=$pointLocation->pointInPolygon($point, $WESTLat); if($statusSouth!="outside" ) { $SouthCnt+=1; } else if($statusNorth!="outside" ) { $NorthCnt=$NorthCnt+1; } else if($statusEast!="outside" ) { $EastCnt+=1; } else if($statuswest!="outside" ) { $WestCnt+=1; } }?>

N

S

E

W

Idle Time"; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboardwithDesti) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboardwithDesti)) { echo ""; echo ""; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { echo ""; } else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { echo ""; } else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { echo ""; } else if(in_array($_SESSION['sys_group_id'], $journeyMapinall) or in_array($_SESSION['sys_group_id_parent'], $journeyMapinall)) { echo ""; } if($_SESSION['UserId']=="79749" || $_SESSION['UserId']=="79748" ) { echo ""; } else if ($_SESSION['Vehicle_type']=="1111"){ echo ""; echo ""; echo ""; } else { echo ""; } if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) {?> ";print_r($allSeesionData);die; if($allSeesionData[0]["veh_reg"] != "") { $runLoop = count($allSeesionData); } else { $runLoop = 0; } for($r=0;$r<$runLoop;$r++) { $Zone=""; $SlNo=$r+1; $VehicleNumber=$allSeesionData[$r]["veh_reg"]; $vendorName=$allSeesionData[$r]["thana_name"]; $runtype=$allSeesionData[$r]["veh_remark"]; $second_temp = $allSeesionData[$r]["jny_distance"]; /* redis location name */ if($redis->exists('itgc_locationsnew')) { // echo $allSeesionData[$r]['gps_longitude'].'----'.$allSeesionData[$r]['gps_latitude']; // echo "
"; // get geo poi data if($redis_geopoi_data=get_geoPoi($sess_userid.':geopois',$allSeesionData[$r]["gps_longitude"],$allSeesionData[$r]["gps_latitude"],'500000','m',$redis)) { $redis_poi_km = round($redis_geopoi_data[0][1]/1000,0).' Km From '; // poi km redis $redis_poi_name = str_replace(' ','_',$redis_geopoi_data[0][0]);//get redis poi name $redis_inside_poi = str_replace(' ','_',$redis_geopoi_data[0][0]);//get redis poi name $redis_poi_hset = json_decode(getPoi($sess_userid,$redis_poi_name,$redis)); // function to get stored poi data redis // check if the vehicle is inside the poi if($redis_geopoi_data[0][1] <= $redis_poi_hset->radius) { // if inside the poi get the poi name $LocationName = $redis_geopoi_data[0][0]; // redis poiname $redis_inside_poi = 'INSIDE POI'; $redis_poi_km =''; } else { // if the out of poi get the vehine locaiton name redis geodata $get_data = get_geoData('itgc_locationsnew',$allSeesionData[$r]["gps_longitude"],$allSeesionData[$r]["gps_latitude"],'5000','m',$redis); $LocationName = str_replace('_',' ',$get_data[0][0]);// redis location name $lat = $get_data[0][2][1]; // getting lat redis $lng = $get_data[0][2][0]; // getting lng redis $LocationName = (!empty($LocationName))? $LocationName.' ('.$lat.','.$lng.')':$allSeesionData[$r]['gps_longitude'].','.$allSeesionData[$r]['gps_latitude']; // $LocationName = 'redis locatio'; } } else { // if the out of poi get the vehine locaiton name redis geodata $get_data = get_geoData('itgc_locationsnew',$allSeesionData[$r]["gps_longitude"],$allSeesionData[$r]["gps_latitude"],'5000','m',$redis); $LocationName = str_replace('_',' ',$get_data[0][0]);// redis location name $lat = $get_data[0][2][1]; // getting lat redis $lng = $get_data[0][2][0]; // getting lng redis $LocationName = (!empty($LocationName))? $LocationName.' ('.$lat.','.$lng.')':$allSeesionData[$r]['gps_longitude'].','.$allSeesionData[$r]['gps_latitude']; // $LocationName = 'redis locatio'; } } else { //echo "Location";exit; /* pdf/excel location name in case the redis key does not exists */ $Locationdata = $masterObj->GetLocationWitPOI($allSeesionData[$r]["gps_latitude"].','.$allSeesionData[$r]["gps_longitude"]); $LocationNameArr = explode("##",$Locationdata); $LocationName = $LocationNameArr[0]; if($LocationNameArr[1]=="") { $redis_inside_poi = "INSIDE POI"; } else { $redis_inside_poi = $LocationNameArr[1]; } /* pdf/excel location name */ } /* redis location name end */ //if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard)) if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { if(in_array($allSeesionData[$r]["sys_service_id"], $DualsensorVehicleID) or $allSeesionData[$r]["des_movement_id"]=="1409211") { $tel_temp=$allSeesionData[$r]["jny_distance"]; } else { $tel_temp=$allSeesionData[$r]["tel_temperature"]; } if($tel_temp>50 && $tel_temp<-50) { $tel_temp="--"; } /* if($allSeesionData[$r]["sys_service_id"]=="54368") { $tempOfPrevious= db__select("select tel_temperature from matrix.latest_telemetry where tel_temperature<50 and sys_service_id=54039", $condition); $tel_temp=$tempOfPrevious[0]["tel_temperature"]-1; }*/ if($_SESSION['ParentId'] == '7607' || $_SESSION['ParentId'] == '4871' || $_SESSION['UserId'] == '81548' ) { $Temp_data = db__select_staging("select t2_temp,set_temp,set_temp_to from matrix.temperature_manual_entry_tbl where sys_veh_id='".$allSeesionData[$r]["sys_service_id"]."' and '".$allSeesionData[$r]["gps_time"]."' BETWEEN start_date AND end_date order by id desc ", $condition); //echo "
";print_r($Temp_data);die;
                       
                            if(count($Temp_data)>0)
                            {
                                $div_temp = $Temp_data[0]['t2_temp'];
                           
                                if($Temp_data[0]['set_temp'] != '' && $Temp_data[0]['set_temp_to'] != '' && $Temp_data[0]["set_temp_to"] != 0)
                                  {
                               
                                     if($Temp_data[0]["set_temp"] == -18 && $Temp_data[0]["set_temp_to"] == -25)
                                     {
                                         $Temp_data[0]["set_temp"] = -25;
                                         $Temp_data[0]["set_temp_to"] = -18;
                                     }
                               
                               
                                    if($allSeesionData[$r]["tel_temperature"]>=$Temp_data[0]['set_temp'] && $allSeesionData[$r]["tel_temperature"]<=$Temp_data[0]['set_temp_to'])
                                    {
                                        $tel_temp=round(($allSeesionData[$r]["tel_temperature"]),2);
                                    }
                                    elseif($allSeesionData[$r]["tel_temperature"]<$Temp_data[0]['set_temp'])
                                    {
                                                                   
                                        $allSeesionData[$r]["tel_temperature"] = SetTempLessVal($Temp_data[0]["set_temp"],$Temp_data[0]["set_temp_to"],$allSeesionData[$r]["tel_temperature"]);
                                     
                                        $tel_temp=$allSeesionData[$r]["tel_temperature"];
                                   
                                   
                                    }
                                    else
                                    {
                                   
                                        $allSeesionData[$r]["tel_temperature"] = SetTempGreateVal($Temp_data[0]["set_temp"],$Temp_data[0]["set_temp_to"],$allSeesionData[$r]["tel_temperature"]);
                                     
                                        $tel_temp=$allSeesionData[$r]["tel_temperature"];
                                   
                                    }
                               }
                               else
                                {
                                    $tel_temp=round(($allSeesionData[$r]["tel_temperature"]-$div_temp),2);
                                }
                            }
                            else
                            {
                                $div_temp = 0;
                                $tel_temp=round(($allSeesionData[$r]["tel_temperature"]-$div_temp),2);
                            }
                       
                       
                            //$tel_temp=round(($allSeesionData[$r]["tel_temperature"]-$div_temp),2);
                   
                        }
                   
                        if($tel_temp=="" || $tel_temp=="0.000000")
                        {
                            $temptoday1 = db__select("select round(tel_temperature,2) as tel_temperature  from matrix.today_ideal where tel_temperature!=0   and  tel_temperature<50 and   today_ideal.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition);
                       
                            $tel_temp=$temptoday1[0]["tel_temperature"];
 
    if($tel_temp=="" || $tel_temp=="0.000000")
    {
 
    $temptoday1 = db__select("select round(tel_temperature,2) as tel_temperature  from matrix.telemetry where tel_temperature!=0   and  tel_temperature<50 and   telemetry.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition);
                       
                            $tel_temp=$temptoday1[0]["tel_temperature"];
    }
                        }
               
                    }
                    else
                    {
                        $tel_temp="";
                    }
 
 
if($tel_temp>50){
                                        $tel_temp="";
                                    } else if($tel_temp<-40) {
                                        $tel_temp="";
                                    }
                    if (in_array($_SESSION['UserId'], $with_remark_allvhl))
                    {
                        $VehicleNumber=$allSeesionData[$r]["veh_reg"]."--".$allSeesionData[$r]["veh_remark"];
                    }
               
                    //$Locationdata=$masterObj->GetLocationWitPOI($allSeesionData[$r]["gps_latitude"].','.$allSeesionData[$r]["gps_longitude"]);
                    $sys_service_id = $allSeesionData[$r]["sys_service_id"];
                    $point=$allSeesionData[$r]["gps_latitude"]." " .$allSeesionData[$r]["gps_longitude"];
                    $points = array(".$point.");
if(in_array($_SESSION['sys_group_id'], $ZonenotShow) || in_array($_SESSION['sys_group_id_parent'], $ZonenotShow)) {
                   
                    } else {
               
                    $statusSouth=$pointLocation->pointInPolygon($point, $southLat);
                    if($statusSouth!="outside" )
                    {
                        $Zone="South";
                        $SouthCnt+=1;
                    }
                    $statusNorth=$pointLocation->pointInPolygon($point, $NorthLat);
                    if($statusNorth!="outside" )
                    {
                        $Zone="North";
                        $NorthCnt=$NorthCnt+1;
                    }
               
                    $statusEast=$pointLocation->pointInPolygon($point, $EastLat);
                    if($statusEast!="outside" )
                    {
                        $Zone="East";
                        $EastCnt+=1;
                    }
               
                    $statuswest=$pointLocation->pointInPolygon($point, $WESTLat);
                    if($statuswest!="outside" )
                    {
                        $Zone="West";
                        $WestCnt+=1;
                    }
}

                /*$Locationdata = $masterObj->GetLocationWitPOI($allSeesionData[$r]["gps_latitude"].','. $allSeesionData[$r]["gps_longitude"]);
        //$Locationdata="";
        $LocationNameArr= explode("##",$Locationdata);
        $LocationName=addslashes($LocationNameArr[0]);
$POIname=addslashes($LocationNameArr[1]);*/
               
                    //$LocationNameArr= explode("##",$Locationdata);
                    //$LocationName=$LocationNameArr[0];
                    $lastUpdate=$allSeesionData[$r]["gps_time"];
                    $Speed=$allSeesionData[$r]["gps_speed"];
                    // $KMFromNearPOI=$LocationNameArr[1];
                    $halted_hour=$allSeesionData[$r]["HourDiff"];
                    $lat = $allSeesionData[$r]["gps_latitude"];
                    $lng = $allSeesionData[$r]["gps_longitude"];
                    $Destination=$allSeesionData[$r]["veh_destination"];
                    $chkdata=$allSeesionData[$r]["chkdata"];
                    $timeDiff=$allSeesionData[$r]["timeDiff"];
                    $veh_status=$allSeesionData[$r]["veh_status"];
					$Distancetoempty=$allSeesionData[$r]["tel_rfid"];
					$odometer=$allSeesionData[$r]["tel_odometer"];
					if($allSeesionData[$r]["sys_asset_id"]=="0C")
					{
						$Chargingstatus="Slow Charging";
					}
					else if($allSeesionData[$r]["sys_asset_id"]=="01")
					{
					$Chargingstatus="Fast Charging";
					}
					else
					{
						$Chargingstatus="";
					}


					if ($_SESSION['Vehicle_type']=="1111"){						
					$getInTransitVeh = db__select("select trip_status,last_comment from matrix.client_veh_trip_status where 
					sys_service_id=".$allSeesionData[$r]["sys_service_id"]." and is_active='1' ", "");
	
                     $trip_status =$getInTransitVeh[0]["trip_status"];
					 $lastcomment =$getInTransitVeh[0]["last_comment"];
					}
					
                    //
               
               
                    /*$content_idle .='{ slno: "'.$SlNo.'", vehno: "'.$VehicleNumber.'", LocationName: "'.$LocationName.'", lastUpdate: "'.$lastUpdate.'", IdleHour: "'.$IdleHour.'", KMFromNearPOI: "'.$KMFromNearPOI.'", lat: "'.$lat.'", lng: "'.$lng.'" },';*/
                    if($chkdata>=24)
                    {
                        $halted_hour=0;
                        $timeDiff="00:00:00";
                    }
               
                    $showCss="";
                    if( $halted_hour>=3)
                    {
                        $showCss='class="warning"';
                    }
               
                    $VDP = explode(" - ",$allSeesionData[$r]["veh_remark"]);
               
                    if($VDP[0]=='VDP MODE')
                    {
                        $showCss='class="danger"';
                    }
 
                       // if($LocationNameArr[1]=="")
                       // {
                       // $KMFromNearPOI="INSIDE POI";
                       // }
 
                          /* $content_all_veh .='{ slno: "'.$SlNo.'", vehno: "'.$VehicleNumber.'", LocationName: "'.$LocationName.'", lastUpdate: "'.$lastUpdate.'", speed: "'.$Speed.'", KMFromNearPOI: "'.$KMFromNearPOI.'", lat: "'.$lat.'", lng: "'.$lng.'" },';*/
 
                        ?>
                  
> '.$timeDiff.'..'; $Destination=$timeDiff; ?> 0) { if($NstcDest[0]["station_to_lat"]>0) { $PointArray[0]['lat']=$NstcDest[0]["station_to_lat"]; $PointArray[0]['long']=$NstcDest[0]["station_to_long"]; $PointArray[1]['lat']=$lat; $PointArray[1]['long']=$lng; if($PointArray[1]['lat']!="") { $distance = $calcObj->calc_distance_proximity($PointArray); } } else { $TOlatlong=Get_LatLng_From_Google_Maps($NstcDest[0]["station_to_location"]); if($TOlatlong['formatted_address'] == '' && $TOlatlong['lat'] == '' && $TOlatlong['lng'] == '') { $formatted_address = ''; $lat1 = '00.000000000'; $long1= '00.000000000'; } else { $formatted_address = $TOlatlong['formatted_address']; $lat1 = $TOlatlong['lat']; $long1= $TOlatlong['lng']; $PointArray[0]['lat']=$lat1; $PointArray[0]['long']=$long1; $PointArray[1]['lat']=$lat; $PointArray[1]['long']=$lng; if($PointArray[1]['lat']!="") { $distance = $calcObj->calc_distance_proximity($PointArray); } } } echo ''; $Destination = $distance." KM from ".$NstcDest[0]["station_to_location"]; } } else if($_SESSION['UserId']=="4315" || $_SESSION['ParentId']=="4315" ) { $Destination=""; $mrlogdest = db__select("select destination from mrlog_tripdata where vehicle_number=".$sys_service_id." order by `current_time` desc limit 1"); $Destination =$mrlogdest[0]["destination"]; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboardwithDesti) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboardwithDesti)) { if($tel_temp!="" && $tel_temp!="0.000000") { $showTemp=round($tel_temp); echo ''; } else { echo ''; } $Destination = $allSeesionData[$r]["veh_destination"]; echo ''; } else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { if($sys_service_id=="70297") { $humi_temp = -21 .'°C '; } $styletemp = ""; /* Second Temprature Condition*/ if($second_temp > 50 && $second_temp <-50) { $humi_temp = "--"; } if($second_temp!="" && $second_temp!="0" && $second_temp!="0.000000") { $humi_temp = round($second_temp,2).'°C '; } /* Second Temprature Condition End*/ if($tel_temp!="" && $tel_temp!="0.000000") { if ($_SESSION['sys_group_id'] == '53003' || $_SESSION['sys_group_id_parent'] == '53003') { if($tel_temp >= '-18' && $tel_temp <= '-16') { $styletemp = "style='background:#40d640;color:white';"; } elseif($tel_temp >= '-15.99' && $tel_temp <= '-14') { $styletemp = "style='background:#ebb34b;color:white';"; } elseif($tel_temp >= '-14') { $styletemp = "style='background:#ef6666;color:white';"; } } $showTemp=$tel_temp; if(($_SESSION['UserId']=="6347" || $_SESSION['ParentId']=="6347" ) && in_array($allSeesionData[$r]["sys_service_id"], $DualsensorVehicleID) ) { echo ''; } else if ($_SESSION['UserId']=="6347" || $_SESSION['ParentId']=="6347" ) { echo ''; } else { echo ''; } } else { echo ''; } } else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { if($allSeesionData[$r]["aconoff"] == 1){$aconoff = 'ON';}else{$aconoff = 'OFF';} echo ''; } else if(in_array($_SESSION['sys_group_id'], $journeyMapinall) or in_array($_SESSION['sys_group_id_parent'], $journeyMapinall)) { $Todate = date('Y-m-d'); $statDformap=date('Y-m-d',(strtotime($Todate))-1)." 00:00:00"; //$statDformap=; $EndDformap=date('Y-m-d H:i:s'); echo ''; } else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { echo ''; echo ''; } if($_SESSION['UserId']=="79749" ) { //$Destination = $allSeesionData[$r]["veh_destination"]; echo ''; } if($_SESSION['UserId']=="79748" ) { //$Destination = $allSeesionData[$r]["veh_destination"]; echo ''; } else if($_SESSION['UserId']=="4315" || $_SESSION['ParentId']=="4315" ) { echo ''; } else if ($_SESSION['Vehicle_type']=="1111"){ //echo ""; //echo ""; //echo ""; // at //tocheck //$Dispatchdetail=GetSourceDispatchtime($sys_service_id,$lastcomment); $arrdtlDispatch=explode(" tocheck ",$lastcomment); $getloadinglocation=explode(" at ",$arrdtlDispatch[0]); if(count($arrdtlDispatch)>0) { echo ''; echo ''; } else { echo ''; echo ''; } $Destination = $allSeesionData[$r]["veh_destination"]; echo ''; } else { $Destination = $allSeesionData[$r]["veh_destination"]; echo ''; } if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) { if($allSeesionData[$r]["tel_input_3"] == 1) { $headlight = "ON"; } else { $headlight = "OFF"; } ?> 500 and telemetry.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition); $odometer=$SOChistorydetail[0]["tel_odometer"]; $Distancetoempty=$SOChistorydetail[0]["tel_rfid"]; } if($odometer<=0) { $SOChistorydetail = db__select_staging("select sys_Service_id,tel_rfid,tel_odometer,main_powervoltage from matrix.telemetry where tel_odometer>500 and telemetry.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition); $odometer=$SOChistorydetail[0]["tel_odometer"]; $Distancetoempty=$SOChistorydetail[0]["tel_rfid"]; } if($odometer=="") { $odometer=0; } if($Distancetoempty<=0 or $Distancetoempty=="") { $SOChistorydetail = db__select("select sys_Service_id,tel_rfid,tel_odometer,main_powervoltage from matrix.telemetry where tel_rfid>0 and telemetry.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition); //$odometer=$SOChistorydetail[0]["tel_odometer"]; $Distancetoempty=$SOChistorydetail[0]["tel_rfid"]; } if($Distancetoempty<=0) { $SOChistorydetail = db__select_staging("select sys_Service_id,tel_rfid,tel_odometer,main_powervoltage from matrix.telemetry where tel_rfid>0 and telemetry.sys_Service_id=".$allSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition); //$odometer=$SOChistorydetail[0]["tel_odometer"]; $Distancetoempty=$SOChistorydetail[0]["tel_rfid"]; } if($Distancetoempty=="") { $Distancetoempty=0; } ?> '. $getloadinglocation[1].''; // echo ''; ?> =24) { $serviceComment = db__select("select id,service_id,`comment`,`date`,comment_by from matrix.comment where service_id='".$sys_service_id."' order by id DESC limit 1", ""); } ?> nearestDistState($latlng); } else {$get_latlng = "";} $ArrayData = explode(",",$get_latlng); //$getDist = substr($get_latlng, strpos($get_latlng, "District:-") + 1); //$getstate = substr($get_latlng, strpos($get_latlng, ",State:-") + 1); ?> GEtKmByVhlWithDateToday(date('Y-m-d 00:00:00'),date('Y-m-d H:i:s'),$sys_service_id,2,"KM"); $CalculatedKilometers=db__select_staging("select Total_km as distance from matrix.consolidate_yesterday where sys_service_id='".$sys_service_id."'"); $CalculatedKilometersthismonth= db__select_staging("select round( sum(Total_km),2) as km from matrix.consolidate where DateOf_journey>=DATE_FORMAT(now(),'%Y-%m-01') and sys_service_id='".$sys_service_id."'"); $CalculatedKilometerslastmonth123= db__select_staging("select round( sum(Total_km),2) as KMW from matrix.consolidate where DateOf_journey>='".date("Y-m-1",strtotime("-1 month"))."' and DateOf_journey<='".date("Y-m-31",strtotime("-1 month"))."' and sys_service_id='".$sys_service_id."'"); ?> 5) { ?> 50 && $second_temp <-50) { $excel_temp = "--"; } if($second_temp!="" && $second_temp!="0" && $second_temp!="0.000000") { $excel_temp = round($second_temp,2); } if($showTemp != "" && $excel_temp != "") { $final_temp = $showTemp.', '.$excel_temp; } else if($showTemp != "" && $excel_temp == "") { $final_temp = $showTemp; } else { $final_temp = ','.$excel_temp; } ?> " /> " /> " /> " /> " /> /> " />
SNo Vehicle Number Vehicle Type Run Type Vendor Name Controlling Branch Type Location Name TemperatureDestinationTemperatureAC StatusCircle NameSDOYesterday TripVendor nameSourceDispatch TimeDestinationDestinationBattery Status Distance to empty Odometer Charging status1 Fuel Last update Halting Time Speed Vehicle Status   Nearest POI Zone Service Comment Ignition Status Owner Transporter Name Supllier Type/ Controlling Branch Party Name Running Status Model Driver name Driver Number Driver Number District State Controlling Branch Gaddi Malik Current day distance(KM) Previous day diatance(KM) Current month KM Previous month KM Running Status
'.$distance." KM from ".$NstcDest[0]["station_to_location"].''.round($showTemp,2).'°C'.$Destination.''.round($showTemp,2).'°C , '. $humi_temp.' '.round($showTemp,2).'°C '.round($showTemp,2).'°C , '. $humi_temp.' ,'.$humi_temp.' '.$aconoff.' Yesterday Trip '.$allSeesionData[$r]["veh_trasport_name"].''.$allSeesionData[$r]["thana_name"].'ITG'.$allSeesionData[$r]["veh_trasport_name"].''.$Destination.'SourceDispatch TimeDestination'. $getloadinglocation[1].''. $arrdtlDispatch[1].''.$Destination.''.$Destination.'GEtbatterystatusSOC($sys_service_id); $SHowVoltage=$voltagecheck; /*if($voltagecheck>=4.31 && $voltagecheck<=4.91) { $SHowVoltage="80% to 100%(".$voltagecheck; } if($voltagecheck>4.91 && $voltagecheck<=5.01) { $SHowVoltage="60% to 80%(".$voltagecheck; } if($voltagecheck>5.01 && $voltagecheck<=5.21) { $SHowVoltage="40% to 60%(".$voltagecheck; } if($voltagecheck>=5.31 && $voltagecheck<=5.4) { $SHowVoltage="20% to 40%(".$voltagecheck; } if($voltagecheck>=5.61 ) { $SHowVoltage="5% to 20%(".$voltagecheck; }*/ } //echo $voltagecheck=$masterObj->GEtbatterystatusSOC(104583);exit; if($SHowVoltage=="" && $_SESSION['sys_group_id']!=53594 && $_SESSION['sys_group_id']!=54396) { if($allSeesionData[$r]["tel_voltage"]>=4 ) { $SHowVoltage="80% to 100%"."(".round($allSeesionData[$r]["tel_voltage"],2).")"; } if($allSeesionData[$r]["tel_voltage"]>=3.8 && $allSeesionData[$r]["tel_voltage"]<4) { $SHowVoltage="60% to 80%"."(".round($allSeesionData[$r]["tel_voltage"],2).")"; } if($allSeesionData[$r]["tel_voltage"]>=3.6 && $allSeesionData[$r]["tel_voltage"]<3.8) { $SHowVoltage="40% to 60%"."(".round($allSeesionData[$r]["tel_voltage"],2).")"; } if($allSeesionData[$r]["tel_voltage"]>=3.4 && $allSeesionData[$r]["tel_voltage"]<3.6) { $SHowVoltage="20% to 40%"."(".round($allSeesionData[$r]["tel_voltage"],2).")"; } if($allSeesionData[$r]["tel_voltage"]<3.4) { $SHowVoltage="10% to 20%"."(".round($allSeesionData[$r]["tel_voltage"],2).")"; } } else if($_SESSION['sys_group_id']==53594 || $_SESSION['sys_group_id']==54396 || $_SESSION['sys_group_id_parent']==53594 || $_SESSION['sys_group_id_parent']==54396) { if($allSeesionData[$r]["main_powervoltage"]>100) { $allSeesionData[$r]["main_powervoltage"]=0; } $SHowVoltage=round($allSeesionData[$r]["main_powervoltage"])." %"; } echo $SHowVoltage; ?> 0) { echo "0"; } else { echo $Speed; } //$LocationName=$allSeesionData[$r]["geo_street"]; ?> '. $arrdtlDispatch[1].'