/
gestionarOC.php
71 lines (69 loc) · 3.17 KB
/
gestionarOC.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
<?php
session_start();
include ("librerias.php");
?>
<!doctype html>
<html>
<head>
<meta charset="iso-8859-1">
<title><?= TITULOAPP; ?></title>
</head>
<body>
<?php include 'menu.php'; ?>
<div class="container">
<h1></h1>
<h2>Editar Orden de Compra</h2>
<form method="post" action="">
<p>Lista de orden de compra ingresados al sistema. Presione en la acción que desea realizar.</p>
<table class='table table-hover table-responsive table-bordered'>
<tr>
<td align="center">id</td>
<td>Fecha emisión</td>
<td>Total Orden de Compra</td>
<td>Estado</td>
<td>Usuario</td>
<td align="center">Acciones</td>
</tr>
<?php
$oOC = new Orden_compras();
$conteo = $oOC->leer();
while ($fila = $conteo->fetch(PDO::FETCH_ASSOC)) {
echo "<tr>";
echo "<td align='center'>$fila[id_oc]</td>";
echo "<td>$fila[fecha_emision]</td>";
echo "<td>$fila[total_oc]</td>";
echo "<td>$fila[estado]</td>";
echo "<td>$fila[id_usuario]</td>";
echo "<td width='1%' align='center' nowrap>";
echo "<a href='editarOC.php?id=$fila[id_oc]' class='btn btn-info left-margin' data-toggle='tooltip' data-placement='bottom' title='Editar Orden de Compra'> <span class='glyphicon glyphicon-pencil'> </span></a> ";
echo " <a elimina-id='$fila[id_oc]' prod-eliminar='$fila[fecha_emision]' class='btn btn-danger elimina-objecto' class='btn btn-info left-margin' data-toggle='tooltip' data-placement='bottom' title='Eliminar Orden de Compra'><span class='glyphicon glyphicon-trash'> </span></a>";
echo "</td>";
echo "</tr>";
}
?>
</table>
<input type="button" class="btn btn-default btn-primary" value="Volver" onclick="history.back(-1)" />
</form>
</div>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$(document).on('click', '.elimina-objecto', function () {
var id = $(this).attr('elimina-id');
var nombreEliminar = $(this).attr('prod-eliminar');
var q = confirm('Esta seguro, de eliminar a: ' + nombreEliminar +' ?');
if (q === true) {
$.post('eliminarOC.php', {
id_oc: id
}, function (data) {
location.reload();
}).fail(function () {
alert('No se ha podido eliminar.');
});
}
return false;
});
</script>
</body>
</html>