getRunningVechiles($_SESSION['vehId'],$date); $runningSeesionData=$RunningvehicleDetails; //echo "
";print_r($runningSeesionData);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 >= -50 && $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 <= -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 < 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 >= -50)
        {
            $temprature = 0.1;
        }
    }
 
    return $temprature;
}

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'];
}

 
$_SESSION['clientid'] = $obj->ClientUniqueID();
 
    $Action = isset($_GET['request']) ? $_GET['request'] : "";
    if($Action!="")
    {
        if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
        {
           $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.= '';
            }
			if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
            {
                 $html.= '';
            }
          
            $html.='';
                  
            $html.='';
                  
        }
        else
        {
 
            $html.= '
Vehicle NumberControlling BranchTypeAC StatusLocation Name Last Update Last Running Time Speed Temperature
'; $html.= ''; if (in_array($_SESSION['sys_group_id'], $ecomvehicle) || in_array($_SESSION['sys_group_id_parent'], $ecomvehicle)) { $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.= ''; } if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $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) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) { $html.= ''; } else { $html.= ''; } if (in_array($_SESSION['sys_group_id'], $vehTripStatus) or in_array($_SESSION['sys_group_id_parent'], $vehTripStatus)){ $html.= ''; } if (in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) { $html.= ''; } $html.=''; } for($r=0;$rexists('itgc_locationsupd')) { if($redis_geopoi_data=get_geoPoi($sess_userid.':geopois',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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 $KMFromNearPOI = str_replace(' ','_',$redis_geopoi_data[0][0]);//get redis poi name $KMFromNearPOI = $redis_poi_km.' '.$KMFromNearPOI; $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 $KMFromNearPOI = 'INSIDE POI'; $redis_poi_km =''; } else { // if the out of poi get the vehine locaiton name redis geodata $get_data = get_geoData('itgc_locationsupd',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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.')':$runningSeesionData[$r]['gps_longitude'].','.$runningSeesionData[$r]['gps_latitude']; // $LocationName = 'redis locatio'; } } else { // if the out of poi get the vehine locaiton name redis geodata $get_data = get_geoData('itgc_locationsupd',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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.')':$runningSeesionData[$r]['gps_longitude'].','.$runningSeesionData[$r]['gps_latitude']; // $LocationName = 'redis locatio'; } } else { /* pdf/excel location name in case the redis key does not exists */ $Locationdata = $masterObj->GetLocationWitPOI($runningSeesionData[$r]["gps_latitude"].','.$runningSeesionData[$r]["gps_longitude"]); $LocationNameArr = explode("##",$Locationdata); $LocationName = $LocationNameArr[0]; if($LocationNameArr[1]=="") { $KMFromNearPOI="INSIDE POI"; } else { $KMFromNearPOI = $LocationNameArr[1]; } /* pdf/excel location name */ } /* redis location name end */ /*$Locationdata = $masterObj->GetLocationWitPOI($runningSeesionData[$r]["gps_latitude"].','.$runningSeesionData[$r]["gps_longitude"]); $LocationNameArr = explode("##",$Locationdata); $LocationName = $LocationNameArr[0];*/ $lastrunning = $runningSeesionData[$r]["gps_time"]; $lastUpdate = $runningSeesionData[$r]["lastupdate"]; $Speed = $runningSeesionData[$r]["gps_speed"]; //$KMFromNearPOI = $LocationNameArr[1]; $lat = $runningSeesionData[$r]["gps_latitude"]; $lng = $runningSeesionData[$r]["gps_longitude"]; $veh_status=$runningSeesionData[$r]["veh_status"]; $vendorName1=$runningSeesionData[$r]["thana_name"]; $runtype1=$runningSeesionData[$r]["veh_remark"]; if($runningSeesionData[$r]["aconoff"] == 1){$aconoff_excel = 'ON';}else{$aconoff_excel = 'OFF';} /*if($LocationNameArr[1]=="") { $KMFromNearPOI="INSIDE POI"; }*/ $tel_temp=$runningSeesionData[$r]["tel_temperature"]; if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard)) { if($tel_temp!="" && $tel_temp!="0.000000") { $showTemp=round($tel_temp) ." C"; } else { $showTemp=""; } $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.=''; } if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $html.=''; } $html.=' '; } else { $html.=''; if (in_array($_SESSION['sys_group_id'], $ecomvehicle) || in_array($_SESSION['sys_group_id_parent'], $ecomvehicle)){ // $html.=''; // $html.=''; $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.=''; } if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll)) { $html.=''; } $html.=''; if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT)) { if($runningSeesionData[$r]["tel_input_3"] == 1) { $headlight = "ON"; } else { $headlight = "OFF"; } $SHowVoltage=""; if($runningSeesionData[$r]["tel_rfid"]==6) { $SHowVoltage="80% to 100%"; } if($runningSeesionData[$r]["tel_rfid"]==5) { $SHowVoltage="60% to 80%"; } if($runningSeesionData[$r]["tel_rfid"]==4) { $SHowVoltage="40% to 60%"; } if($runningSeesionData[$r]["tel_rfid"]==3) { $SHowVoltage="20% to 40%"; } if($runningSeesionData[$r]["tel_rfid"]==2) { $SHowVoltage="10% to 20%"; } if($runningSeesionData[$r]["tel_rfid"]==1) { $SHowVoltage="5% to 10%"; } if($SHowVoltage=="") { $voltagecheck=$masterObj->GEtbatterystatusSOC($sys_service_id); $SHowVoltage=$voltagecheck; } if($SHowVoltage=="" && $_SESSION['sys_group_id']!=53594) { if($runningSeesionData[$r]["tel_voltage"]>=4 ) { $SHowVoltage="80% to 100%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.8 && $runningSeesionData[$r]["tel_voltage"]<4) { $SHowVoltage="60% to 80%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.6 && $runningSeesionData[$r]["tel_voltage"]<3.8) { $SHowVoltage="40% to 60%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.4 && $runningSeesionData[$r]["tel_voltage"]<3.6) { $SHowVoltage="20% to 40%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]<3.4) { $SHowVoltage="10% to 20%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } } //echo $SHowVoltage; $html.=''; $html.=''; } 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'], $vehTripStatus) or in_array($_SESSION['sys_group_id_parent'], $vehTripStatus)){ $getInTransitVeh = db__select("select trip_status from matrix.client_veh_trip_status where sys_service_id=".$runningSeesionData[$r]["sys_service_id"]." and is_active='1' ", ""); $trip_status = $getInTransitVeh[0]["trip_status"]; $html.=''; } if (in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) { $latlng = $runningSeesionData[$r]["gps_latitude"].",".$runningSeesionData[$r]["gps_longitude"]; if( $runningSeesionData[$r]["gps_latitude"] != "0.000000000" && $runningSeesionData[$r]["gps_longitude"] != "0.000000000") { $get_latlng = $masterObj->nearestDistState($latlng); } else {$get_latlng = "";} $ArrayData = explode(",",$get_latlng); $html.= ''; } $html.=''; } } $reportHeader='Running vehicle detail generated at '.date("Y-m-d H:i").'

