//session_start();
include_once('../config.php');
include_once(__DOCUMENT_ROOT.'/reports/private/master.php');
include_once(__DOCUMENT_ROOT.'/reports/private/common.php');
include_once(__DOCUMENT_ROOT.'/reports/classes/cls_calculate_distance.php');
include(__DOCUMENT_ROOT.'/reports/pointLocation.php');
$masterObj = new master();
$obj = new MyClass();
//print_r($allSeesionData);die();
/* -------------------------------------------------------------- */
require_once('../redis-files/geoget.php'); //redis geo data file
require_once('../redis-files/hget_pois.php'); //redis geo data file
require_once('../redis-files/redis_instance.php');// redis instance
/*----------------------------------------------------------------- */
if($_SESSION['ParentId']!=1)
{
$sess_userid=$_SESSION['ParentId'];
}
else
{
$sess_userid=$_SESSION['UserId'];
}
//$sess_userid = $_SESSION['UserId'];//user session id using in redis
if($_SESSION['sys_group_id'] == 54173 || $_SESSION['sys_group_id'] == 54174 || $_SESSION['sys_group_id'] == 54175)
{
$_SESSION['vehId']="";
$getVehicle="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id'];
$getVehId = db__select($getVehicle, "");
if(count($getVehId)>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.= '
| SNo |
Vehicle Number | ';
if($_SESSION['UserId']==79938 || $_SESSION['UserId']==79949 || $_SESSION['UserId']==79950 || $_SESSION['UserId']==79951 || $_SESSION['sys_group_id']==51352) {
$html.= 'Run Type |
Vendor Name | ';
}
if( in_array($_SESSION['sys_group_id'], $extraShowInBranch))
{
//$controlling_branch=$allSeesionData[$r]["thana_name"];
$html.= 'Controlling Branch | ';
}
if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type))
{
$html.= 'Type | ';
}
$html.= 'Location Name |
Last update |
Halting Hour |
Speed | ';
if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT))
{
$html.= 'Battery Status |
Headlight Status | ';
}
if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)){
} else if ($_SESSION['Vehicle_type']=="1"){
$html.= 'Vehicle Status | ';
} else {
$html.= 'Nearest POI | ';
$html.= 'Zone | ';
}
if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" )
{
$html.= 'Idle Time | ';
}
else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
{
$html.= 'Temperature | ';
}
else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
{
$html.= 'AC Status | ';
}
else if(in_array($_SESSION['sys_group_id'], $journeyMapinall) or in_array($_SESSION['sys_group_id_parent'], $journeyMapinall))
{
$html.= 'Trip on map | ';
}
else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow))
{
$html.= 'Circle Name | SDO | ';
}
if($_SESSION['UserId']=="79749" || $_SESSION['UserId']=="79748" )
{
$html.= 'Vendor Name | ';
}
else
{
$html.= 'Destination | ';
}
if( in_array($_SESSION['sys_group_id'], $extraShowInall))
{
if($_SESSION['sys_group_id']=="6364")
{
$html.= 'Owner |
Transporter Name | ';
}
else if($_SESSION['sys_group_id']=="6173")
{
$html.= 'Supllier Type | ';
}
else if($_SESSION['sys_group_id']=="7502")
{
$html.= 'Party Name | ';
}
else if($_SESSION['sys_group_id']=="4563")
{
$html.= 'Running Status | ';
}
else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow))
{
$html.= 'District |
State | ';
}
else if($_SESSION['sys_group_id']=="3171")
{
$html.= 'Model | Driver |
Number | ';
}
}
if(in_array($_SESSION['sys_group_id'], $notWorkingComment))
{
$html.= 'Service Comment | ';
}
$html.= '
';
$htmlpdf.= '
| Vehicle Number | ';
if( in_array($_SESSION['sys_group_id'], $extraShowInBranch))
{
//$controlling_branch=$allSeesionData[$r]["thana_name"];
$htmlpdf.= 'Controlling Branch | ';
}
if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type))
{
$htmlpdf.= 'Type | ';
}
$htmlpdf.= 'Location Name |
Last update |
Halting Hour |
Speed | ';
if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT))
{
$htmlpdf.= 'Battery Status |
Headlight Status | ';
}
if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)){
} else if ($_SESSION['Vehicle_type']=="1"){
$htmlpdf.= 'Vehicle Status | ';
} else {
$htmlpdf.= 'Nearest POI | ';
$htmlpdf.= 'Zone | ';
}
if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" )
{
$htmlpdf.= 'Idle Time | ';
}
else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
{
$htmlpdf.= 'Temperature | ';
}
else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
{
$htmlpdf.= 'AC Status | ';
}
else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) or in_array($_SESSION['sys_group_id_parent'], $ExtraColShow))
{
$htmlpdf.= 'Circle Name | SDO | ';
}
else
{
$htmlpdf.= 'Destination | ';
}
if( in_array($_SESSION['sys_group_id'], $extraShowInall))
{
if($_SESSION['sys_group_id']=="6364")
{
$htmlpdf.= 'Owner |
Transporter Name | ';
}
else if($_SESSION['sys_group_id']=="6173")
{
$htmlpdf.= 'Supllier Type | ';
}
else if($_SESSION['sys_group_id']=="7502")
{
$htmlpdf.= 'Party Name | ';
}
else if($_SESSION['sys_group_id']=="4563")
{
$htmlpdf.= 'Running Status | ';
}
else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow))
{
$htmlpdf.= 'District |
State | ';
}
else if($_SESSION['sys_group_id']=="3171")
{
$htmlpdf.= 'Model | Driver Name |
Driver Number | ';
}
}
if(in_array($_SESSION['sys_group_id'], $notWorkingComment))
{
$htmlpdf.= 'Service Comment | ';
}
$htmlpdf.= '
';
for ($i = 0; $i < count($_POST['vehicleno']); ++$i)
{
$html.='| '.$_POST['sr_no'][$i].' |
'.$_POST['vehicleno'][$i].' | ';
if($_SESSION['UserId']==79938 || $_SESSION['UserId']==79949 || $_SESSION['UserId']==79950 || $_SESSION['UserId']==79951 || $_SESSION['sys_group_id']==51352) {
$html.=''.$_POST['runtype'][$i].' | ';
$html.=''.$_POST['vendorName'][$i].' | ';
}
if( in_array($_SESSION['sys_group_id'], $extraShowInBranch))
{
$html.=''.$_POST['controlling_branch'][$i].' | ';
}
if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type))
{
$html.=''.$_POST['vehicle_type'][$i].' | ';
}
$html.=''.$_POST['location'][$i].' |
'.$_POST['lastupdate'][$i].' |
'.$_POST['halted_hour'][$i].' |
'.$_POST['speed'][$i].' | ';
if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT))
{
$html.=''.$_POST['battery_status'][$i].' | ';
$html.=''.$_POST['headlight'][$i].' | ';
}
if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) {
} else if ($_SESSION['Vehicle_type']=="1"){
$html.=''.$_POST['trip_status'][$i].' | ';
} else {
$html.=''.$_POST['poiname'][$i].' | ';
$html.=''.$_POST['Zone'][$i].' | ';
}
if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" )
{
$html.=''.$_POST['idletime'][$i].' | '.$_POST['destination'][$i].' | ';
}
else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
{
$html.=''.$_POST['destination'][$i].' | ';
}
else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
{
$html.=''.$_POST['aconoff'][$i].' | ';
}
else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow))
{
$html.= ''.$_POST['circle_name'][$i].' |
'.$_POST['sdo_name'][$i].' | ';
}
else
{
$html.=''.$_POST['destination'][$i].' | ';
}
if(in_array($_SESSION['sys_group_id'], $extraShowInall))
{
if($_SESSION['sys_group_id']=="6173")
{
$html.=''.$_POST['gaddimalik'][$i].' | ';
} else if($_SESSION['sys_group_id']=="7502") {
$html.=''.$_POST['gaddimalik'][$i].' | ';
} else if($_SESSION['sys_group_id']=="4563") {
$html.=''.$_POST['running_status'][$i].' | ';
} else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) {
$html.=''.$_POST['District'][$i].' |
'.$_POST['State'][$i].' | ';
} else if($_SESSION['sys_group_id']=="3171")
{
$html.= ''.$_POST['model'][$i].' | '.$_POST['driver'][$i].' |
'.$_POST['number'][$i].' | ';
}
}
if(in_array($_SESSION['sys_group_id'], $notWorkingComment))
{
$html.= ''.$_POST['comment'][$i].' | ';
}
$html.='
';
$htmlpdf.='
| '.$_POST['vehicleno'][$i].' | ';
if( in_array($_SESSION['sys_group_id'], $extraShowInBranch))
{
$htmlpdf.=''.$_POST['controlling_branch'][$i].' | ';
}
if (in_array($_SESSION['sys_group_id'], $vehicle_type) or in_array($_SESSION['sys_group_id_parent'], $vehicle_type))
{
$htmlpdf.=''.$_POST['vehicle_type'][$i].' | ';
}
$htmlpdf.=''.$_POST['location'][$i].' |
'.$_POST['lastupdate'][$i].' |
'.$_POST['halted_hour'][$i].' |
'.$_POST['speed'][$i].' | ';
if (in_array($_SESSION['sys_group_id'], $batteryshowGT) or in_array($_SESSION['sys_group_id_parent'], $batteryshowGT))
{
$htmlpdf.=''.$_POST['battery_status'][$i].' | ';
$htmlpdf.=''.$_POST['headlight'][$i].' | ';
}
if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow)) {
} else if ($_SESSION['Vehicle_type']=="1"){
$htmlpdf.=''.$_POST['trip_status'][$i].' | ';
} else {
$htmlpdf.=''.$_POST['poiname'][$i].' | ';
$htmlpdf.=''.$_POST['Zone'][$i].' | ';
}
if($_SESSION['UserId']=="5275" || $_SESSION['ParentId']=="5275" )
{
$htmlpdf.=''.$_POST['destination'][$i].' | ';
}
else if (in_array($_SESSION['sys_group_id'], $ShowTempIndashboard) or in_array($_SESSION['sys_group_id_parent'], $ShowTempIndashboard))
{
$htmlpdf.=''.$_POST['destination'][$i].' | ';
}
else if(in_array($_SESSION['sys_group_id'], $ShowACStatusAll) or in_array($_SESSION['sys_group_id_parent'], $ShowACStatusAll))
{
$htmlpdf.=''.$_POST['aconoff'][$i].' | ';
}
else if(in_array($_SESSION['sys_group_id'], $ExtraColShow) || in_array($_SESSION['sys_group_id_parent'], $ExtraColShow))
{
$htmlpdf.= ''.$_POST['circle_name'][$i].' |
'.$_POST['sdo_name'][$i].' | ';
}
else
{
$htmlpdf.=''.$_POST['destination'][$i].' | ';
}
if( in_array($_SESSION['sys_group_id'], $extraShowInall))
{
if($_SESSION['sys_group_id']=="6173")
{
$htmlpdf.=''.$_POST['gaddimalik'][$i].' | ';
} else if($_SESSION['sys_group_id']=="7502") {
$htmlpdf.=''.$_POST['gaddimalik'][$i].' | ';
} else if($_SESSION['sys_group_id']=="4563") {
$htmlpdf.=''.$_POST['running_status'][$i].' | ';
} else if(in_array($_SESSION['sys_group_id'], $distStateShow) or in_array($_SESSION['sys_group_id_parent'], $distStateShow)) {
$htmlpdf.=''.$_POST['District'][$i].' |
'.$_POST['State'][$i].' | ';
}
else if($_SESSION['sys_group_id']=="3171")
{
$htmlpdf.= ''.$_POST['model'][$i].' | '.$_POST['driver'][$i].' |
'.$_POST['number'][$i].' | ';
}
}
if(in_array($_SESSION['sys_group_id'], $notWorkingComment))
{
$htmlpdf.= ''.$_POST['comment'][$i].' | ';
}
$htmlpdf.='
';
}
$reportHeader='All vehicle detail generated at '.date("Y-m-d H:i").'
';
$mainHeader = '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");
}
}
?>
if(in_array($_SESSION['sys_group_id'], $refresh30sec) || in_array($_SESSION['sys_group_id_parent'], $refresh30sec)) {?>
} else {?>
} ?>