[go: up one dir, main page]

Menu

[r33]: / admin / proveedores.php  Maximize  Restore  History

Download this file

135 lines (123 with data), 4.7 kB

  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
<?php
/*
* ABC ERP - Sistema ERP para PYMEs
* Copyright (C) 2011 Santiago Faci <santi@arkabytes.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
?>
<script type="text/javascript">
$(document).ready(function() {
$("table tr:nth-child(odd)").addClass("alt");
});
// Llamada a script para eliminar un proveedor
$(document).ready(function() {
$('a.eliminar').click(function(e) {
if (confirm('Vas a eliminar el proveedor. ¿Estás seguro?')) {
e.preventDefault();
var parent = $(this).parent().parent();
$.ajax({
type: 'get',
url: 'run/_eliminar_proveedor.php',
data: 'ajax=1&eliminar=' + parent.attr('id').replace('registro-', ''),
beforeSend: function() {
parent.animate({'backgroundColor':'#fb6c6c'}, 300);
$("#resultado").html("Eliminando Proveedor . . .");
},
success: function(responseText) {
parent.slideUp(600, function() {
parent.remove();
});
$("#resultado").html(responseText);
setTimeout(function() {
$("#resultado").html("");
}, 2000);
}
});
}
// Si responde que no, se cancela el evento por defecto (el click del enlace)
e.preventDefault();
});
});
</script>
<!-- Popup para enviar email -->
<script type="text/javascript">
$(function() {
$("a.enviar_email").button();
$("a.enviar_email").click(function() {
$("#para").val(jQuery(this).attr("id"));
$("#dialogo_email").dialog("open");
});
});
</script>
<?php
include("../include/arkabytes/dialogo_email.php");
require_once("../config/abc-config.php");
require_once("../include/arkabytes/bbdd.php");
$tamano = 10;
$bbdd = new BBDD();
if (!isset($_REQUEST["inicio"]))
$inicio = 0;
else
$inicio = $_REQUEST["inicio"];
$busqueda_rapida = $_REQUEST["busqueda_rapida"];
$fila = $bbdd->ejecuta_escalar("SELECT COUNT(*) numero FROM proveedores WHERE nombre LIKE '%" . $busqueda_rapida . "%'");
$numero = $fila["numero"];
$paginas = ceil($numero / $tamano);
include("include/paginacion.php");
?>
<div id="listado">
<table class="cebra">
<thead class="cabecera">
<tr class="cabecera">
<td>#</td>
<td>Nombre</td>
<td>Teléfono</td>
<td>E-Mail</td>
<td>Web</td>
<td></td>
<td></td>
</tr>
</thead>
<tbody class="scroll">
<?php
$resultado = $bbdd->ejecuta_consulta("SELECT id, nombre, telefono, email, web FROM proveedores " .
"WHERE nombre LIKE '%" . $busqueda_rapida . "%' ORDER BY nombre");
if ($resultado->num_rows == 0) {
echo "<td colspan='7' style='text-align:center'><span class='titulocelda'>## Sin Datos ##</span></td>\n";
}
else {
while ($fila = $resultado->fetch_array()) {
echo "<tr id='registro-" . $fila["id"] . "'>\n";
echo "<td>" . $fila["id"] . "</td>\n";
echo "<td><a class='popup' title='Más Información' href='ver_proveedor.php?id=" . $fila["id"] .
"'>" . $fila["nombre"] . "</a></td>\n";
echo "<td>" . $fila["telefono"] . "</td>\n";
echo "<td><a class='enviar_email' id='" . $fila["email"] . "' title='Enviar un email' href='#'>" . $fila["email"] . "</td>\n";
echo "<td><a title='Ir a' href='" . $fila["web"] . "' target='_blank'>" . $fila["web"] . "</a></td>\n";
echo "<td><a href='?id=nuevo_proveedor&modificar=" . $fila["id"] . "' title='Modificar Proveedor'><img src='icons/editar16.png' alt='Modificar Proveedor'/></a></td>\n";
echo "<td><a class='eliminar' href='#' title='Eliminar Proveedor'><img src='icons/cerrar16.png' alt='Eliminar Proveedor'/></a></td>\n";
echo "</tr>\n";
}
$resultado->close();
}
?>
</tbody>
</table>
</div>
<?php
include("include/paginacion.php");
?>
<div id="resultado"></div>