Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 30/11/2011, 15h48   #1
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
Par défaut Comment creer un formulaire facture

bonjour
svp , j'essai de creer une facture , j'ai une table nommé facture contien numéro facture, date facture , client,et code article, désignation article, quantité a facturé ,prix hors taxe, tva17%, montant ht, montant ttc,
le problem j'ai essai de creer un formulaire en php pour l'instant c pas un problem mais j'ai pas su comment faire pour ajouter les article c'est a dire
chaque facture a plusieur article a saisir et les donner seront sauvgarder dans une table appller facture
si'il y'a un script exemple
merci
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/11/2011, 15h51   #2
Membre à l'essai
 
Inscription : mars 2008
Messages : 140
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 140
Points : 22
Points : 22
Citation:
Envoyé par beloufa26 Voir le message
si'il y'a un script exemple
merci
Tu veux qu'on t'explique comment faire où tu veux qu'on te donne un script déjà tout fait ?
yamatoshi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/11/2011, 16h04   #3
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
ce que tu veut mon amie,
je veut vraiment apprend le php ca fait 6 mois que je suis bloqué sur ce problem franchement j'avou que c dure pour moi, l'essentiel c trouvé la réponce et surtout si ta une petit explication simple ca serai tres gentil de votre part.
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 01
Vieux 30/11/2011, 16h25   #4
Membre à l'essai
 
Inscription : mars 2008
Messages : 140
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 140
Points : 22
Points : 22
Ben si tu sais déjà créer des formulaires alors ça va.

Une des pistes serait de créer deux tables. Une table client et une table facture? Dans la table facture tu mets autant de champ que tu as d'éléments. Ensuite tu fais des insert simple dans ta base à partir de ton formulaire avec comme entrée le numéro de facture. (Tu sais faire ça non ?)

Ainsi tu auras dans ta base plusieurs lignes correspondant à tes articles avec dénominateur commun le numéro de facture. Ainsi pour un numéro donnée, tu pourra faire un select, pour récupérer tous les articles associés à une facture. Ainsi de suite.

Pour les références clients. C'est la même chose. Dans ta table facture, tu peux également insérer un id_client. Comme ça pour récupérer les infos du client il te suffira juste de faire une jointure des deux tables grâce à l'id_client.

Bon, je ne sais pas si c'est claire, mais si ça peut t'aider tant mieux !
yamatoshi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/11/2011, 16h33   #5
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
merci
oui ca ya pas de problem
le vrai problem que j'ai c comment creer une boucle qui affiche le nombre d'article a saisir dans la facture,
j'ai essai d'ajouter dans le formulaire de saisie un champ ou l'utilisateur doit entree le nombre d'article a facturé puis ex si le nombre d'article c'est 6 alors j'ai fait une boucle avec for ou $i = 6 elle m'affiche 6 ligne
est la je saisi les 6 article et je valide
mon problem c un problem d'ecriture ou alghoritme j'ai pas bien su ecrire la boucle.
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/11/2011, 16h39   #6
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
je t'envoie une image gif qui explique mon problem
voir la pièce joint
Images attachées
Type de fichier : jpg SRFile2011_10_3_21_28_13_343.jpg (60,0 Ko, 16 affichages)
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/11/2011, 17h15   #7
Membre éclairé
 
Avatar de humitake
 
Homme Olivier
Étudiant
Inscription : novembre 2010
Messages : 303
Détails du profil
Informations personnelles :
Nom : Homme Olivier
Âge : 20
Localisation : France

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : novembre 2010
Messages : 303
Points : 384
Points : 384
Citation:
Envoyé par beloufa26
mon problem c un problem d'ecriture ou alghoritme j'ai pas bien su ecrire la boucle.
Ton problème, si j'ai bien compris, c'est que tu récupère bien les éléments mais que tu n'arrive pas à les afficher c'est ça ?

Si c'est le cas pourrait tu donner un peu plus de précision sur ton problèmes ?
Un peu de code nous aiderait aussi pas mal à comprendre ce que tu raconte parce qu'on n'a malheureusement pas de boule magique pour débugger, et c'est bien dommage

