<div id="div_alert" style="display: none; color: red; width: 100%; background-color: rgba(255,255,255,0.5);">Alerte</div>
<?php
  if(isset($Move))
  {
    switch($Move)
    {
      case "UP":
        $resultat=Connection::executeRawQueryWithfetchAll($_SESSION["memres4"]);
        $up=$NoCommande;
        foreach($resultat as $ligne)
        {
          if($NoCommande==$ligne['NoCommande'])
          {
            break;
          }
          else
          {
             $up=$ligne['NoCommande'];
          }
        }
        $NoCommande=$up;
      break;
      case "DOWN":
        $resultat=Connection::executeRawQueryWithfetchAll($_SESSION["memres4"]);
        $down=$NoCommande;
        for ($i=0; $i < count($resultat); $i++)
        {
          $ligne =$resultat[$i];
          $down=$ligne['NoCommande'];
          if($NoCommande==$ligne['NoCommande'])
          {
            if($ligne=$resultat[$i+1])
            {
                $down=$ligne['NoCommande'];
            }
            break;
          }
        }
        $NoCommande=$down;
      break;
    }
  }
  if(isset($NewType))
  {
    $TypeCommande=$NewType;
  }
  else
  {
    $ligne=Commande::getCommandeByNoCommande($NoCommande);
    $TypeCommande=$ligne['Type'];
  }
  switch($TypeCommande)
  {
    case "FD":
      entete_commande("FD","Facture detaillée");
      Affiche_Client_Vehicule(C_CLI+C_VHC+C_CLI2+C_ASS, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "BP":
      entete_commande("BP","Bulletin de livraison");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI);
    break;
    case "FB":
      entete_commande("FB","Facture bulletin de livraison");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "FV":
      $Devis=0;
      entete_commande("FV","Facture vehicule neuf");
      Affiche_Client_Vehicule(C_CLI+C_CLI2+C_BAN+C_VEN+C_VHCV+C_FSTVA, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "FO":
      $Devis=0;
      entete_commande("FO","Facture vehicule occasion");
      Affiche_Client_Vehicule(C_CLI+C_CLI2+C_BAN+C_VEN+C_VHCV+C_FSTVA, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "FL":
      entete_commande("FL","Facture location vehicule");
      Affiche_Client_Vehicule(C_CLI+C_CLI2, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "FI":
      entete_commande("FI","Facture interne");
      Affiche_Client_Vehicule(C_CLI+C_VHC, M_CLI+M_FAC+M_PRI);
    break;
    case "DP":
      entete_commande("DP","Devis");
      Affiche_Client_Vehicule(C_CLI+C_VHC+C_CLI2, M_CLI+M_FAC+M_PRI);
    break;
    case "OP":
      entete_commande("OP","Offre pièces");
      Affiche_Client_Vehicule(C_CLI+C_CLI2, M_CLI+M_FAC+M_PRI);
    break;
    case "OV":
      $Devis=1;
      entete_commande("OV","Offre vehicule");
      Affiche_Client_Vehicule(C_CLI+C_VHCV, M_CLI+M_FAC+M_PRI);
    break;
    case "CP":
      entete_commande("CP","Commande",1);
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI);
    break;
    case "RC":
      entete_commande("RC","Retour commande",1);
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI);
    break;
    case "AM":
      entete_commande("AM","Achat");
      Affiche_Client_Vehicule(C_CLI+C_VHC, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "GF":
      entete_commande("GF","Garantie fourniseur");
      Affiche_Client_Vehicule(C_CLI+C_VHC+C_CLI2+C_FOU+C_FACTURE_ASSOCIE, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "GG":
      entete_commande("GG","Garantie garage");
      Affiche_Client_Vehicule(C_CLI+C_VHC, M_CLI+M_FAC+M_PRI);
    break;
    case "RV":
      entete_commande("RV","Reprise véhicule");
      Affiche_Client_Vehicule(C_CLI+C_VEN+C_VHCV, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "ND":
      entete_commande("ND","Note de credit facture détaillée");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "NB":
      entete_commande("NB","Note de credit facture bulletins");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "NV":
      entete_commande("NV","Note de credit facture vehicule neuf");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "NO":
      entete_commande("NO","Note de credit facture occasion");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "NL":
      entete_commande("NL","Note de credit facture location");
      Affiche_Client_Vehicule(C_CLI, M_CLI+M_FAC+M_PRI+M_ENC);
    break;
    case "TR":
      entete_commande("TR","Transfert");
    break;
    case "MO":
      entete_commande("MO","Modèle");
	  Affiche_Client_Vehicule(C_MODELE, M_CLI+M_FAC);
    break;
    default:
      echo $ligne['Type']."<BR>\n";
    break;
  }
?>
