par
modeste » 15 avr. 2007, 13:56
Bonjour,
un nouveau problème pour moi
il s'agit de pouvoir sauvegarder une entrée de plusieurs articles d'un même bl
voici le code qui sert à récupérer le contenu du bon de livraison
<div id="first">*** Ajout d'une entrée ***
<div id="fin_entree">
<?php
$date_entree=$_POST['date_entree'];
$bl_entree=$_POST['bl_entree'];
$id_fourn=$_POST['id_fourn'];
$id_cat=$_POST['id_cat'];
$nb=$_POST['nb']; // nombre articles à entrée
print "<form method=\"post\" action=\"index.php?op=save_entree\" >";
$date_entree= date("d/m/Y");
print" Date entrée: ";
print"<input type=\"text\" name=\"date_entree\" size=8 maxlength=10 value=\"$date_entree\">";
print" N° B.L.: ";
print"<input type=\"text\" name=\"bl_entree\" size=10 maxlength=10 value=\"$bl_entree\">";
print" Fournisseur: ";
print "<td><select name=\"id_fourn\">";
//Création de la liste des fournisseurs
$query_choix_fourn="SELECT DISTINCT(ID_FOURN), NOM_FOURN FROM fourn_cryolor order by NOM_FOURN asc";
$result_choix_fourn=mysql_query($query_choix_fourn) or die("Erreur dans la requête query_choix_fourn");
$i=0;
$test=0;
while ($row_choix_fourn = mysql_fetch_array($result_choix_fourn, MYSQL_NUM)) {
$choix_fourn="$row_choix_fourn[0]";
if ($i=="0" || ($fourn_post=="%" && $test==0)){
print "<option value=\"\" selected>Choississez ...</option>";
$test=1;
}
if ($id_fourn=="$choix_fourn"){
print "<option value=\"$choix_fourn\" selected>$row_choix_fourn[1]</option>";
}else{
print "<option value=\"$choix_fourn\">$row_choix_fourn[1]</option>";
}
$i++;
}
$test=0;
print "</select><br><br>";
$i=1;
while ($i<>$nb+1){
if ($i<10){
print" *** 0$i *** ";
}
else{
print" *** $i *** ";
}
print" Article: ";
print "<td><select name=\"id_arti\">";
//Création de la liste des Catégories
$query_choix_arti="SELECT DISTINCT(ID_ARTI), REF_ARTI, MAT_ARTI, DIM_ARTI FROM arti_cryolor WHERE CAT_ARTI='$id_cat' order by MAT_ARTI, REF_ARTI asc";
$result_choix_arti=mysql_query($query_choix_arti) or die("Erreur dans la requête query_choix_arti");
$e=0;
$test=0;
while ($row_choix_arti = mysql_fetch_array($result_choix_arti, MYSQL_NUM)) {
$choix_arti="$row_choix_arti[0]";
if ($e=="0" || ($arti_post=="%" && $test==0)){
print "<option value=\"\" selected>Choississez ...</option>";
$test=1;
}
if ($id_arti=="$choix_arti"){
print "<option value=\"$choix_arti\" selected>$row_choix_arti[1] - $row_choix_arti[3] - $row_choix_arti[2]</option>";
}else{
print "<option value=\"$choix_arti\">$row_choix_arti[1] - $row_choix_arti[3] - $row_choix_arti[2]</option>";
}
$e++;
}
$test=0;
print "</select>";
print" Quantité: ";
print"<input type=\"text\" name=\"qte\" size=5 maxlength=5 value=\"$qte\"><br>";
$i++;
}
?>
<p class="ajout">
<?php print"<input type=\"submit\" name=\"save_entree\" value=\"Sauvegarder\">";?>
</p>
<?php
print"</form>";
?>
mais pour la sauvegarde je suis perdu
je dois mettre à jour dans ma table article le champ QTE_MOUV qui correspond au nouveau stock
et
en enregistrer chaque entrée du bl dans ma table mouv_articles dont voici les noms des champs
id_mouv, date_mouv, bl_mouv, fourn_mouv, id_arti, qte_mouv, nb_mouv,cat_mouv (1 pour une entree et 2 pour une sortie)
si quelqu'un pouvait m'aider ca serait sympa
Bonjour,
un nouveau problème pour moi
il s'agit de pouvoir sauvegarder une entrée de plusieurs articles d'un même bl
voici le code qui sert à récupérer le contenu du bon de livraison
[php]
<div id="first">*** Ajout d'une entrée ***
<div id="fin_entree">
<?php
$date_entree=$_POST['date_entree'];
$bl_entree=$_POST['bl_entree'];
$id_fourn=$_POST['id_fourn'];
$id_cat=$_POST['id_cat'];
$nb=$_POST['nb']; // nombre articles à entrée
print "<form method=\"post\" action=\"index.php?op=save_entree\" >";
$date_entree= date("d/m/Y");
print" Date entrée: ";
print"<input type=\"text\" name=\"date_entree\" size=8 maxlength=10 value=\"$date_entree\">";
print" N° B.L.: ";
print"<input type=\"text\" name=\"bl_entree\" size=10 maxlength=10 value=\"$bl_entree\">";
print" Fournisseur: ";
print "<td><select name=\"id_fourn\">";
//Création de la liste des fournisseurs
$query_choix_fourn="SELECT DISTINCT(ID_FOURN), NOM_FOURN FROM fourn_cryolor order by NOM_FOURN asc";
$result_choix_fourn=mysql_query($query_choix_fourn) or die("Erreur dans la requête query_choix_fourn");
$i=0;
$test=0;
while ($row_choix_fourn = mysql_fetch_array($result_choix_fourn, MYSQL_NUM)) {
$choix_fourn="$row_choix_fourn[0]";
if ($i=="0" || ($fourn_post=="%" && $test==0)){
print "<option value=\"\" selected>Choississez ...</option>";
$test=1;
}
if ($id_fourn=="$choix_fourn"){
print "<option value=\"$choix_fourn\" selected>$row_choix_fourn[1]</option>";
}else{
print "<option value=\"$choix_fourn\">$row_choix_fourn[1]</option>";
}
$i++;
}
$test=0;
print "</select><br><br>";
$i=1;
while ($i<>$nb+1){
if ($i<10){
print" *** 0$i *** ";
}
else{
print" *** $i *** ";
}
print" Article: ";
print "<td><select name=\"id_arti\">";
//Création de la liste des Catégories
$query_choix_arti="SELECT DISTINCT(ID_ARTI), REF_ARTI, MAT_ARTI, DIM_ARTI FROM arti_cryolor WHERE CAT_ARTI='$id_cat' order by MAT_ARTI, REF_ARTI asc";
$result_choix_arti=mysql_query($query_choix_arti) or die("Erreur dans la requête query_choix_arti");
$e=0;
$test=0;
while ($row_choix_arti = mysql_fetch_array($result_choix_arti, MYSQL_NUM)) {
$choix_arti="$row_choix_arti[0]";
if ($e=="0" || ($arti_post=="%" && $test==0)){
print "<option value=\"\" selected>Choississez ...</option>";
$test=1;
}
if ($id_arti=="$choix_arti"){
print "<option value=\"$choix_arti\" selected>$row_choix_arti[1] - $row_choix_arti[3] - $row_choix_arti[2]</option>";
}else{
print "<option value=\"$choix_arti\">$row_choix_arti[1] - $row_choix_arti[3] - $row_choix_arti[2]</option>";
}
$e++;
}
$test=0;
print "</select>";
print" Quantité: ";
print"<input type=\"text\" name=\"qte\" size=5 maxlength=5 value=\"$qte\"><br>";
$i++;
}
?>
<p class="ajout">
<?php print"<input type=\"submit\" name=\"save_entree\" value=\"Sauvegarder\">";?>
</p>
<?php
print"</form>";
?>
[/php]
mais pour la sauvegarde je suis perdu
je dois mettre à jour dans ma table article le champ QTE_MOUV qui correspond au nouveau stock
et
en enregistrer chaque entrée du bl dans ma table mouv_articles dont voici les noms des champs
id_mouv, date_mouv, bl_mouv, fourn_mouv, id_arti, qte_mouv, nb_mouv,cat_mouv (1 pour une entree et 2 pour une sortie)
si quelqu'un pouvait m'aider ca serait sympa