<?php

/*
function GetServiceID($ID_SRVC){
  $NoChassis = (substr($NoChasis, 0, 6));
  $requette = "SELECT * FROM chassis_model WHERE Id = $ID_SRVC  ORDER BY Id_Service DESC LIMIT 1";
  $resultat = mysql_query($requette);
  if ($ligne = mysql_fetch_array($resultat)){
    return $ligne['Id'];
  }
  return false;
}
/*
$requette0 = "SELECT * FROM chassis_model WHERE Id = $Id_Vhc";
$resultat0 = mysql_query($requette0);
    
$ligne0 = mysql_fetch_array($resultat0);
    
$requette2 = "SELECT * FROM service_vhc WHERE Id_vhc = ".$Id_Vhc." ORDER BY Km";
$resultat2 = mysql_query($requette2);

function VrfNxtSrvc($ID_VHC,$LastKms){
  //$requette0 = "SELECT * FROM chassis_model WHERE Id = $ID_SRVC";
  //$resultat0 = mysql_query($requette0);
      
  //$ligne0 = mysql_fetch_array($resultat0);
      
  $requette = "SELECT * FROM service_vhc WHERE Id_vhc = '".$ID_VHC."' AND Km > '".$LastKms."' ORDER BY Km ASC LIMIT 1";
  $resultat = mysql_query($requette);
  if ($ligne = mysql_fetch_array($resultat)){
    return $ligne['Km'];
  }
  return false;
}

function VrfNxtSrvc_OLD($NoChasis, $LastKms){
  $srvcID = GetServiceID($NoChasis);
  $requette = "SELECT * FROM service_vhc WHERE Id_vhc = '".$srvcID."' AND Km > '".$LastKms."' LIMIT 1";
  $resultat = mysql_query($requette);
  if ($ligne = mysql_fetch_array($resultat)){
    return $ligne['Km'];
  }
  return false;
}

function GetSrvcKMfromID($S_srvID){
  $query="SELECT * FROM service_vhc WHERE Id='".$S_srvID."'";
    $resulta = mysql_query($query) or die('Erreur SQL !<br>'.$query.'<BR>'.Connection::getConnection()->errorInfo());
    if ($ligne = mysql_fetch_array($resulta)){
    return $ligne['Km'];
  }
  return false;
}

function GetLastSrvc($S_Chassis){
  $query="SELECT * FROM service_vhc WHERE Id = (SELECT Id_Service FROM atelier1 WHERE NoChasis='".$S_Chassis."' AND Id_Service != '0' ORDER BY Id_Service DESC LIMIT 1)";
    $resulta = mysql_query($query) or die('Erreur SQL !<br>'.$query.'<BR>'.Connection::getConnection()->errorInfo());
    if ($ligne = mysql_fetch_array($resulta)){
    return $ligne['Km'];
  }
  return false;
}

function GetLastFact($S_Chassis){
  $query="SELECT NoCommande FROM atelier1 WHERE NoChasis='".$S_Chassis."' AND Id_Service != '0' ORDER BY NoCommande DESC LIMIT 1";
    $resulta = mysql_query($query) or die('Erreur SQL !<br>'.$query.'<BR>'.Connection::getConnection()->errorInfo());
    if ($ligne = mysql_fetch_array($resulta)){
    return $ligne['NoCommande'];
  }
  return false;
}

function GetLastAtelier($S_Chassis){
  $query="SELECT NoAtelier FROM atelier1 WHERE NoChasis='".$S_Chassis."' AND Id_Service != '0' ORDER BY NoCommande DESC LIMIT 1";
    $resulta = mysql_query($query) or die('Erreur SQL !<br>'.$query.'<BR>'.Connection::getConnection()->errorInfo());
    if ($ligne = mysql_fetch_array($resulta)){
    return $ligne['NoAtelier'];
  }
  return false;
}
*/

?>