forked from RickyLeRoi/proges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lista_fornitori.php
307 lines (289 loc) · 12.5 KB
/
lista_fornitori.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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html lang="it">
<head>
<!-- blu #071E3F arancione #EA640C -->
<meta charset="utf-8">
<title>Lista Fornitori - Gestionale Provenzano</title>
<meta name="description" content="Gestionale per etichettificio Provenzano"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<?php include_once("template/parrot/style.php");
include_once("function/session.php");
include_once("DB/config.php");?>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<!-- #### Navbars #### -->
<?php include_once("template/parrot/navbar.php") ?>
<div class="masthead">
<div class="masthead-title">
<div class="container">
Lista Fornitori sintetica
</div>
</div>
</div>
<div class="container">
<div>
<form action="lista_fornitori_big.php">
<input class="form-control widthAuto" type="submit" value="Lista completa">
</form>
</div>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Nome</th>
<th>Cognome</th>
<th>Codice</th>
<th>Descrizione</th>
<th>Note</th>
<th>Telefono</th>
<th>P.IVA</th>
<th>Cod Fisc</th>
<th>+ info</th>
</tr>
</thead>
<tbody id="records">
</tbody>
</table>
<div class="row">
<nav class="col-sm-12">
<ul class="pager">
<li class="previous"><a id="prec" href="#"><span aria-hidden="true">←</span> Precedente</a></li>
<li class="next"><a id="succ" href="#">Successivo <span aria-hidden="true">→</span></a></li>
</ul>
</nav>
</div>
</div>
<div class="modal fade" id="clientModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">Scheda Completa</h4>
</div>
<div class="modalClienti" style="color: #000" class="modal-body">
<div class="container">
<table>
<tr>
<td><h4>Fornitori</h4></b></td>
<td></td>
</tr>
<tr>
<td><b>Nome: </b></td>
<td><span id="nomeF"></span></td>
</tr>
<tr>
<td><b>Cognome: </b></td>
<td><span id="cognomeF"></span></td>
</tr>
<tr>
<td><b>Codice Cliente: </b></td>
<td><span id="codF"></span></td>
</tr>
<tr>
<td><b>Descrizione: </b></td>
<td><span id="descrF"></span></td>
</tr>
<tr>
<td><b>Note Cliente: </b></td>
<td><span id="noteF"></span></td>
</tr>
<tr>
<td><b>Indirizzo legale: </b></td>
<td><span id="indirizzoLF"></span></td>
</tr>
<tr>
<td><b>Città legale: </b></td>
<td><span id="cittaLF"></span></td>
</tr>
<tr>
<td><b>Cap legale: </b></td>
<td><span id="capLF"></span></td>
</tr>
<tr>
<td><b>Provincia legale: </b></td>
<td><span id="provinciaLF"></span></td>
</tr>
<tr>
<td><b>Tel legale: </b></td>
<td><span id="telLF"></span></td>
</tr>
<tr>
<td><b>Fax Legale: </b></td>
<td><span id="faxLF"></span></td>
</tr>
<tr>
<td><b>Stato legale: </b></td>
<td><span id="statoLF"></span></td>
</tr>
<tr>
<td><b>Email Legale: </b></td>
<td><span id="emailLF"></span></td>
</tr>
<tr>
<td><b>Sito web legale: </b></td>
<td><span id="sitoWebLF"></span></td>
</tr>
<tr>
<td><b>C. Fiscale: </b></td>
<td><span id="CFF"></span></td>
</tr>
<tr>
<td><b>Iban: </b></td>
<td><span id="IBANF"></span></td>
</tr>
<tr>
<td><b>Banca: </b></td>
<td><span id="bancaF"></span></td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Chiudi</button>
</div>
</div>
</div>
</div>
<?php include_once("template/parrot/foot.php") ?>
<script type="text/javascript">
var records,
page = 0,
limit = 30;
function loadPage(page, limit) {
$.ajax({
url: "http://<?php echo $base_url ?>/json/get_fornitori.php",
dataType: "JSON",
type: "GET",
error: function () {
alert("Chiamata fallita!!!");
},
data: "page=" + page + "&limit=" + limit,
success: function (result) {
records = result;
loadQuery();
page = limit + page;
limit = limit * 2;
}
});
}
</script>
<script type="text/javascript">
var rowsReturned;
function loadQuery() {
rowsReturned = 0;
var tab = document.getElementById('records'),
newTr,
info,
att,
td;
prevNext();
document.getElementById("records").innerHTML = "";
for (var id in records) {
var texts = [records[id].id,
records[id].nomeF,
records[id].cognomeF,
records[id].codF,
records[id].descrF,
records[id].noteF,
records[id].telLF,
records[id].PIVAF,
records[id].CFF];
rowsReturned++;
newTds = generateTd(texts);
for (var td in newTds) {
newTr.appendChild(newTds[td]);
}
info = document.createElement("input");
info.className = "form-control";
info.type = "button";
//info.id = records[id].id;
att = document.createAttribute("data-row"); // Create a "href" attribute
att.value = records[id]["count"]; // Set the value of the href attribute
info.setAttributeNode(att);
info.value = "Dettagli";
info.onclick = function (num) {
var num = this.getAttribute("data-row");
console.log(num);
associativeModal(
{
"#nomeF": records[num].nomeF,
"#cognomeF": records[num].cognomeF,
"#codF": records[num].codF,
"#descrF": records[num].descrF,
"#noteF": records[num].noteF,
"#indirizzoLF": records[num].indirizzoLF,
"#cittaLF": records[num].cittaLF,
"#capLF": records[num].capLF,
"#provinciaLF": records[num].provLF,
"#telLF": records[num].telLF,
"#faxLF": records[num].faxLF,
"#statoLF": records[num].statoLF,
"#emailLF": records[num].emailLF,
"#sitoWebLF": records[num].urlLF,
"#PIVAF": records[num].PIVAF,
"#CFF": records[num].CFF,
"#IBANF": records[num].IBANF,
"#bancaF": records[num].bancaF
}
)
};
td = document.createElement("td");
td.appendChild(info);
newTr.appendChild(td);
document.getElementById('records').appendChild(newTr);
}
function generateTd(arr) {
var newTd,
text;
obj = [];
newTr = document.createElement("tr");
newTr.id = "row-" + records[id]["count"]; // per capire: count è l'ultimo record che indica su quale array siamo
for (key in arr) {
arr[key] == null ? arr[key] = "N/D" : arr[key];
newTd = document.createElement("td");
text = document.createTextNode(arr[key]);
newTd.appendChild(text);
obj.push(newTd);
}
return obj;
}
}
$("#succ").click(function () {
if (rowsReturned == 29) {
page += +30;
limit += +30;
loadPage(page, limit);
}
});
$("#prec").click(function () {
if (page != 0) {
page += -30;
limit += -30;
loadPage(page, limit)
}
});
function prevNext() {
var prev = document.getElementById("prec").parentNode;
if (page < 0 || page == 0) {
prev.className = "hide";
}
else {
prev.className = "previous";
}
var succ = document.getElementById("succ").parentNode;
if (rowsReturned != 29) {
succ.className = "hide";
}
else {
succ.className = "next";
}
}
loadPage(0, 30);
</script>
</body>
</html>