-
Notifications
You must be signed in to change notification settings - Fork 0
/
historico_emprestimo.php
185 lines (154 loc) · 7.55 KB
/
historico_emprestimo.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
<!DOCTYPE html>
<html>
<title>Controle de Patrimonio ECO</title>
<?php include_once('include/header_tabela.php'); ?>
<?php include_once('include/login_auth.php'); ?>
<?php require 'include/conexaoBD.php'; ?>
<?php require 'include/controle_de_acesso_operador.php'; ?>
<!-- Necessario para inciar a api DataTables -->
<script>
$(document).ready(function () {
$('#example').DataTable({
responsive: true,
colReorder: true,
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.15/i18n/Portuguese-Brasil.json"
}
});
});
</script>
<body>
<?php
$sql_inicio = "SELECT emprestimo.*, usuario.nome as nome_usuario, GROUP_CONCAT(patrimonio.numero_serie SEPARATOR ', ') as numero_serie "
. "FROM `emprestimo` "
. " JOIN emprestimo_itens ON emprestimo.id_emprestimo = emprestimo_itens.id_emprestimo "
. " JOIN patrimonio ON emprestimo_itens.id_item = patrimonio.id "
. " JOIN usuario ON emprestimo.id_usuario = usuario.id "
. "GROUP BY emprestimo.id_emprestimo;";
$resultado = $conn->query($sql_inicio);
?>
<?php include_once('menu.php'); ?>
<div class="w3-overlay w3-hide-large w3-animate-opacity" onclick="w3_close()" style="cursor:pointer"></div>
<div class="w3-main" style="margin-left:250px;">
<div id="myTop" class="w3-top w3-container w3-padding-16 w3-indigo w3-large">
<i class="fa fa-bars w3-opennav w3-hide-large w3-xlarge w3-margin-left w3-margin-right" onclick="w3_open()"></i>
<span id="myIntro" class="w3-hide w3-indigo">Controle de Patrimônio ECO</span>
</div>
<header class="w3-container w3-indigo w3-padding-16" style="padding-left:32px">
<h1 class="w3-xxxlarge w3-padding-16">Controle de Patrimonio ECO</h1>
</header>
<div class="w3-container w3-padding-32" style="padding-left:32px">
<br>
<?php
if (@$_SESSION["cadastrado"] == 1) {
$_SESSION["cadastrado"] = 0;
?>
<?php }
?>
<br>
<!-- Dados -->
<div class="w3-container">
<table id="example" class="display nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Data do Empréstimo</th>
<th>Data da Devolução</th>
<th>Emprestado para</th>
<th>Itens</th>
<th>Pré Condições</th>
<th>Pós Condições</th>
<th>Siape</th>
<th>Telefone</th>
<th>E-mail</th>
<th>Operador do sistema</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Data do Empréstimo</th>
<th>Data da Devolução</th>
<th>Emprestado para</th>
<th>Itens</th>
<th>Pré Condições</th>
<th>Pós Condições</th>
<th>Siape</th>
<th>Telefone</th>
<th>E-mail</th>
<th>Operador do sistema</th>
</tr>
</tfoot>
<tbody>
<?php
if ($resultado->num_rows > 0) {
// output data of each row
while ($row = $resultado->fetch_assoc()) {
$nome_usuario = $row['nome_usuario'];
$ra = $row['ra'];
$nome = $row['nome'];
$telefone = $row['telefone'];
$email = $row['email'];
$data_emprestimo = DateTime::createFromFormat ( "Y-m-d H:i:s", $row["data_emprestimo"] )->format('d/m/Y H:i:s');
if(is_null($row["data_devolucao"])){
$data_devolucao = "Não Devolvido";
}else{
$data_devolucao = DateTime::createFromFormat ( "Y-m-d H:i:s", $row["data_devolucao"] )->format('d/m/Y H:i:s');
}
$pre_condicoes = $row['pre_condicoes'];
$pos_condicoes = $row['pos_condicoes'];
$itens = $row['numero_serie'];
echo "<tr>
<td>$data_emprestimo</td>
<td>$data_devolucao</td>
<td>$nome</td>
<td>$itens</td>
<td>$pre_condicoes</td>
<td>$pos_condicoes</td>
<td>$ra</td>
<td>$telefone</td>
<td>$email</td>
<td>$nome_usuario</td>
";
?>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<br><br>
<footer class="w3-container w3-indigo w3-padding-32" style="padding-left:32px">
<p>Copyright - Engenharia da Computação</p>
<p>Universidade Federal de Itajuba - campus Itabira</p>
</footer>
</div>
<script>
// Change style of top container on scroll
window.onscroll = function () {
myFunction()
};
function myFunction() {
if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {
document.getElementById("myTop").classList.add("w3-card-4");
document.getElementById("myIntro").classList.add("w3-show-inline-block");
} else {
document.getElementById("myIntro").classList.remove("w3-show-inline-block");
document.getElementById("myTop").classList.remove("w3-card-4");
}
}
// Accordions
function myAccordion(id) {
var x = document.getElementById(id);
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
x.previousElementSibling.className += " w3-theme";
} else {
x.className = x.className.replace("w3-show", "");
x.previousElementSibling.className =
x.previousElementSibling.className.replace(" w3-theme", "");
}
}
</script>
</body>
</html>