Par exemple pourrait-tu nous donner le code de
Citation:
Envoyé par beloufa26
j'ai essai d'ajouter dans le formulaire de saisie un champ ou l'utilisateur doit entree le nombre d'article a facturé puis ex si le nombre d'article c'est 6 alors j'ai fait une boucle avec for ou $i = 6 elle m'affiche 6 ligne
est la je saisi les 6 article et je valide
car ton "problème" doit venir de cette boucle
humitake est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/12/2011, 11h11   #8
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
bonjour

je sais que j'ai fait pas male d'erreur
vous pouvez me corrigé
merci
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
<?php
// connexion a la BD
mysql_connect("localhost", "root", "");
  mysql_select_db("bdd");
?>
<fieldset>
	<label> Code client </label>
	<select name="id_client" style="width : 250px;">
		<option value="" selected="selected">...</option>
<?php	// liste deroulante des familles d'articles (categories)
	$requete = mysql_query("SELECT id_client, n_cli FROM client ORDER BY id_client ASC;")or die(mysql_error());
	While ($ligne = mysql_fetch_array($requete))
	{
?>
		<option value="<?php echo $ligne['id_client'] ;?>"><?php echo $ligne['id_client'];?>-----------> <?php echo $ligne['n_cli'];?></option>
<?php	} ?>
	</select>
 
 
 
<label> Désignation d'article : </label><input type="text" name="n_art" maxlength="20" size="19"/>
<label> Prix.U d'article :  </label><input type="text" name="p_u_art" maxlength="10" size="12"/><br/><br/>
 
 
 
 
 
 
 
 
<?
for 
<label> nombre article a facturé : </label><input type="text" name="Q" maxlength="16" size="17"/><br/><br/> 
 
 
 
 
 
 
 
 
    <input type="submit" value="Ajouter"/><input type="reset" value="Annuler"></td>  
 
   </fieldset>
</form>   
 
$Q=$i;
 
<?php
for($i=0; $i<10; ++$i)
{
echo $i;
}
?>
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/12/2011, 14h00   #9
Membre éclairé
 
Avatar de humitake
 
Homme Olivier
Étudiant
Inscription : novembre 2010
Messages : 303
Détails du profil
Informations personnelles :
Nom : Homme Olivier
Âge : 20
Localisation : France

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : novembre 2010
Messages : 303
Points : 384
Points : 384
Alors tout d'abord il faut éviter de mettre plusieurs <?php ?> dans le même fichier. Tu as fait ça afin de pouvoir afficher du html. Pour ça il y a plus simple et beaucoup plus propre :
Il suffit de créer une variable $html et d'y placer dedans tout le code html de la page. Et en fin de page un echo $html; te permettra de l'afficher.

J'ai donc retouché ton code afin de le ré-indenter et d'ajouter la variable $html n'hésite pas à modifier l'indentation pour que tu garde une bonne lisibilité

Code php :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// connexion a la BD
mysql_connect("localhost", "root", "");
  mysql_select_db("bdd");
$html .= '<fieldset>
	<label> Code client </label>
	<select name="id_client" style="width : 250px;">
		<option value="" selected="selected">...</option>';
// liste deroulante des familles d'articles (categories)
$requete = mysql_query("SELECT id_client, n_cli FROM client ORDER BY id_client ASC;")or die(mysql_error());
while ($ligne = mysql_fetch_array($requete))
    $html .= '<option value="' . $ligne['id_client'] . '">' . $ligne['id_client'] . '-----------> ' . $ligne['n_cli'] . '</option>';
 
$html .= '</select>';
 
$html .= '<label> Désignation d\'article : </label><input type="text" name="n_art" maxlength="20" size="19"/>
          <label> Prix.U d\'article :  </label><input type="text" name="p_u_art" maxlength="10" size="12"/><br/><br/>';
 
//for
$html .= '<label> nombre article a facturé : </label><input type="text" name="Q" maxlength="16" size="17"/><br/><br/> ';
 
 
    $html .= '<input type="submit" value="Ajouter"/><input type="reset" value="Annuler"></td>
        </fieldset></form>';
 
echo $html;
 
$Q=$i;
 
for($i=0; $i<10; ++$i)
    echo $i;
?>

