<?php
include("include/data.php");
Init_boutique();
global $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $myart, $A_NumArt,$i, $result, $NbLigne, 
$mygroupeart, $mysousgroupeart, $semaine, $limitesuivante, $limiteprecedente, $limite, $total, 
$page, $Nom_Client, $NumAbat;
// entete de la page

/*
http://192.168.1.200/orius/detail_bl_temp_liste.php?ordre=1&plu=3&num_bl_ligne=2&lot=M34213217&traca=234D
*/
if (!isset($_GET['ordre'])) { 
		// Transmis en POST
		$num_ordre=$_POST['ordre'];
		if (isset($_POST['plu'])) { $plu=$_POST['plu']; }  else {$plu=''; }
		if (isset($_POST['num_bl_ligne'])) { $num_bl_ligne=$_POST['num_bl_ligne']; } else {$num_bl_ligne=''; }
		if (isset($_POST['lot'])) { $num_lot=$_POST['lot']; } else {$num_lot=''; }
		if (isset($_POST['traca'])) { $num_traca=$_POST['traca']; } else {$num_traca=''; }
		$valForm="POST" ;
} else {
		// Transmis en GET
		$num_ordre=$_GET['ordre'];
		if (isset($_GET['plu'])) { $plu=$_GET['plu']; }  else {$plu=''; }
		if (isset($_GET['num_bl_ligne'])) { $num_bl_ligne=$_GET['num_bl_ligne']; } else {$num_bl_ligne=''; }
		if (isset($_GET['lot'])) { $num_lot=$_GET['lot']; } else {$num_lot=''; }
		if (isset($_GET['traca'])) { $num_traca=$_GET['traca']; } else {$num_traca=''; }
		$valForm="GET" ;
}
include 'menu/header_lt.php';
// menu haut new-supp-modif

					$sql1="select * FROM plu" ;
					$sql1.=" WHERE Num_PLU='".$plu."'";
					$sql1.=" AND IdNumClient='".$IdNumClient."'";  
					$req1=mysqli_query($link, $sql1);  
					while ($row = mysqli_fetch_assoc($req1)) { 
						$nom_plu_temp = $row["PLU"];
						}


echo "<center>Detail Saisie $nom_plu_temp <br><br>";

echo "<center>" ;
echo "<table width='750' id='customers'>";
echo "<tr>";
echo "<th width='50'>Num ligne</th>" ;
echo "<th width='50'>Num PLu</th>" ;
echo "<th width='150'>Nom PLu</th>" ;
echo "<th width='150'>Num Lot</th>" ;
echo "<th width='50'>Nb Pi</th>" ;
echo "<th width='50'>Poids</th>" ;
echo "<th width='20'>D</th>" ;
echo "</tr>";
					

$TotalPoids=0;
$TotalPi=0;
$li=0;


		$sql = "SELECT * FROM temp_detail_bl WHERE num_bl='".$num_bl_ligne."' and num_plu='".$plu."'"; 
		$sql.= " AND num_lot='".$num_lot."'";  
		$sql.= " AND num_traca='".$num_traca."'";  
		$sql.= " AND IdNumClient='".$IdNumClient."'";
		$sql.= " ORDER BY `num_ligne` ASC";
		$req = mysqli_query($link, $sql);
		while ($row = mysqli_fetch_assoc($req)) {
		      $li=$li+1; 
					
					$num_plu_temp = $row["num_plu"];
	        $poids_temp = $row["poids"];
	        $nb_pi_temp = $row["nb_pi"];
					$num_lot = $row["num_lot"];
					$num_traca = $row["num_traca"];
					$num_ligne_temp = $row["num_ligne"];
		
		$TotalPoids = $poids_temp + $TotalPoids ;
		$TotalPi = $TotalPi + $nb_pi_temp ;
		
		$poids_temp = number_format($poids_temp, 2, '.', ' ')	;
		$nb_pi_temp = number_format($nb_pi_temp, 0, '.', ' ')	;
		  		 
		echo "<tr>";
		echo "<td width='50' style='text-align:center'>$li</td>" ;
		echo "<td width='50' style='text-align:center'>$num_plu_temp </td>" ;
		echo "<td width='150' style='text-align:left'>$nom_plu_temp </td>" ;
		echo "<td width='150' style='text-align:center'>$num_lot | $num_traca </td>" ;
		echo "<td width='50' style='text-align:right'>$nb_pi_temp Pi</td>" ;
		echo "<td width='50' style='text-align:right'>$poids_temp Kg</td>" ;
		echo "<td width='50' style='text-align:center'><a href='delete_laligne_bl_temps.php?ordre=1&num_ligne=$num_ligne_temp'><img src='images/trash.png'></td>" ;
		echo "</tr>" ;
				 }  
		$TotalPoids = number_format($TotalPoids, 2, '.', ' ')	;
		$TotalPi = number_format($TotalPi, 0, '.', ' ')	;
		
		echo "<tr style='background-color:lightgrey;'>" ;
		echo "<td colspan=4 style='text-align:center'>Total</td>" ;
		echo "<td width='50' style='text-align:right'>$TotalPi Pi</td>" ;
		echo "<td width='50' style='text-align:right'>$TotalPoids Kg</td>" ;
		echo "<td width='50' style='text-align:right'></td>" ;
		echo "</tr>" ;
		echo "</table>" ;
		echo "<a href='#' onclick='window.close()'>Fermer</a>";
//

?>
