UserDetailForSession($_GET["subuser_id"]); if(count($UserDetailForSession)==1) { $queryGroup=" select * from users left join group_users on users.id=group_users.sys_user_id where group_users.active =true and users.sys_username='".$UserDetailForSession[0]['sys_username']."' and users.sys_password='".$UserDetailForSession[0]['sys_password']."' and users.sys_active=true and different_site=0"; $condition = ""; $resultGroup = db__select($queryGroup, $condition); $_SESSION['lang']=$UserDetailForSession[0]['sys_culture']; $_SESSION['UserName']=$UserDetailForSession[0]['sys_username']; $_SESSION['UserId']=$UserDetailForSession[0]['id']; $_SESSION['domain']=$UserDetailForSession[0]['affable_domain']; $_SESSION['ParentId']=$UserDetailForSession[0]['sys_parent_user']; $_SESSION['sys_group_id']=$resultGroup[0]['sys_group_id']; $_SESSION['TimeZone']=$UserDetailForSession[0]['sys_timezone']; $_SESSION['vehId']=""; $_SESSION['poiId']=""; $_SESSION['poiDetails']=""; $_SESSION['vehDetails']=""; $_SESSION['Journey_status']=$UserDetailForSession[0]['create_journey']; $_SESSION['KM_for']=$UserDetailForSession[0]['KM_for']; $_SESSION['vendor']=$UserDetailForSession[0]['vendor']; $_SESSION['Show_alert']=$UserDetailForSession[0]['show_notification']; $_SESSION['TimeZoneDiff'] = $resultGroup[0]['timezone_minute']; $_SESSION['Vehicle_type']=$UserDetailForSession[0]['default_vehicle_type']; $poi_veh_tot="0"; $_SESSION['login_UserId']=$UserDetailForSession[0]['id']; if($UserDetailForSession[0]['sys_parent_user']!=1) { $queryForMaingroupId="select sys_parent_group_id from `group` where `group`.id=".$_SESSION['sys_group_id']; $condition = ""; $resultParentId = db__select($queryForMaingroupId, $condition); $_SESSION['sys_group_id_parent']=$resultParentId[0]["sys_parent_group_id"]; } if( $_SESSION['sys_group_id_parent']==6173) { $VehicleidQry="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id']." and sys_Service_id in (select sys_Service_id from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_id_parent']." )"; } else if($_SESSION['sys_group_id'] == 54173 || $_SESSION['sys_group_id'] == 54174 || $_SESSION['sys_group_id'] == 54175) { $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 in('Repair','Break Down') 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 "; } } else { $VehicleidQry="select * from group_services where group_services.active=true and sys_group_id=".$_SESSION['sys_group_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); } } } //echo $_SESSION['AI']; $UserId = $_SESSION['UserId']; $condition = ""; //print_R($_POST['ai']); //if(isset($_POST['ai'])) //{ //} //echo $_SESSION['AI']; $CommomObj = new MyClass(); $data=$masterObj->getAllVehilceDataQry($_SESSION['sys_group_id'],$_SESSION['vehId']); $showVhlDDl=$data; $total_veh = count($data); $_SESSION['vehDetails']=""; if(is_array($data)){ foreach($data as $key=>$value){ $vehid_session.=$value['id'].","; $_SESSION['vehDetails'].=$value['id'].",".$value['veh_reg'].",".$value['veh_icon_1'].",".$value['veh_destination'].",".$value['veh_phone_number'].",".$value['veh_driver_name']."#$#"; } $vehListId=substr($vehid_session,0,strlen($vehid_session)-1); $_SESSION['vehId']= $vehListId; $_SESSION['vehDetails']=substr($_SESSION['vehDetails'],0,strlen($_SESSION['vehDetails'])-3); } $date = date('Y-m-d', strtotime('-1 day', strtotime(date('Y-m-d')))); $DATEPANIC = date('Y-m-d'); $RunningvehicleDetails = $masterObj->getRunningVechiles($vehListId,$date); //echo "
";print_r($RunningvehicleDetails);die;
//$_SESSION["RunningvehicleDetails"]=$RunningvehicleDetails;
if($RunningvehicleDetails[0]['sys_service_id'] != "")
{
    $running_veh_tot = count($RunningvehicleDetails);
} else  {
    $running_veh_tot = 0;
}
//$running_veh_tot = count($RunningvehicleDetails);
$_SESSION["RunningvehicleDetailscnt"]=$running_veh_tot;


$AllvehicleDetails = $masterObj->getAllVechiles($vehListId,$date);
$_SESSION["AllvehicleDetails"]=$AllvehicleDetails;
if($AllvehicleDetails[0]['sys_service_id'] != "")
{
    $all_veh_tot = count($AllvehicleDetails);
} else {
    $all_veh_tot = 0;
}
//$all_veh_tot = count($AllvehicleDetails);
$_SESSION["AllvehicleDetailscnt"]=$all_veh_tot;



