-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassApprovList.php
56 lines (48 loc) · 1.66 KB
/
classApprovList.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
function dataVente($operation){
include 'connexion.php';
$sql= ("SELECT * FROM Approvisionnement, Produit WHERE (Approvisionnement.idProduit = Produit.idProduit) and (Operation = $operation)");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
$valeur .= '<table class="table border border-1">
<thead class="bg-transparent text-secondary">
<tr>
<th>Nom du produit</th>
<th>Quantite vendu</th>
<th>Prix de vente unitaire</th>
<th>Prix de vente total</th>
</tr>
</thead>
<tbody>';
$total = 0;
while($row= mysqli_fetch_assoc($result)){
$nomClient = $row["Source"];
$date = $row["DatesApprov"];
$total += $row["QuantiteApprov"] * $row["PrixA"];
$valeur .= '
<tr>
<td>
'.$row["Nom"].'
</td>
<td>'.$row["QuantiteApprov"].'</td>
<td>'.$row["PrixA"].'</td>
<td>'.$row["QuantiteApprov"] * $row["PrixA"].'</td>
</tr>';
}
$valeur .= '</tbody>
<h5 class=" mb-3 mt-3 ms-3"> date : '.$date.'</h5>
<h3 class="text-center mb-3 mt-3"> source : '.$nomClient.'</h3>
</table>
<h3 class="text-center mb-3 mt-3"> total : '.$total.' $</h3>';
return $valeur;
}else{return "Une erreur s est produite ";}
}
$q = $_REQUEST["q"];
$autre = '';
if ($q !== "") {
$hint = dataVente($q);
} else {
$hint = 'erreur';
}
echo ''.$hint;
?>