-
Notifications
You must be signed in to change notification settings - Fork 1
/
ndc.php
243 lines (202 loc) · 6.32 KB
/
ndc.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
<?php
include("./DB/config.php");
$query = "SELECT stampa_ndc.*, clienti.nomeC, clienti.cognomeC, clienti.codC
FROM stampa_ndc
LEFT JOIN clienti
ON stampa_ndc.cf=clienti.CFC,
AND stampa_ndc.Piva=clienti.PIVAC";
/* check connection */
if ($result = $conndb->query($query)) {
if ($debug === true) printf("<!-- Select returned %d rows.\n -->", $result->num_rows);
$oggetto_ndc = 1;
if ($result->num_rows === 0) {
$norows = "Non è presente alcun record";
}
}
if ($conndb->connect_errno) {
printf("Connect failed: %s\n", $conndb->connect_error);
$oggetto_ndc = 0;
}
$queryb = "SELECT id
FROM stampa_ndc";
?>
<!DOCTYPE html>
<html lang="it">
<head>
<!-- blu #071E3F arancione #EA640C -->
<meta charset="utf-8">
<title>NoteDiCredito - 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") // Carica gli stili del tema in uso ?>
<!-- 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]-->
<?php include_once("function/session.php") ?>
<style>
.autocomplete-suggestions {
color: #000000
}
.autocomplete-suggestions {
border: 1px solid #999;
background: #FFF;
overflow: auto;
}
.autocomplete-suggestion {
padding: 2px 5px;
white-space: nowrap;
overflow: hidden;
}
.autocomplete-selected {
background: #F0F0F0;
}
.autocomplete-suggestions strong {
font-weight: normal;
color: #3399FF;
}
.autocomplete-group {
padding: 2px 5px;
}
.autocomplete-group strong {
display: block;
border-bottom: 1px solid #000;
}
</style>
</head>
<body>
<!-- #### Navbars #### -->
<?php include_once("template/parrot/navbar.php") ?>
<div class="masthead">
<div class="masthead-title">
<div class="container">
Genera NDC
</div>
</div>
</div>
<div class="container">
<div class="row">
<form class="form-horizontal" method="post" action="gen_documenti/ndc.php">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Genera</button>
</div>
</div>
</form>
</div>
</div>
<div class="masthead">
<div class="masthead-title">
<div class="container">
Lista NDC
<form method="post" action="#">
<input onkeyup="suggerimento($(this).val())" id="filtro" class="form-control" type="text"
placeholder="Filtra per utente">
</form>
</div>
</div>
</div>
<div class="container">
<span style="color:#EA640C">
Totale voci n. <span id="voci"></span>
</span>
</div>
<div class="container">
<table class="table table-responsive">
<thead>
<tr>
<th>NDC n°</th>
<th>Codice Cliente</th>
<th>Cliente</th>
<th>Data</th>
<th>Pagamento</th>
<th>Totale</th>
<th>Link</th>
</tr>
</thead>
<tbody id="records">
</tbody>
</table>
<div class="row">
<nav class="col-sm-12">
<ul class="pager">
<li class="previous"><a style="display:none" 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>
<?php $result->close(); ?>
<?php include_once("template/parrot/foot.php") ?>
<script>
var records,
rowsReturned = 0;
page = 0,
limit = 20;
suggerimento("");
$("#filtro").keydown(function() {
page = 0;
limit = 20;
});
function suggerimento(runsVar) {
var call = $.ajax({
url: "http://<?php echo $base_url ?>/json/get_ndc.php",
method: "GET",
data: "check=" + runsVar +"&page="+page+"&limit="+limit,
dataType: "json"
});
call.error(function (msg) {
console.log(msg);
});
call.done(function (msg) {
var records = msg.suggestions;
console.log(records);
$("#records").html("");
for (var x in records) {
var record = "" +
"<td>" + records[x].data.num + "</td>" +
"<td>" + records[x].data.codC + "</td>" +
"<td>" + records[x].data.cliente + "</td>" +
"<td>" + records[x].data.data_doc + "</td>" +
"<td>" + records[x].data.pagamDescr + "</td>" +
"<td width='300px'>" + records[x].data.totale + "</td>" +
"<td><a href='http://<?php echo $base_url ?>/gen_documenti/post.php?ndc_n=" + records[x].data.num + "&documento=ndc'>Link</a></td>";
$("#records").append("<tr>" + record + "</tr>");
}
if (jQuery.isEmptyObject(records)) {
record = "<tr><td>" + "Non è presente alcun record" + "</td></tr>";
$("#records").html(record);
}
var voci = parseInt(x) + 1;
if (!voci) {
voci = "0";
}
$("#voci").text(voci);
});
}
$("#succ").click(function() {
page += +20;
limit += +20;
suggerimento($("#filtro").val());
if (page == 0) {
$("#prec").show();
}
if (page > 0 ) {
$("#prec").show();
}
});
$("#prec").click(function() {
if (page !=0 ) {
page += -20;
limit += -20;
suggerimento($("#filtro").val());
$("#prec").show();
if (page == 0 ) {
$("#prec").hide();
}
}
});
suggerimento($("#filtro").val());
</script>
</body>
</html>