Page 1 sur 1

comment afficher la désignation à partir du code produit

Posté : 03 juin 2009, 01:15
par kingpc
Dans ma base de données j'ai un table de produit, chaque produit contient une code produit et une désignation par example :

id_prod.......cod_prod........désign
1................0100005.........transport de sable

dans la création d'une facture je veux insérer le code du produit et dans la facture s'affiche la désignation

j'espère qui vous avez me comprendre
et mercii

Posté : 03 juin 2009, 18:12
par Elie
Bah qu'est ce qui est dur :)

Posté : 03 juin 2009, 20:06
par kingpc
ajoute moi svp cet fonction alors :wink:
<? if($var!=""){
mysql_connect("localhost","root","");
mysql_select_db("SMC-FG");
$ane=date('y');
$anne='20'.$ane;
$axn='______'.$anne;
mysql_query("update facture set date='$datcm' where numfact='$var' and date like'$anne%'");
mysql_query("update facture set timbre='$timb' where numfact='$var' and date like'$axn' ");
mysql_query("update facture set avoir='$avoir' where numfact='$var' and date like'$axn'");
}
$ane=date('y');
$anne='20'.$ane;
$axn='______'.$anne;
?>


<html>

<HEAD>
<TITLE>::SMC-FG >>> Gestion de facture::</TITLE>
<LINK href="style.css" rel=stylesheet type=text/css>
<script src="calendar1.js"></script>
<script>

function verif(){
message="";
quant='0';
pu='0';
var number=".1234567890";
var numbers="1234567890";


if(document.form.design.value==""){
message+="* veuillez remplir le champs designiation\n";
}
if(document.form.quant.value==""){
message+="* veuillez saisir la quantité\n";
}
if(document.form.pu.value==""){
message+="* veuillez saisir le PU/H.TVA \n";
}
if(document.form.tva.value==""){
message+="* veuillez saisir la tva\n";
}

if(document.form.quant.value!=""){
for(var i=0;i<=document.form.quant.value.length-1;i++){
for(var n=0 ;n<=numbers.length-1;n++){
if(document.form.quant.value.charAt(i)==numbers.charAt(n)){
quant='1';
}
}}
if(quant=='0'){
message+="*SVP verifier la quantité\n";
}
}


if(document.form.pu.value!=""){
for(var i=0;i<=document.form.pu.value.length-1;i++){
for(var n=0 ;n<=number.length-1;n++){
if(document.form.pu.value.charAt(i)==number.charAt(n)){
pu='1';
}
}}
if(pu=='0'){
message+="*SVP verifier le PU/H.TVA\n";
}
}


if(message!=""){
alert(message);
}
else{
document.form.submit();
}
}
</script>

</head>


<body bgcolor=#ECE9D8>






<table border=2 cellspacing=0 cellpadding=0 BORDERCOLOR="black" BORDERCOLORDARK="white" width=100%>
<tr><td bgcolor=#ACA899><center><font face=verdana size=4><b>FACTURE</b></font>
<td bgcolor=#ACA899 width=150 align=center><font face=verdana size=2 color=white><b>EASY FACT 1.0</b></font>
</table>
<?
$quant="";
$design="";
$pu="";
$tva="";
mysql_connect("localhost","root","");
mysql_select_db("SMC-FG");

$rq1="select max(numfact) from facture where date like'$axn'";
$rs1=mysql_query($rq1);
$z1=mysql_fetch_row($rs1);
$numf=$z1[0];

$req="select * from facture where numfact='$numf' and date like'$axn'";
$res=mysql_query($req);
$t=mysql_fetch_row($res);
?>
<p>

<center><b>N°: <?echo $numf;?>/<?=$anne?>
<br>
<br></p>
<table width=100%><tr><td>


<table width=100%><tr><td>

<br>
<fieldset>
<legend><b>Renseignement client</b></legend>
<center>
<table>
<tr>
<td><b>DOIT : </b><td><input type=text name=doit size=60 value="<?echo $t[1];?>" readonly="yes" disabled>
<td width=100>
<td><b><b>Sfax le : </b></b><td><input type=Text name=dat value="<?echo $t[3];?>" readonly="yes" disabled>

<tr><td><b>M.F. : </b><td><input type=text name=mf size=60 value="<?echo $t[2];?>" readonly="yes" disabled>
</table>
</fieldset>
<tr><td height=50>
<tr><td>
<form name=form method=post action=misajour.php>
<fieldset>
<legend><b>Formulaire</b></legend>
<table width=100%>
<tr><td><b>Quantité : </b><td><input type=text name=quant size=6>

<?mysql_connect("localhost","root","");
mysql_select_db("SMC-FG");

$pr="select * from produit";
$ps=mysql_query($pr);

?>

<td><b>designation : </b><td><select name=design>
                              <option value="">selectionner produit</option>
                              <option value="">---------------------</option>
                                <?while($ps1=mysql_fetch_row($ps)){?>
                                 <option value="<?echo $ps1[2];?>"><?echo $ps1[2];?></option>
                                <? }?>
                             </select>



