-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuova_spesa.php
222 lines (187 loc) · 8.73 KB
/
nuova_spesa.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
<?php
require ("x_session.php");
require("db_config.php");
$mysqli = new mysqli($host, $username, $password, $database);
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>FM20</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/nuova_spesa.css">
<!-- Javascript
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script-->
<!--script src="js/hnl.mobileConsole.js"></script-->
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="images/favicon.png">
</head>
<body>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div id="overlay" onclick="off()">
<div id="reader"></div>
</div>
<div class="container">
<div class="row">
<div style="margin-top: 10%">
<a href='index.php'><img src='images/left.png' style='height: 25px;width: 25px;margin-right: 20px;'></a>
<h3 style='text-align:left;display: inline-block'>Aggiungi spesa</h3>
<hr style ="margin-top: -2rem;">
</div>
</div>
<a class="button" href="#" onclick="on()">
<img src="images/qrcode-solid.svg" width="15" height="15" style="vertical-align: sub;"/>
QR-SCAN SCONTRINO MIGROS
</a>
<form action="x_nuova_spesa.php" method="POST">
<!-- INFO AFFITTANTE -->
<!--h4>Informazioni base</h4-->
<div class="row">
<div class="four columns">
<label for="nome">Nome</label>
<input type="text" id="nome" name="nome" required>
</div>
<div class="four columns">
<label for="dataora">Data e ora</label>
<input type="datetime-local" id="dataora" name="dataora" required>
</div>
</div>
<div class="row">
<div class="eight columns">
<label for="luogo">Luogo</label>
<input type="text" id="luogo" name="luogo">
</div>
</div>
<div class="row">
<div class="eight columns">
<label for="descrizione">Descrizione / Riferimento</label>
<textarea class="u-full-width" id="descrizione" name="descrizione"></textarea>
</div>
</div>
<div class="row">
<div class="four columns">
<label for="spesa_totale">Spesa totale</label>
<input type="number" id="spesa_totale" name="spesa_totale" step="any" required>
</div>
<div class="four columns">
<label for="valuta">Valuta</label>
<select class="u-full-width" id="valuta" name="valuta">
<option id="cur_CHF" value="CHF" rate="1.00">CHF - Franco Svizzero</option>
<!--option value="EUR" disabled>EUR - Euro</option>
<option value="PLN" disabled>PLN - Złoty polacco</option>
<option value="HUF" disabled>HUF - Fiorino ungherese</option>
<option value="CZK" disabled>CZK - Corona ceca</option-->
<?php $url = "https://www.backend-rates.ezv.admin.ch/api/xmldaily?locale=en";
$xml = simplexml_load_file($url);
foreach ($xml->devise as $curr) {
$curr_nome = $curr->land_it[0];
$curr_rate = 1.0/$curr->kurs[0];
$curr_code = strtoupper($curr->attributes()["code"][0]);
echo "<option id=\"cur_$curr_code\"value=\"$curr_code\" rate=\"$curr_rate\">$curr_code - $curr_nome</option>";
}
?>
</select>
</div>
</div>
<div class="row">
<div class="four columns">
<label for="spesa_totale_chf">Spesa totale CHF</label>
<input type="number" step='any' id="spesa_totale_chf" name="spesa_totale_chf" readonly>
</div>
<div class="four columns">
<label for="cambio">Cambio</label>
<input type="number" step='any' id="cambio" name="cambio" readonly>
</div>
</div>
<h4 style ="margin-top: 2rem;">Suddivisione</h4>
<hr style ="margin-top: -2rem;">
<div class="row">
<div class="four columns">
<label for="id_utente_pagante">Creditore</label>
<select class="u-full-width" id="id_utente_pagante" name="id_utente_pagante">
<?
$sql = "SELECT * FROM utenti";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
while($riga = $result->fetch_assoc()) {
if ($riga['id_utenti'] == $x_id) {$mio = 'selected';} else {$mio = '';}
echo "<option value='".$riga['id_utenti']."'".$mio.">".$riga['nome']."</option>";
}
} else {
echo "ERRORE!";
}
?>
</select>
</div>
</div>
<div class="row">
<div class="four columns">
<label for="romana">Opzioni</label>
<a class="button" id="romana" onclick="romana();">Alla romana</a>
<!--a class="button" id="romana" onclick="romana_sei();">A SEI</a>
<a class="button" id="romana" onclick="romana_cinque();">A CINQUE</a-->
<a class="button" id="azzera" onclick="azzera();">Azzera</a>
</div>
</div>
<div class="row">
<div class="eight columns">
<table class="u-full-width">
<thead>
<tr>
<th>Spese</th>
<th></th>
</tr>
</thead>
<tbody>
<?
$sql = "SELECT * FROM utenti";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
while($riga = $result->fetch_assoc()) {
echo "<tr><td>".$riga['nome']."</td><td><input placeholder='0' type='number' step='any' class='spese' id='spesa[".$riga['id_utenti']."]' name='spesa[".$riga['id_utenti']."]' oninput='conti();'></td></tr>";
}
} else {
echo "ERRORE!";
}
$mysqli->close();
?>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="four columns">
<span id="controllo"></span>
</div>
</div>
<input type="submit" value="submit input">
</form>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>
<script src="js/nuova_spesa.js?1130"></script>
<script src="https://unpkg.com/html5-qrcode@2.0.11/dist/html5-qrcode.min.js"></script>
<script src="js/qrscan.js?1001"></script>
<script src="js/geo.js"></script>