'; $mainHeader = '
SNo Vehicle NumberRun Type Vendor Name Controlling BranchTypeAC StatusLocation Name Last Update Last Running Time SpeedBattery Status Headlight StatusCircle Name SDONearest POIVehicle StatusDistrict State
'.$VehicleNumber.'
'.$controlling_branch.''.$veh_status.''.$aconoff_excel.''.$LocationName.' '.$lastUpdate.' '.$lastrunning.' '.$Speed.' '.$showTemp.'
'.$SlNo.'
'.$VehicleNumber.'
helloRUnt type'.$runtype1.''.$vendorName1.''.$controlling_branch.''.$veh_status.''.$aconoff_excel.''.$LocationName.' '.$lastUpdate.' '.$lastrunning.' '.$Speed.''.$SHowVoltage.''.$headlight.''.$runningSeesionData[$r]["veh_trasport_name"].' '.$runningSeesionData[$r]["thana_name"].'
'.$KMFromNearPOI.'
'.$trip_status.''.$ArrayData[0].' '.$ArrayData[1].'

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

'; $finalHtml= $mainHeader.$html; $finalPDF= $reportHeader.$html; if(substr($finalHtml,(strlen($finalHtml)-8),strlen($finalHtml))!="") { $finalHtml=$finalHtml.""; } if(substr($finalPDF,(strlen($finalPDF)-8),strlen($finalPDF))!="") { $finalPDF=$finalPDF.""; } if($Action=="excel") { $filepointer=fopen(__DOCUMENT_ROOT.'/reports/excel_reports/running'.$_SESSION['clientid'].".xls",'w'); fwrite($filepointer,$finalHtml); fclose($filepointer); header("location:".__SITE_URL."/reports/excel_reports/running".$_SESSION['clientid'].".xls"); } elseif($Action=="pdf") { 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/running".$_SESSION['clientid'].".pdf"); header("location:".__SITE_URL."/reports/pdf_reports/running".$_SESSION['clientid'].".pdf"); } } ?>