<td><b>P.U/H.TVA : </b><td><input type=text name=pu>
<td><b>TVA : </b><td><select name=tva>
                 <option value="">Selectionner la TVA</option>
                 <option value="">- - - - - - - - - - - -</option>
                 <option value=0>0%</option>
                 <option value=12>12%</option>
                 <option value=18>18%</option>
                 
                </select>
<tr><td colspan=6 align=right><td colspan=2 align=left>
<input type=hidden name=numf value=<? echo $numf;?>>
<input type=hidden name=typ value=new>
<input type=hidden name=timb value=<? echo $timb;?>>
<input type=hidden name=date value=<? echo $axn;?>>
<input type=button Onclick="verif()" value="Ajouter_à_la_facture">


</table>
</fieldset>
</table>

</form>
<hr>
<br>
<fieldset>
<legend><b>Contenu de la facture</b></legend>
<table width=100%>
<tr>

<td align=center valign=top><br>
<table border=0 cellspacing=0 cellpadding=0><tr><td>
<table border=2 cellspacing=0 cellpadding=0 BORDERCOLOR="black" BORDERCOLORDARK="white">
<th align=center>Quantité<br>(m&sup3;)
<th align=center width=400>Désignation
<th align=center width=100>P.U<br>H.TVA
<th align=center width=100>Montant<br>H.TVA
<th align=center width=50>TVA<br>(%)
<th align=center width=100>Montant<br>TVA
<th align=center width=100>Montant<br>TTC
<th align=center width=80>action
</th></tr>
<?
mysql_connect("localhost","root","");
mysql_select_db("SMC-FG");


$rq="select * from contenu where numfact=$numf and date_f like'$anne'";
$rs=mysql_query($rq);


if(mysql_num_rows($rs)==0)
{
echo"<tr bgcolor=#cccccc><td colspan=8><center><b>Ajouter les designations</center></tr>
<tr><td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;
<tr><td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;
<tr><td rowspan=2>&nbsp;
    <td align=center height=30 bgcolor=#ACA899><b><font color=black>Droit de timbre</font>
<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td align=center>".$timb."<td>&nbsp;
<tr><td colspan=2 align=right height=30 bgcolor=#ACA899><b><font color=black>TOTAL GENERAL</font>
<td align=center>0.000<td align=center>&nbsp;<td align=center>0.000<td align=center>0.000<td>&nbsp;
</table>

<table border=2 cellspacing=0 cellpadding=0 BORDERCOLOR=black BORDERCOLORDARK=white width=100%>
<tr><td rowspan=3 width=825>

&nbsp;
<td align=center width=180><b>Montant Total</b>
<tr><td align=center valign=center height=50><b>0.000</b></table>";

}
else{

while($z=mysql_fetch_row($rs)){
?>
<tr>
<td height=30 bgcolor=#CBC4B4 align=center><?echo $z[2];?></td>
<td bgcolor=#E9E4DA><?echo $z[3];?></td>
<td bgcolor=#CBC4B4 align=center><?echo $z[4];?></td>
<td bgcolor=#E9E4DA align=center><?echo $z[5];?></td>
<td bgcolor=#CBC4B4 align=center><?echo $z[6]."&nbsp;%";?></td>
<td bgcolor=#E9E4DA align=center><?echo $z[7];?></td>
<td bgcolor=#CBC4B4 align=center><?echo $z[8];?></td>
<td bgcolor=#E9E4DA align=center><a href=delete.php?id=<?echo $z[0];?>&timb=<?echo $timb;?>&typ=new&mthtva=<?echo $z[5]?>&mttva=<?echo $z[7]?>&mtttc=<?echo $z[8]?>&numfact=<?echo $numf?>&date=<?=$axn?>><font color=blue>::supprimer::</font></a></td>

<?
$id=$z[0];
}

$rqe="select * from facture where numfact=$numf and date like'$axn'";
$rse=mysql_query($rqe);

while($ze=mysql_fetch_row($rse)){

echo"<tr><td rowspan=2>&nbsp;
<td align=center height=30 bgcolor=#ACA899><b><font color=black>Droit de timbre</font>
<td>&nbsp;<td>&nbsp;<td>&nbsp;<td>&nbsp;<td align=center>".$timb."<td>&nbsp;
<tr><td colspan=2 align=right height=30 bgcolor=#ACA899><b><font color=black>TOTAL GENERAL</font>
<td align=center>".$ze[5]."<td align=center>&nbsp;<td align=center>".$ze[6]."<td align=center><b>".$ze[7]."</b><td>&nbsp;</table>";
?>

<table border=2 cellspacing=0 cellpadding=0 BORDERCOLOR="black" BORDERCOLORDARK="white" width=100%>
<tr><td rowspan=3 width=825>


<td align=center width=180><b>Montant Total</b>
<tr><td align=center valign=center height=50><b><?echo $ze[7];?></b></table>

<p align=right><a href=termine.php?numfact=<?echo $numf;?>&date=<?=$axn?>&typ=new><b>suivant<b></a>
</table>

<?}
}?>




</table>

</fieldset>
</body>
</html>