$Ideal_result = $masterObj->getIdelVechile($vehListId,$date);
$_SESSION["Ideal_result"]=$Ideal_result;
//echo "
";print_r($Ideal_result);die;
if($Ideal_result[0]['sys_service_id'] != "")
{
    $IdealVehicleCount = count($Ideal_result);
} else {
    $IdealVehicleCount = 0;
}
//$IdealVehicleCount=count($Ideal_result);
$_SESSION["Ideal_resultcnt"]=$IdealVehicleCount;
if($_SESSION['login_ParentId']==1)
{
    if($_SESSION['ParentId']!=1)
    {
    $detailfromuser=$_SESSION['ParentId'];
    }
    else
    {
    $detailfromuser=$_SESSION['UserId'];
    }
   
    if (in_array($_SESSION['UserId'], $subuserSpecific))
    {
    $GetSubuserList = $masterObj->GetSpecificSubuserList("78623,6603,6606,78835,79223,6473,7333,6474,78827,6258,79779,6838,78901,7590,78828,78951,6604,78902,6475,78836,6605,78928,6550,80231,80506,79779,80508,80507,80731");

    }
    else
    {

$GetSubuserList = $masterObj->GetSubuserList($detailfromuser);
    }


}

//GetSpecificSubuserList




for($iv=0;$iv<$IdealVehicleCount;$iv++)
{

    if($Ideal_result[$iv]["HourDiff"]>=1 && $Ideal_result[$iv]["HourDiff"]<7)
    {
        $IdealHour1_6=$IdealHour1_6+1;
    }
    if($Ideal_result[$iv]["HourDiff"]>6 && $Ideal_result[$iv]["HourDiff"]<17)
    {
        $IdealHour6_16=$IdealHour6_16+1;
    }
    if($Ideal_result[$iv]["HourDiff"]>16 && $Ideal_result[$iv]["HourDiff"]<25)
    {
        $IdealHour16_24=$IdealHour16_24+1;
    }
    if($Ideal_result[$iv]["HourDiff"]>24 )
    {
        $IdealHour24_above=$IdealHour24_above+1;
    }

}

$IdlevehicleDetails= $IdealVehicleCount."##".$IdealHour1_6."##".$IdealHour6_16."##".$IdealHour16_24."##".$IdealHour24_above;

$IdlevehiclelistArr=explode("##",$IdlevehicleDetails);

$idle_veh_tot =$IdlevehiclelistArr[0];

$_SESSION['IdleList']= $IdlevehicleDetails;

$NoGpsDetails = $masterObj->getNoGpslVechile($vehListId,$date);
$_SESSION['NoGpsDetails']= $NoGpsDetails;
//print_r($_SESSION['NoGpsDetails']);
if($NoGpsDetails[0]['sys_service_id'] != "")
{
    $nogps_total=count($NoGpsDetails);
} else {
    $nogps_total = 0;    
}
//$nogps_total=count($NoGpsDetails);

$_SESSION['NoGpsDetailscnt']= $nogps_total;

if(in_array($_SESSION['sys_group_id'], $VDPNotworkingShow)) {

    $VDPNotWorkingDetails = $masterObj->getVDPNoGpslVechile($vehListId);          
    $_SESSION['VDPNotWorkingDetails']= $VDPNotWorkingDetails;
    if($VDPNotWorkingDetails[0]['sys_service_id'] != "")
    {
        $VDPNotWorking_total=count($VDPNotWorkingDetails);
    } else {
        $VDPNotWorking_total = 0;
    }
    //$VDPNotWorking_total=count($VDPNotWorkingDetails);

    $_SESSION['VDPNotWorkingDetailscnt']= $VDPNotWorking_total;
   
    $VDPTotalVehDetails = $masterObj->getVDPTotalVechile($vehListId);
    if($VDPTotalVehDetails[0]['sys_service_id'] != "")
    {
        $VDPtotal_veh=count($VDPTotalVehDetails);
    } else {
        $VDPtotal_veh = 0;
    }
    //$VDPtotal_veh=count($VDPTotalVehDetails);
   
    $VDPNotWorking_veh_per = $VDPNotWorking_total*100/$VDPtotal_veh;

}

if(in_array($_SESSION['sys_group_id'], $PanicNotWorkingShow))
{
$PanicNotWorkingDetails = $masterObj->getPanicNotWorkingVechile($vehListId,$DATEPANIC);          
    $_SESSION['PanicNotWorkingDetails']= $PanicNotWorkingDetails;
//echo "
";print_r($PanicNotWorkingDetails);die;
if($PanicNotWorkingDetails[0]['veh_id'] != "")
    {
        $PanicnotWorking_total=count($PanicNotWorkingDetails);
    } else {
        $PanicnotWorking_total = 0;
    }

$PanicnotWorking_veh_per = $PanicnotWorking_total*100/$total_veh;

}

