<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>

<head>
	<title>Title here!</title>
</head>

<body>
	<?php
	set_time_limit(300);
	require 'database.inc.php';
	$requette = "SELECT * FROM commandearticles" . ID_GARAGE . " WHERE NoCommande >= 100000 AND NoCommande < 630000 AND TypeData = 0 AND GM = 0 AND Quantite != 0";
	$resultat = Connection::executeRawQueryWithfetchAll($requette);
	foreach ($resultat as $ligne) {
		if ($ligne2 = Article::getArticleByNoArticle($ligne['NoArticle'])) {
			$requette3 = "UPDATE commandearticles" . ID_GARAGE . " SET GM=" . $ligne2['GroupeMarchandise'] . ", TVA=-7.6 WHERE NoCommande = " . $ligne['NoCommande'] . " AND Position = " . $ligne['Position'] . "";
			if ($ligne['TVA'] == 0) {
				echo "$requette3<BR>\n";
				Connection::executeRawQuery($requette3);
			} else {
				echo "TVA!=0<BR>\n";
			}
		} else {
			echo $ligne['NoArticle'] . "<BR>\n";
		}
	}

	?>
</body>

</html>