Bonjour,
je cherche à gérer un stock de matériel sur un site web:
j'aimerai qu'il y ait :
-un champ pour entrer à chaque fois le nombre d'unité commandées,
-un champ qui donne le le nombre d'unités entrées
-un champ qui calcule le nombre d'unités entrées totales (de la première saisie à la dernière saisie).
-un champ pour donner le numéro i du formulaire qui s'incrémente
_un champ qui donne le stock réel par type de matériel =le nombre d'unités entrées - le numéro i
-un champ qui donne le nombre de sorties =au numéro du formulaire
-un champ qui donne le nombre de sorties totale depuis le début
-un champ qui dit s'il ya rupture de stock ou pas.Il ya rupture de stock si le type du matériel est<20
sachant que je veux une remise à zero du numero i du formulaire à chaque fois qu'il yaura une nouvelle saisie du nombre d'unités entrées.
chaque formulaire rmplie et validé est considéré comme une sortie.
Merci de m'aider.
voici mon formulaire:
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
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 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" > <html> <!-- Date de création: 30/10/2008 --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="Usager non enregistre"> <meta name="generator" content="WebExpert 6"> </head> <body bgcolor="magenta"> <img src="images1.jpg" border="0" width="150" height="130" alt=""> <form action="Recupervaleur.php" method="post" enctype="multipart/form-data"> <TABLE border="3" ALIGN="center"536" width="472" bordercolor="teal" bordercolordark="teal" bordercolorlight="teal" style="background-color:white;"> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">N°du formulaire:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="N° du formulaire " SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">Marque :</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Marque" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">N°inventaire CHU:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Numero" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">N°serie:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="N° serie" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">N° poste:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="N° poste" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">N° UF:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="N° UF" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">Nom_Prenom:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Nom_Prenom" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">Secteur:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Secteur" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">Service:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Service" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <B> <font color="#336633"><span style="font-size:10pt;">Localisation:</span></font></B><font color="#336633"><span style="font-size:10pt;"> </span></font></TD> <TD width="328"> <p align="right"> <INPUT TYPE="text" NAME="Localisation" SIZE="30" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> </p> </TD> </TR> <TR height="26"> <TD width="130"> <font color="#336633">Type :</font></TD> <TD width="328"> <p align="right"> <select name="Type" size="1"> <OPTION VALUE="papa">DPM-9620</OPTION> <OPTION VALUE="maman">Speech Mike</OPTION> <OPTION VALUE="tante">Kit de transcription</OPTION> </select></p> </TD> </TR> <TR height="26"> <TD VALIGN="TOP" height="84" width="130"> <font color="#336633">Commentaires : </font> </TD> <TD height="84" width="328" align="right" valign="top"> <TEXTAREA NAME="Commentaires" ROWS="4" COLS="32" WRAP="virtual" STYLE="font-family:Arial; font-size:16px; background-color:white;" CLASS="cad"> Tapez ici vos commentaires</TEXTAREA> </TD> </TR> <TR> <TD COLSPAN=2 align="center"> <INPUT type="submit" value="Envoyer"> </TD> </TR> </TABLE> </FORM> <FORM> <TABLE border="3" ALIGN="right"536" width="472" bordercolor="teal" bordercolordark="teal" bordercolorlight="teal" style="background-color:white;"> <TR height="26"> <TD>N°</TD> <TD> <INPUT type=text name="N°du formulaire"> </TD> </TR> <TR> <TD>Unitéscommandés</TD> <TD> <INPUT type=text name="Marque"> </TD> </TR> <TR> <TD>Nbre_d'entrées</TD> <TD> <INPUT type=text name="N° serie"> </TD> </TR> </TABLE> </FORM> </body> </html>
Voici mon script en php:
j'aimmerai savoir qu'est ce qui ne va pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php /* Date de création: 31/10/2008 */ ?> <html> <body> <?php $server = 'localhost'; $user = 'tata'; $pass = 'tata'; $table =tata; mysql_connect($server, $user, $pass) or die("Impossible de se connecter au serveur $server"); /* ensuite se choisir la base : */ mysql_select_db($tata) or die("impossible de se connecter à la base $tata"); */Récupérer les données */ $(Numduformulaire) = $_POST['N°du formulaire']; $(Marque) = $_POST['Marque']; $(Numero) = $_POST['Numero']; $(Numserie) = $_POST['N°serie']; $(Numposte) = $_POST['N°poste']; $(NumUF) = $_POST['NumUF']; $(NomPrenom) = $_POST['Nom_Prenom']; $(Secteur) = $_POST['Secteur']; $(Service) = $_POST['Service']; $(Localisation) = $_POST['Localisation']; $(Type) = $_POST['Type']; $(Commentaires) = $_POST['Commentaires']; /* puis faire la requete : */ $query = "INSERT INTO $dicteenum (Numduformulaire, Marque,Numero, Numserie, Numposte, NumUF, Nom_Prenom, Secteur, Service, Localisation, Type, Commentaires) VALUES ('$Numduformulaire', '$Marque', '$Numero','$Numserie', '$Numposte', '$NumUF', '$nomPenom', '$Secteur', '$Service', '$Localisation', '$Type', '$Commentaires')"; $resultat = mysql_query($query) or die("L'insertion a echouée car ". mysql_error() ."."); $query1 = "INSERT INTO $gestionmat (UnitesCommandees, Nbre_dentrees) VALUES ('$UnitesCommandees','$Nbre_dentrees')"; $resultat1 = mysql_query($query1) or die("L'insertion a echouée car ". mysql_error() ."."); /* selectionner le numéro du formulaire */ $reponse = mysql_query("SELECT Numduformulaire FROM tata,gestionmat WHERE Numduformulaire.dicteenum==Numformulaire.gestiomat")or die(mysql_error()); echo "Le numéro du formulaire est de:$reponse !<br />"; /* Somme de toutes les entrées */ $nbre_entrees_totale = mysql_query("SELECT Type, SUM Nbre_dentrees, SUM UnitesCommandees FROM tata, gestionmat ORDER BY Type")or die(mysql_error()); echo "Depuis le début ,nous avons:$nbre_entrees_totale de matériels entrés. !<br />"; /* Calcul du stock réel par type de matériel */ ?> <?php /* Rupture de stock ou non */ stockreel=$Nbre_dentrees-$Numduformulaire; if($stockreel<=20) { echo "Attention!!!!!!!!Il ya rupture de stock. !<br />"; } else { echo "Vous disposez de $stockreel de $Type. !<br />"; } ?> <?php /* reset de lauto-incrementation */ if(Nbre_dentrees) { reset Numduformulaire ; } ?> </body> </html>
et j'arrive pas à avoir le stock réel qui est = (Nbre_d'entrees- le Numdu formulaire).A condition qu'il yait un reset du numéro du formulaire à chaque fois qu'il yauira une nouvelle valeur pour le Nbre_d'entrees.
Partager