-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatalist.php
161 lines (123 loc) · 6.1 KB
/
datalist.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
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
<?php
/**
* file create for make dataliste updated directely
*/
function dataProduct(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM Produit order by Nom asc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idProduit"].":: Nom ::".$row["Nom"].":: PA ::".$row["PrixAchat"].":: PV = ::".$row["PrixVente"].":: PVmin =::".$row["PrixVmin"].":: Qstock = ::".$row["QuantiteStock"]."::QstockMin = ::".$row["QuantiteStockMin"].":: Description = ::".$row["DescriptionP"]."'>nom: ".$row["Nom"]." :Qstock ".$row["QuantiteStock"]."</option>";
}
}else{$take = "Une erreur s est produite ";}
return $take;
}
function dataVente(){
include 'connexion.php';
$take = '';
$sql= ("SELECT * FROM Ventes, Produit, Client WHERE (Produit.idProduit = Ventes.idProduit) and (Client.idClient = Ventes.idClient) group by Operation order by Operation desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
$valeur = '';
while($row= mysqli_fetch_assoc($result)){
//
$sql1= ("SELECT * FROM Ventes, Produit, Client WHERE (Operation = ".$row["Operation"].") and (Produit.idProduit = Ventes.idProduit) and (Client.idClient = Ventes.idClient) order by Operation desc");
$result1 = mysqli_query($db, $sql1);
if(mysqli_num_rows($result1)>0){
$valeur = '';
while($row1= mysqli_fetch_assoc($result1)){
$valeur .= $row1["Operation"]."::".$row1["idClient"]."::".$row1["NomClient"]."::".$row1["idProduit"].":: Nom ::".$row1["Nom"].":: PA ::".$row1["PrixAchat"].":: PV = ::".$row1["PrixVente"].":: PVmin =::".$row1["PrixVmin"].":: QstockMin = ::".$row1["QuantiteStockMin"]."::".$row1["QuantiteVendu"]."::".$row1["PU"]."::".$row1["DatesVente"]."::".$row1["TotalFacture"]."::".$row1["MontantPaye"]."::__:";
}
}else{echo "Une erreur s est produite ";}
$take .= "<option value='".$valeur."'>operation : ".$row["Operation"]."client: ".$row["NomClient"]." :Totol :".$row["TotalFacture"]."</option>";
}
}else{echo "Une erreur s est produite ";}
return $take;
}
function dataPersonnel(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM Client order by idClient desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idClient"].":: Nom ::".$row["NomClient"].":: Telephone ::".$row["Telephone"]."'> = ".$row["NomClient"]."</option>";
}
}else{$take = "Une erreur s est produite ";}
return $take;
}
function dataDataPersonnel(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM DataPersonnel order by idDataPersonnel desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idDataPersonnel"].":: Nom ::".$row["Nom"].":: Telephone ::".$row["Telephone"]."'> = ".$row["Nom"]."</option>";
}
}else{$take = "Une erreur s est produite ";}
return $take;
}
function dataCaisseOut(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM Sortie order by idSortie desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idSortie"].":: Montant ::".$row["Montant"].":: Motif ::".$row["il_pris_quoi"].":: Type ::".$row["TypeD"].":: Dates ::".$row["DatesD"]."'>montant = ".$row["Montant"]." commentaire : ".$row["il_pris_quoi"]."</option>";
}
}else{$take = "Une erreur s est produite ";}
}
function dataPersoPaie(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM PersonnelPaie, DataPersonnel WHERE (PersonnelPaie.idDataPersonnel = DataPersonnel.idDataPersonnel) order by idPersonnelPaie desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idPersonnelPaie"].":: dates ::".$row["Date"].":: Nom ::".$row["Nom"].":: Montant ::".$row["Montant"].":: Mois ::".$row["Mois"].":: iDPerso ::".$row["idDataPersonnel"].":: Observation ::".$row["Observation"].":: Telephone ::".$row["Telephone"]."'> = ".$row["Nom"].":".$row["Montant"]." $ mois:".$row["Mois"]."</option>";
}
}else{$take = "Une erreur s est produite ";}
return $take;
}
function dataPerteOccaz(){
include 'connexion.php';
$take = '';
$sql = ("SELECT * FROM PerteOccaz order by idPerteOccaz desc");
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)>0){
while($row= mysqli_fetch_assoc($result)){
$take .= "<option value='ID ::".$row["idPerteOccaz"].":: Montant ::".$row["Montant"].":: Motif ::".$row["Commentaire"].":: Dates ::".$row["Dates"]."'>montant = ".$row["Montant"]." commentaire : ".$row["Commentaire"]."</option>";
}
}else{$take .= "Une erreur s est produite ";}
return $take;
}
$q = $_REQUEST["q"];
$autre = '';
if ($q !== "") {
//$hint = dataProduct();
switch($q) {
case 'updateProduct':
$hint = dataProduct();
break;
case 'updateVentes':
$hint = dataVente();
break;
case 'updatePersonnel':
$hint = dataPersonnel();
break;
case 'updateDataPersonnel' :
$hint = dataDataPersonnel();
case 'updatePersoPaie' :
$hint = dataPersoPaie();
case 'updatePerteOccaz' :
$hint = dataPerteOccaz();
}
} else {
$hint = 'erreur';
}
echo ''.$hint;
?>