ClaveAudio_Web/admin/shoop/pedidos.php

194 lines
5.9 KiB
PHP
Raw Normal View History

<?php
/////////////////////////////////////////////////////////////////////////////////////////
//
// this file has been generated by sformi, the clever tool for lazy developers.
//
// template v2 - 04062005
//
// 111005 - v1
//
ini_set ('error_reporting', E_ALL);
ini_set ('display_errors', '1');
session_start();
if (!session_is_registered("clave_audio")) {
include("../login.php");
if (!$continuar) exit;
}
require_once('../../_config.php');
require_once('../../_incl/datosClass.php');
require_once('../../_incl/code.php');
// session handling
/*
if($SESSION_CHECK) {
require_once('../../_incl/usersClass.php');
$usuario = new usersClass('../_config.php');
if($usuario) {
if(!$usuario->sessionRegistered()){
Header('Location:' . $SESSION_LOGIN_PAGE);
exit;
}
}
}
*/
if(isset($_REQUEST['op'])) {
$operacion = $_REQUEST['op'];
} else {
$operacion = "list";
}
// this code is for the "paginator"
$gStartRec = (isset($_REQUEST['start']) ? $_REQUEST['start'] : 0);
$gLimit = 25;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>pedidos</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
<link href="../../_incl/sortabletable.css" rel="stylesheet" type="text/css" >
<script src="../../_incl/sortabletable.js"></script>
</head>
<body>
<!-- CONTENT -->
<?php
$db = new datosClass($DATA_USER, $DATA_PWD, $DATA_DATABASE, $DATA_HOST);
if($db) {
// calculate the total of records for the query
if($db->query("SELECT COUNT(pedido_id) AS numOfRecords FROM shoop_pedidos", true)) {
if($row = $db->getNext()) {
$numOfRecords = $row['numOfRecords'];
}
}
if($db->query("SELECT pedido_id, pedido_cod_pedido, pedido_fecha, cliente_nombre, pedido_forma_pago, pedido_estado, pedido_total FROM shoop_pedidos, shoop_clientes WHERE cliente_id = pedido_cliente ORDER BY pedido_id DESC LIMIT " . $gStartRec . ", " . $gLimit)) {
?>
<!-- numHits et paginator -->
<div id="paginator_top">
<?php echo $numOfRecords; ?> pedidos.
<span class="paginator">
<?php
// do we need to paginate the result?
if($numOfRecords > $gLimit) {
echo drawPaginator($numOfRecords, $gStartRec, $gLimit, 'pag_button');
}
?>
</span>
</div>
<!-- end of numHits -->
<!-- main table -->
<table border="0" cellspacing="0" cellpadding="0" class="sort-table" id="contenido">
<thead><tr>
<td width="72">C&oacute;digo</td><td width="72">Fecha</td><td width="200">Cliente</td><td width="100">Forma Pago</td><td width="72">Estado</td><td width="72">Total</td>
</tr></thead>
<tbody>
<?php
$fondo = 'impar';
while($row = $db->getNext())
{
$pedido_id = $row['pedido_id'];
$pedido_cod_pedido = $row['pedido_cod_pedido'];
$pedido_fecha = $row['pedido_fecha'];
$pedido_cliente = $row['cliente_nombre'];
$pedido_forma_pago = $row['pedido_forma_pago'];
$pedido_estado = $row['pedido_estado'];
$pedido_total = $row['pedido_total'];
?>
<tr class="<?php echo $fondo; ?>">
<td width="72" valign="top" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_cod_pedido; ?></a></td><td width="72" valign="top" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_fecha; ?></a></td><td width="200" valign="top" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_cliente; ?></a></td><td width="72" valign="top" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_forma_pago; ?></a></td><td width="72" valign="top" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_estado; ?></a></td><td width="72" valign="top" align="right" class="data"><a href="pedidos_show.php?id=<?php echo $pedido_id; ?>" class="button"><?php echo $pedido_total; ?></a></td>
</tr>
<?php
$fondo = ($fondo == 'impar' ? 'par' : 'impar');
} // while
?>
</tbody>
</table>
<!-- end of main table -->
<?php
} // if db->query
} else { // if $db
echo '<p>An error has occurred while accessing the database: ' . mysql_error();
}
?>
<?php
if($operacion == "edit"){
?>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td></td></tr>
<tr><td><img src="img/d.gif" width="200" height="5"></td></tr>
</table>
<?php
}
?>
<!-- END OF CONTENT -->
<script type="text/javascript">
var st = new SortableTable(document.getElementById("contenido"),
["CaseInsensitiveString", "Date", "CaseInsensitiveString", "CaseInsensitiveString", "CaseInsensitiveString", "Number"]);
// restore the class names
st.onsort = function () {
var rows = st.tBody.rows;
for (var i = 0; i < rows.length; i++) {
// this code doesn't respect additional styles on the row.
rows[i].className = i % 2 ? "impar" : "par";
}
};
<?php
/*
// if you plan to apply additional styles to the rows you should use this js to keep them when the order is changed
function addClassName(el, sClassName) {
var s = el.className;
var p = s.split(" ");
var l = p.length;
for (var i = 0; i < l; i++) {
if (p[i] == sClassName)
return;
}
p[p.length] = sClassName;
el.className = p.join(" ");
}
function removeClassName(el, sClassName) {
var s = el.className;
var p = s.split(" ");
var np = [];
var l = p.length;
var j = 0;
for (var i = 0; i < l; i++) {
if (p[i] != sClassName)
np[j++] = p[i];
}
el.className = np.join(" ");
}
// restore the class names
st.onsort = function () {
var rows = st.tBody.rows;
for (var i = 0; i < rows.length; i++) {
removeClassName(rows[i], i % 2 ? "impar" : "par");
addClassName(rows[i], i % 2 ? "par" : "impar");
}
};
*/
?>
</script>
</body>
</html>