<?php include_once("settings.php"); 


///////////////////////////////////////////////////////////////////////////////////////////////
$sql=mysqli_query($connect, "SELECT agent, sum(sticlaH), sum(navetaH), sum(keg30H), sum(keg50H), sum(sticlaT), sum(navetaT), sum(keg30T), sum(keg50T), sum(palet_euro), sum(palet_neuro), sum(keg20H), sum(vitrina_romaqua), sum(vitrina_aquacarpatica) AS firma FROM clienti GROUP BY agent");

echo '<form method="POST" action="index.php?page=cautare">';

echo '<table width="98%" border="1" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>	
	<td >Agent</td>
		<td >Sticle<br />Heineken</td>
		<td >Navete<br />Heineken</td>
			<td >Keg 20L<br />Heineken</td>
		<td >Keg 30L<br />Heineken</td>
		<td >Keg 50L<br />Heineken</td>
		<td >Sticle<br />Tuborg</td>
		<td >Navete<br />Tuborg</td>
		<td >Keg 30L<br />Tuborg</td>
		<td >Keg 50L<br />Tuborg</td>
		<td >Palet<br />EURO</td>
		<td >Palet<br />N-EURO</td>
		<td >Palet CHEP<br />Albastru</td>
		<td >Palet<br />ROSE</td>
	</tr>';
while ($row=mysqli_fetch_row($sql)) {
	echo '
		<tr>		
			<td ><input name="cautare" type="submit" alt="'.$row['0'].'" title="Vezi toate tranzactiile acestui client" border="0" id="submit" value="'.$row['0'].'" size="40"></td>
			<td>'.$row[1].'</td>
			<td>'.$row[2].'</td>
			<td>'.$row[11].'</td>
			<td>'.$row[3].'</td>
			<td>'.$row[4].'</td>
			<td>'.$row[5].'</td>
			<td>'.$row[6].'</td>
			<td>'.$row[7].'</td>
			<td>'.$row[8].'</td>
			<td>'.$row[9].'</td>
			<td>'.$row[10].'</td>
			<td>'.$row[12].'</td>
			<td>'.$row[13].'</td>
		</tr>';
}
echo '<tr>	
	<td >Agent</td>
		<td >Sticle<br />Heineken</td>
		<td >Navete<br />Heineken</td>
			<td >Keg 20L<br />Heineken</td>
		<td >Keg 30L<br />Heineken</td>
		<td >Keg 50L<br />Heineken</td>
		<td >Sticle<br />Tuborg</td>
		<td >Navete<br />Tuborg</td>
		<td >Keg 30L<br />Tuborg</td>
		<td >Keg 50L<br />Tuborg</td>
		<td >Palet<br />EURO</td>
		<td >Palet<br />N-EURO</td>
		<td >Palet CHEP<br />Albastru</td>
		<td >Palet<br />ROSE</td>
	</tr>
</table>';
echo '</form>';
?> 

