<html>
 <head>
  <meta http-equiv='content-type' content='text/html;charset=utf-8'>
  <title>WebBike V1.0</title>
  <link href='style.css' rel='stylesheet' media='screen'>
 </head>
 <body>
<?php
  $pas=1000;
  set_time_limit ( 300 );
  require 'database.inc.php';
  session_start();
  session_register("lg_user");
  session_register("lg_password");
  session_register("lg_admin");
  session_register("lg_menu1");
  session_register("lg_menu2");
  session_register("lg_menu3");
  session_register("lg_menu4");
  session_register("lg_menu5");
  if(Test_User($lg_user,$lg_password)==TRUE)
  {
    	$requette="SELECT * FROM articles_xyz";
    	$resultat=mysql_query($requette);
    	echo "<TABLE border=1>\n";
    	foreach($resultat as $ligne)
    	{
			$noArticleRR = Texte_Sans_Espace($ligne['NoArticle']);
			$resultat_existe_stock = Stock::getStockByNoArticleRR(addslashes($noArticleRR));
			if ($resultat_existe_stock)
			{ // UPDATE
    		  $requette2="UPDATE stock".ID_GARAGE." SET EnStock=EnStock+".$ligne['EnStock']." WHERE NoArticleRR='".addslashes($noArticleRR)."'";
			}
			else
			{ // INSERT
			  $requette2="INSERT INTO stock".ID_GARAGE." (`NoArticleRR` ,`LieuxStock` ,`EnStock` ,`EnTransfert`) VALUES ('".addslashes($noArticleRR)."', NULL , +(".$ligne['EnStock']."), 0);";
			}
    		echo "<TR><TD>".htmlspecialchars($ligne['NoArticle'])."</TD><TD>".htmlspecialchars($ligne['LieuxStock'])."</TD><TD>".htmlspecialchars($ligne['EnStock'])."</TD><TD>".htmlspecialchars($requette2)."</TD></TR>\n";
    		mysql_query($requette2);
		}	
    	echo "</TABLE>\n";
  }
// }
?>
 </body>
</html>