if(in_array($_SESSION['sys_group_id'], $StopVehShow))
{
	foreach($RunningvehicleDetails as $keyRun=>$valueRun){
		$run_sys_service_id.=$valueRun['sys_service_id'].",";
	}
	$running_vehListId=substr($run_sys_service_id,0,strlen($run_sys_service_id)-1);
	$_SESSION["running_vehListId"]=$running_vehListId;
	
	foreach($Ideal_result as $keyIdle=>$valueIdle){
		$idle_sys_service_id.=$valueIdle['sys_service_id'].",";
	}
	$idle_vehListId=substr($idle_sys_service_id,0,strlen($idle_sys_service_id)-1);
	$_SESSION["idle_vehListId"]=$idle_vehListId;
	
	if(count($RunningvehicleDetails)>0 && count($Ideal_result)>0)
	{
		$final_veh_list = $running_vehListId.','.$idle_vehListId;
	}
	else if(count($RunningvehicleDetails)>0 && count($Ideal_result) == 0)
	{
		$final_veh_list = $running_vehListId;
	}
	else if(count($RunningvehicleDetails) == 0 && count($Ideal_result)>0)
	{
		$final_veh_list = $idle_vehListId;
	} else {
		$final_veh_list = 0;
	}
		
	$StopVehDetails = $masterObj->getStopVechile($_SESSION['vehId'],$date,$final_veh_list);          
		//$_SESSION['StopVehDetails']= $StopVehDetails;
	//echo "
";print_r($StopVehDetails);die;
	
	if($StopVehDetails[0]['veh_reg'] != "")
	{
		$StopVeh_total=count($StopVehDetails);
	} else {
		$StopVeh_total = 0;
	}
	
	$StopVeh_veh_per = $StopVeh_total*100/$total_veh;

}

if ($_SESSION['Vehicle_type']=="1")
{
$UserId = $_SESSION['UserId'];
$ParentId = $_SESSION['ParentId'];

if($ParentId!=1)
{
$Final_UserId = $ParentId;
}
else
{
$Final_UserId = $UserId;
}

/*$tripVehData = db__select("select cvts.*,crsh.route_name,crsh.route_in_time,crsh.route_out_time, crsh.order_no
from matrix.client_veh_trip_status as cvts left join client_route_status_history as crsh  on cvts.id=crsh.trip_id
inner join kmt_challan on cvts.sys_service_id=kmt_challan.sys_service_id
where cvts.sys_user_id='".$Final_UserId."' and cvts.is_active='1' and 
cvts.sys_service_id IN ($vehListId) group by crsh.trip_id having count(crsh.trip_id)>1", $condition);
*/

$tripVehData = db__select("select * from kmt_challan left join client_veh_trip_status on  kmt_challan.sys_service_id=client_veh_trip_status.sys_service_id where kmt_challan.sys_user_id='".$Final_UserId."' and kmt_challan.station_to_location!=''   group by kmt_challan.sys_service_id ","");
//echo "
";print_r($tripVehData);die;

if($tripVehData[0]['sys_service_id'] != "")
{
$trip_veh_total = count($tripVehData);
} else {
$trip_veh_total = 0;
}

}

//$InsidePOI = $masterObj->GetInsidePOI($vehListId);
//$InsidePOIR=explode("##",$InsidePOI);


/*$getYesterayKM = $masterObj->getYesterayPerformance($vehListId);
$getYesterayKMCnt=count($getYesterayKM);

$getMonthKM = $masterObj->getthismonthPerformance($vehListId);
$getMonthKMCnt=count($getMonthKM);
$getWeeklyKM = $masterObj->getWeeklyPerformance($vehListId);
$getWeeklyKMCnt=count($getWeeklyKM);*/

//print_r($_SESSION["PoiNameWithVehicleArry"]);die();
$running_veh_per = $running_veh_tot*100/$total_veh;

$idle_veh_per = $idle_veh_tot*100/$total_veh;

$nogps_veh_per = $nogps_total*100/$total_veh;

$trip_veh_per = $trip_veh_total*100/$total_veh;

$all_veh_per = $all_veh_tot*100/$total_veh;



//include("getData.php");

/*Performance
POI
IdleVehicle
YesrdayKM*/

?>









Tracking Experts: Live Tracking
















Yesterday Vehicle Performance

Distance (Kms)

Idle Vehicle

Time (Hours)

Vehicle at POI

Fleet Performance

All Vehicle

close
Press Esc to close

2015 © by G-Trac.