Running Vehicle

Export Excel    Export PDF
";print_r($runningSeesionData);die; for($r=0;$r<$runLoop;$r++) { $KMFromNearPOI=""; $SlNo=$r+1; $VehicleNumber = $runningSeesionData[$r]["veh_reg"]; $sys_service_id = $runningSeesionData[$r]["sys_service_id"]; $vendorName=$runningSeesionData[$r]["thana_name"]; $runtype=$runningSeesionData[$r]["veh_remark"]; /* redis location name */ if($redis->exists('itgc_locationsupd')) { // echo $allSeesionData[$r]['gps_longitude'].'----'.$allSeesionData[$r]['gps_latitude']; // echo "
"; // get geo poi data if($redis_geopoi_data=get_geoPoi($sess_userid.':geopois',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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_locationsupd',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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.')':$runningSeesionData[$r]['gps_longitude'].','.$runningSeesionData[$r]['gps_latitude']; // $LocationName = 'redis locatio'; } } else { // if the out of poi get the vehine locaiton name redis geodata $get_data = get_geoData('itgc_locationsupd',$runningSeesionData[$r]["gps_longitude"],$runningSeesionData[$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.')':$runningSeesionData[$r]['gps_longitude'].','.$runningSeesionData[$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($runningSeesionData[$r]["gps_longitude"].','.$runningSeesionData[$r]["gps_latitude"]); $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)) { $tel_temp=$runningSeesionData[$r]["tel_temperature"]; if($tel_temp>50 && $tel_temp<-50) { $tel_temp="--"; } /* if($runningSeesionData[$r]["sys_service_id"]=="54368") { $tempOfPrevious= db__select("select tel_temperature from matrix.latest_telemetry where sys_service_id=54039", $condition); $tel_temp=$tempOfPrevious[0]["tel_temperature"]-1; }*/ if($runningSeesionData[$r]["sys_service_id"]=="71527") { $showTemp=-18; $tel_temp=-18; } 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='".$runningSeesionData[$r]["sys_service_id"]."' and '".$runningSeesionData[$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($runningSeesionData[$r]["tel_temperature"]>=$Temp_data[0]['set_temp'] && $runningSeesionData[$r]["tel_temperature"]<=$Temp_data[0]['set_temp_to'])
                                                {
                                                    $tel_temp=round(($runningSeesionData[$r]["tel_temperature"]),2);
                                                }
                                                elseif($runningSeesionData[$r]["tel_temperature"]<$Temp_data[0]['set_temp'])
                                                {
                                                  
                                                    $runningSeesionData[$r]["tel_temperature"] = SetTempLessVal($Temp_data[0]["set_temp"],$Temp_data[0]["set_temp_to"],$runningSeesionData[$r]["tel_temperature"]);
                                                                                                                                   
                                                    $tel_temp=$runningSeesionData[$r]["tel_temperature"];
                                                 
                                                
                                                }
                                                else
                                                {
                                                    $runningSeesionData[$r]["tel_temperature"] = SetTempGreateVal($Temp_data[0]["set_temp"],$Temp_data[0]["set_temp_to"],$runningSeesionData[$r]["tel_temperature"]);
                                                 
                                                
                                                    $tel_temp=$runningSeesionData[$r]["tel_temperature"];
                                                
                                                }
                                           }
                                           else
                                            {
                                                $tel_temp=round(($runningSeesionData[$r]["tel_temperature"]-$div_temp),2);
                                            }
                                        }
                                        else
                                        {
                                            $div_temp = 0;
                                            $tel_temp=round(($runningSeesionData[$r]["tel_temperature"]-$div_temp),2);
                                        }
                                    
                                        //$tel_temp=round(($runningSeesionData[$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<40 and today_ideal.sys_Service_id=".$runningSeesionData[$r]["sys_service_id"]." order by gps_time desc limit 1", $condition);
                                    
                                        $tel_temp=$temptoday1[0]["tel_temperature"];
                                    }
 
                                }
                                else
                                {
                                    $tel_temp="";
                                }
 
 
 
 
 
                            //$Locationdata = $masterObj->GetLocationWitPOI($runningSeesionData[$r]["gps_latitude"].','.$runningSeesionData[$r]["gps_longitude"]);
 
                            //$LocationNameArr = explode("##",$Locationdata);
                            //$LocationName = $LocationNameArr[0];
                            $lastrunning = $runningSeesionData[$r]["gps_time"];
                            $lastUpdate = $runningSeesionData[$r]["lastupdate"];
                            $Speed = $runningSeesionData[$r]["gps_speed"];
                            // $KMFromNearPOI = $LocationNameArr[1];
                            $lat = $runningSeesionData[$r]["gps_latitude"];
                            $lng = $runningSeesionData[$r]["gps_longitude"];
                             $veh_status=$runningSeesionData[$r]["veh_status"];
 
                            /*if($LocationNameArr[1]=="")
                            {
                            $KMFromNearPOI="INSIDE POI";
                            }*/
 
                               /*$content_running .='{ slno: "'.$SlNo.'", vehno: "'.$VehicleNumber.'", LocationName: "'.$LocationName.'", lastUpdate: "'.$lastUpdate.'", speed: "'.$Speed.'", KMFromNearPOI: "'.$KMFromNearPOI.'", lat: "'.$lat.'", lng: "'.$lng.'" },';*/
 
                             ?>
                  