Ligne 19 tu as un for qui se balade tout seul.
Ligne 16-17 tu as placé des valeurs n_art et p_u_art, ne serais-ce pas des champs de la base de données à remplacer ? $ligne['n_art'] et $ligne['p_u_art']Ligne 28 tu affecte la valeur de $i à $Q alors que cette variable n'a pas été définie auparavant

Par contre j'ai toujours un peu de mal à comprendre ce que tu souhaite faire
humitake est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/12/2011, 11h40   #10
 
mahfoud beloufa
Inscription : juin 2010
Messages : 19
Détails du profil
Informations personnelles :
Nom : mahfoud beloufa

Informations forums :
Inscription : juin 2010
Messages : 19
Points : -6
Points : -6
bonjour
je vous envoie quelque détail pour voir

premier table (facture)
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
-- phpMyAdmin SQL Dump
-- version 3.1.3.1
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Sam 03 Décembre 2011 à 18:37
-- Version du serveur: 5.1.33
-- Version de PHP: 5.2.9-2
 
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Base de données: `bdd`
--
 
-- --------------------------------------------------------
 
--
-- Structure de la table `facture`
--
 
CREATE TABLE IF NOT EXISTS `facture` (
  `id_fa` int(11) NOT NULL AUTO_INCREMENT,
  `id_cli` int(11) NOT NULL,
  `d_fa` datetime NOT NULL,
  `ht_fa` decimal(10,0) NOT NULL,
  `ttc_fa` decimal(10,0) NOT NULL,
  PRIMARY KEY (`id_fa`),
  UNIQUE KEY `id_reg` (`id_cli`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
 
--
-- Contenu de la table `facture`
--
 
INSERT INTO `facture` (`id_fa`, `id_cli`, `d_fa`, `ht_fa`, `ttc_fa`) VALUES
(15, 123222, '2011-12-03 18:08:13', '100', '100');
deusième table (element_facture)
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
-- phpMyAdmin SQL Dump
-- version 3.1.3.1
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Sam 03 Décembre 2011 à 18:38
-- Version du serveur: 5.1.33
-- Version de PHP: 5.2.9-2
 
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Base de données: `bdd`
--
 
-- --------------------------------------------------------
 
--
-- Structure de la table `element_facture`
--
 
CREATE TABLE IF NOT EXISTS `element_facture` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_fa` int(11) NOT NULL,
  `id_art` varchar(10) NOT NULL,
  `n_art` varchar(16) NOT NULL,
  `qte` int(11) NOT NULL,
  `p_u_art` double(10,2) NOT NULL,
  `tva` int(5) NOT NULL,
  `p_u_net` double(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ;
 
--
-- Contenu de la table `element_facture`
--
 
INSERT INTO `element_facture` (`id`, `id_fa`, `id_art`, `n_art`, `qte`, `p_u_art`, `tva`, `p_u_net`) VALUES
(28, 1, '100S2100', 'TONER BLACK7232', 6, 6700.00, 17, 6700.00);
le fichier FACTUREF.php
Code :
1
2
3
4
5
6
 
<?php include_once('menuapplic.php'); ?>
<?php include_once('facture.php'); ?>
 
<table>
<tr><td width="700px"; height="100px">
le fichier facture.php

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
        <table width="95%" border="0">
        <tr>
        <td colspan="2">        
        <?php
        if (isset($_POST['qte']))
        {
          include("facture/etablissement_facture2.php");
        }
 
        else if (isset($_GET['id_art']))
        {
          include("facture/etablissement_facture.php");
        }
 
        else if (isset($_GET['id_fam']))
        {
          include("facture/article.php");
        }
 
        else if (isset($_GET['id_client']))
        {
          include("facture/famille_article.php");
        }
 
        else
        {
          include("facture/client.php");
        }
        ?>

etablissement_facture3.php

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
 
<?php
$jour=date("d");
$mois=date("n");
$annee=date("Y");
$heure=date("H");
$minute=date("i");
$seconde=date("s");
$d_fa=$annee."-".$mois."-".$jour." ".$heure.":".$minute.":".$seconde;
 
$id_client = $_POST['id_client'];
$id_fam = $_POST['id_fam'];
$id_art = $_POST['id_art'];
$qte = $_POST['qte'];
$n_facture = $_POST['n_facture']; 
 
mysql_connect("localhost","root", "");
mysql_select_db("bdd");
$requette = mysql_query("SELECT * FROM article WHERE id_art='$id_art' ");
mysql_close();
 
while ($ligne = mysql_fetch_array($requette))
{
  $n_art_ex = $ligne['n_art'];
  $p_u_art = $ligne['p_u_art'];
}
?>
<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="etablissement_facture3.php">
<tr><td>Client :</td>
    <td>
    <select name="id_client">
    <option selected="selected">Sélectionner le client :</option>
    <?php
    mysql_connect("localhost","root", "");
    mysql_select_db("bdd");
    $requette = mysql_query("SELECT * FROM client ORDER BY n_cli");
    mysql_close();
 
    while ($ligne = mysql_fetch_array($requette))
    {
      $n_cli = $ligne['n_cli'];
      $id_client_ex = $ligne['id_client'];
 
      if ($id_client==$id_client_ex)
      {
        ?>
        <option value="<?php echo $id_client_ex; ?>" selected="selected"><?php echo $n_cli; ?></option>
        <?php
      }
 
      else
      {
        ?>
        <option value="<?php echo $id_client_ex; ?>"><?php echo $n_cli; ?></option>
        <?php
      }
    }
    ?>
    </select>
    </td>
</tr>
 
<tr><td colspan="2"><br /></td></tr>
 
<tr><td>Famille article :</td>
    <td>
    <select name="id_fam">
    <option selected="selected">Sélectionner la formation :</option>
    <?php
    mysql_connect("localhost","root", "");
    mysql_select_db("bdd");
    $requette = mysql_query("SELECT * FROM famillearticle ORDER BY code_fart");
    mysql_close();
 
    while ($ligne = mysql_fetch_array($requette))
    {
      $li_art = $ligne['li_art'];
      $id_fam_ex = $ligne['id_fam'];
 
      if ($id_fam==$id_fam_ex)
      {
        ?>
        <option value="<?php echo $id_fam_ex; ?>" selected="selected"><?php echo $li_art; ?></option>
        <?php
      }
 
      else
      {
        ?>
        <option value="<?php echo $id_fam_ex; ?>"><?php echo $li_art; ?></option>
        <?php
      }
    }
    ?>
    </select>
    </td>
</tr>
 
<tr><td colspan="2"><br/></td></tr>
 
<tr><td>article :</td>
    <td>
    <select name="id_art">
    <option selected="selected">Sélectionner l'article :</option>
    <?php
    mysql_connect("localhost","root", "");
    mysql_select_db("bdd");
    $requette = mysql_query("SELECT * FROM article WHERE id_fam='$id_fam' ORDER BY n_art");
    mysql_close();
 
    while ($ligne = mysql_fetch_array($requette))
    {
      $id_art_ex = $ligne['id_art'];
      $n_art = $ligne['n_art'];
 
      if ($id_art==$id_art_ex)
      {
        ?>
        <option value="<?php echo $id_art_ex; ?>" selected="selected"><?php echo $n_art; ?></option>
        <?php
      }
 
      else
      {
        ?>
        <option value="<?php echo $id_art_ex; ?>"><?php echo $n_art; ?></option>
        <?php
      }
    }
    ?>
    </select>
    </td>
</tr>
<tr><td colspan="2"><br /></td></tr>
 
<tr><td>Quantité :</td>
    <td><input name="qte" type="text" /></td>
</tr>
 <tr><td><input name="n_facture" value="<?php echo"$n_facture"; ?>" type="hidden" /></td></tr>
<tr><td colspan="2"><br /></td></tr>
 
<tr><td colspan="2"><input type="submit" value="insérer" /></td>
</tr>
</form>
</table>
 
<?php
mysql_connect("localhost","root", "");
mysql_select_db("bdd");
mysql_query ("INSERT INTO element_facture (id, id_fa, id_art, n_art, qte, p_u_art, tva, p_u_net) VALUES ('', '$n_facture', '$id_art', '$n_art_ex', '$qte', '$p_u_art', '17', '$p_u_art')") or die (mysql_error ());
mysql_close();
?>
 
<table align="center" width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="800">
<img src="facture/facture.png">
</td>
 
 
</tr>
 
<tr>
<td colspan="3">
<br/>
<p style="text-align : right; margin-right : 10px; margin-top : 0px; margin-bottom : 0px">Client : <b><?php echo "$n_cli";?></b></p>
<br/><br/>
</td>
</tr>
 
<tr>
<td colspan="3">
<span style="margin-left : 10px; font-weight : bold; font-size : 20px;">Facture n° <?php echo"$n_facture"; ?></span>
<br/><br/>
</td>
</tr>
</table>
 
<table align="center" width="800" border="1">
<tr>
<td width="25%" align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Date de facturation</span></td>
<td width="25%" align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Code client</span></td>
<td width="25%" align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Vos réferences</span></td>
<td width="25%" align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Nos réferences</span></td>
</tr>
 
<tr>
<td width="25%" align="center"><p style="margin-top : 10px; margin-bottom : 10px; font-size : 20px;"><?php echo "$jour/$mois/$annee";?><br/><span style="font-size : 15px;">à <?php echo $heure; ?>:<?php echo $minute; ?>:<?php echo $seconde; ?></span></p></td>
<td width="25%" align="center"><p style="margin-top : 10px; margin-bottom : 10px;"></p><b><?php echo "$n_cli";?></b></td>
<td width="25%" align="center"><p style="margin-top : 10px; margin-bottom : 10px;">Nos réferences</p></td>
<td width="25%" align="center"><p style="margin-top : 10px; margin-bottom : 10px;">Nos réferences</p></td>
</tr>
</table>
 
<table align="center" width="800" border="1">
<tr>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Réferences</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Désignation</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Qté</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">P.U.(HT)</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">TVA</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">P.U. Net (HT)</span></td>
<td align="center" bgcolor="#000000"><span style="color : #FFFFFF;">Montant (HT)</span></td>
</tr>
<?php
mysql_connect("localhost","root", "");
mysql_select_db("bdd");
$requette = mysql_query("SELECT * FROM element_facture WHERE id_fa='$n_facture' ")or die(mysql_error());
mysql_close();
 
$montant_total = 0;
 
While ($ligne = mysql_fetch_array($requette))
{
  $id_art = $ligne['id_art'];
  $n_art = $ligne['n_art'];
  $qte = $ligne['qte'];
  $p_u_art = $ligne['p_u_art'];
  $tva = $ligne['tva'];
  $montant_art = $p_u_art * $qte;
 
  $montant_total = $montant_total + $montant_art;
 
  ?>
  <tr>
  <td align="center" width="130"><p style="font-family : arial; font-size : 10pt; margin-top : 10px; margin-bottom : 10px; font-size : 12px;"><?php echo"$id_art"; ?></p></td>
  <td align="left"><p style="font-family : arial; margin-left : 05px; margin-top : 10px; margin-bottom : 10px;  margin-bottom : 10px; font-size : 12px;"><?php echo"$n_art"; ?></p></td>
  <td align="center" width="50"><p style="font-family : arial; margin-top : 10px; margin-bottom : 10px; font-size : 12px;"><?php echo"$qte"; ?></p></td>
  <td align="center" width="100"><p style="font-family : arial; margin-top : 10px; margin-bottom : 10px; font-size : 12px;"><?php echo"$p_u_art"; ?></p></td>
  <td align="center" width="50"><p style="font-family : arial; margin-top : 10px; margin-bottom : 10px; font-size : 12px;">17 %</p></td>
  <td align="center" width="100"><p style="font-family : arial; margin-top : 10px; margin-bottom : 10px; font-size : 12px;"><?php echo"$p_u_art"; ?></p></td>
  <td align="center" width="100"><p style="font-family : arial; margin-top : 10px; margin-bottom : 10px; font-size : 12px;"><?php echo"$montant_art"; ?></p></td>
  </tr>
  <?php
}
?>
 
 
<tr>
<td align="left" colspan="6"><p style="font-family : arial; margin-top : 20px; margin-bottom : 60px; margin-left : 350px; font-size : 12px;">Total montant hors taxe soumis à TVA 17 %<br/>Total TVA à 17 %</p></td>
<td align="center" width="100"><p style="font-family : arial; margin-top : 20px; margin-bottom : 60px; font-size : 12px;"><?php echo"$montant_total"; ?></p></td>
</tr>
</table>
beloufa26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 00h49.


 
 
 
 
Partenaires

Hébergement Web