<?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,$res;
// entete de la page

//include 'menu/header.php';

$date = date("d-m-Y");

// menu haut new-supp-modif


$Num_entre=$_GET['num_ligne'];
$Num_abat=$_GET['num_bon'];
echo "<br>Num Entre : ".$Num_entre."<br>" ;
echo "<br>Num Abat : ".$Num_abat."<br>" ;
echo "<br>";


$sql = "DELETE FROM saisies_abat WHERE num_ligne='$Num_entre'";
echo "<br>".$sql."<br>";
$res = mysqli_query($link, $sql);
echo "Resultat : $res<br>";

$sql = "SELECT * FROM entreabat WHERE Num_Abatage='$Num_abat'";  
$req = mysqli_query($link, $sql);    
while ($row = mysqli_fetch_assoc($req)) {
        $PoidEntre = $row["Poid_entre"];
        $PoidSaisie = $row["Poid_saisie"];
        $Poidfrd = $row["Poid"];
    }  

echo "<br>Poids ? : $Poidfrd | $PoidSaisie | $PoidEntre <br>" ;

$sql = "UPDATE entreabat SET Poid_saisie = '0' , Poid_entre = '".$Poidfrd."' WHERE Num_Abatage = '".$Num_abat."'";
$sql.=" AND IdNumClient='".$IdNumClient."'";
echo "<br>".$sql."<br>";
$res = mysqli_query($link, $sql);
echo "Resultat : $res"; 

Header("Location: saisie_abattoir.php?limite=0");
?>