= '-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."°C"; } else { $showTemp=""; } ?> " /> 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); ?>
Temp SNo Vehicle Number Run Type Vendor Name Controlling Branch Type AC Status Location Name Last update Last Running Time Speed Battery Status Headlight Status Circle Name SDO KM from Nearest POI Vehicle Status District State
> GEtbatterystatusSOC($sys_service_id); $SHowVoltage=$voltagecheck; } if($SHowVoltage=="" && $_SESSION['sys_group_id']!=53594) { if($runningSeesionData[$r]["tel_voltage"]>=4 ) { $SHowVoltage="80% to 100%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.8 && $runningSeesionData[$r]["tel_voltage"]<4) { $SHowVoltage="60% to 80%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.6 && $runningSeesionData[$r]["tel_voltage"]<3.8) { $SHowVoltage="40% to 60%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]>=3.4 && $runningSeesionData[$r]["tel_voltage"]<3.6) { $SHowVoltage="20% to 40%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } if($runningSeesionData[$r]["tel_voltage"]<3.4) { $SHowVoltage="10% to 20%"."(".round($runningSeesionData[$r]["tel_voltage"],2).")"; } } echo $SHowVoltage; ?> ','','','');" data-toggle="modal" data-target=".bs-example-modal-sm-popup" id="tripstat">