-
Notifications
You must be signed in to change notification settings - Fork 0
/
aplicar_coimas.php
190 lines (162 loc) · 6.14 KB
/
aplicar_coimas.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
<?php include 'header.php' ?>
<style>
.center {
text-align: center;
vertical-align: middle;
}
td, th {
padding: 5px;
}
tr {
height: 25px;
}
</style>
<?php
function aplica_coimas($ele1,$ele2,$ele3,$ele4){
$ligacao = ligar_base_dados();
$resultado = mysql_query("UPDATE faturas SET Coimas_ID_COIMA = $ele1 where n_fatura = $ele2 and `Utilizadores_NIF(EMISSOR)` = $ele3 and inserido_por = $ele4",$ligacao);
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
$val1 = htmlentities($_POST['fatura']);
$val2 = htmlentities($_POST['emissor']);
$val3 = htmlentities($_POST['inserido']);
$val4 = htmlentities($_POST['coimas']);
var_dump($_REQUEST);
require_once("./_includes/funcoes.php");
ligar_base_dados();
aplica_coimas($val4,$val1,$val2,$val3);
//document.location.reload(true);
}
?>
<body>
<?php
require_once("./_includes/funcoes.php");
ligar_base_dados();
function tipo_de_coimas(){
$ligacao = ligar_base_dados();
$resultado = mysql_query("select * from coimas",$ligacao);
return $resultado;
}
$resultado = lista_faturas_limite();
$divergencias = verifica_divergencias_coimas();
$divergencias2= verifica_divergencias_nao_inseridas();
?>
<legend> Faturas inseridas fora de prazo </legend>
<table style="empty-cells:hide;" border="1" class="table" cellpadding="1" cellspacing="1">
<tr>
<th>Fatura</th><th>Emissor</th><th>Receptor</th><th>Data de emissao</th><th>Data de Registo</th><th>Data Limite</th>
<th>Beneficio</th><th>Tipo de Fatura</th><th>Inserida Por</th><th>Total de Fatura</th><th>Coimas</th><th>Submeter</th></th>
</tr>
<?php
while($row = mysql_fetch_array($resultado, MYSQL_NUM)){
?>
<form id="faturas_fora_de_prazo" action ="aplicar_coimas.php" method = "post">
<tr><td><?php echo $row[0] ?></td><input name ="fatura" type="hidden" value="<?= $row[0] ?>"/>
<td><?php echo $row[1] ?></td><input name ="emissor" type="hidden" value="<?= $row[1] ?>"/>
<td><?php echo $row[2] ?></td><td><?php echo $row[3] ?></td><td><?php echo $row[4] ?></td>
<td><?php echo $row[5] ?></td><td><?php echo $row[6] ?></td><td><?php echo $row[7] ?></td>
<td><?php echo $row[8] ?></td><input name ="inserido" type="hidden" value="<?= $row[8] ?>"/>
<td><?php echo $row[9] ?></td>
<td>
<select id="coimas" class="form-control input-sm" name="coimas" ">
<option value="" disabled="disabled" selected="selected">Por favor selecione uma opccao</option>
<?php
$coimas= tipo_de_coimas();
while($row = mysql_fetch_array($coimas, MYSQL_NUM)){
?>
<option value= <?= $row[0] ?>>
<?php echo $row[1]?>
</option>
<?php
}
?>
</select>
</td>
<td>
<input type="submit">
</td>
</tr>
</form>
<?php
}
?>
</table>
<legend> Faturas com divergencias de Totais </legend>
<table style="empty-cells:hide;" border="1" class="table" cellpadding="1" cellspacing="1">
<tr>
<th>Fatura</th><th>Emissor</th><th>Receptor</th><th>Data de emissao</th><th>Data de Registo</th><th>Data Limite</th>
<th>Beneficio</th><th>Tipo de Fatura</th><th>Inserida Por</th><th>Total de Fatura</th><th>Coimas</th><th>Submeter</th></th>
</tr>
<?php
while($row = mysql_fetch_array($divergencias, MYSQL_NUM)){
?>
<form "faturas_divergencias_totais" action ="aplicar_coimas.php" method = "post">
<tr><td><?php echo $row[0] ?></td><td><?php echo $row[1] ?></td><td><?php echo $row[2] ?></td>
<td><?php echo $row[3] ?></td><td><?php echo $row[4] ?></td><td><?php echo $row[5] ?></td>
<td><?php echo $row[6] ?></td><td><?php echo $row[7] ?></td><td><?php echo $row[8] ?></td>
<td><?php echo $row[9] ?></td>
<td>
<select id="coimas" class="form-control input-sm" name="coimas" >
<option value="" disabled="disabled" selected="selected">Por favor selecione uma opccao</option>
<?php
$coimas2= tipo_de_coimas();
while($row = mysql_fetch_array($coimas2, MYSQL_NUM)){
?>
<option value= <?= $row[0] ?>>
<?php echo $row[1]?>
</option>
<?php
}
?>
</select>
</td>
<td>
<button onclick="myF()">Submit</button>
</td>
</tr>
</form>
<?php
}
?>
</table>
<legend> Faturas com divergencias de Faturas não inseridas </legend>
<table style="empty-cells:hide;" border="1" class="table" cellpadding="1" cellspacing="1">
<tr>
<th>Fatura</th><th>Emissor</th><th>Receptor</th><th>Data de emissao</th><th>Data de Registo</th><th>Data Limite</th>
<th>Beneficio</th><th>Tipo de Fatura</th><th>Inserida Por</th><th>Total de Fatura</th><th>Coimas</th><th>Submeter</th></th>
</tr>
<?php
while($row = mysql_fetch_array($divergencias2, MYSQL_NUM)){
?>
<form "faturas_divergencias_nao_inseridas" action ="aplicar_coimas.php" method = "post">
<tr><td><?php echo $row[0] ?></td><td><?php echo $row[1] ?></td><td><?php echo $row[2] ?></td>
<td><?php echo $row[3] ?></td><td><?php echo $row[4] ?></td><td><?php echo $row[5] ?></td>
<td><?php echo $row[6] ?></td><td><?php echo $row[7] ?></td><td><?php echo $row[8] ?></td>
<td><?php echo $row[9] ?></td>
<td>
<select id="coimas" class="form-control input-sm" name="coimas" >
<option value="" disabled="disabled" selected="selected">Por favor selecione uma opccao</option>
<?php
$coimas2= tipo_de_coimas();
while($row = mysql_fetch_array($coimas2, MYSQL_NUM)){
?>
<option value= <?= $row[0] ?>>
<?php echo $row[1]?>
</option>
<?php
}
?>
</select>
</td>
<td>
<button onclick="myF()">Submit</button>
</td>
</tr>
</form>
<?php
}
?>
</table>
</body>
</html>
<?php include 'footer.php' ?>