ClaveAudio_Web/admin/shoop/oferta.php

102 lines
3.3 KiB
PHP
Raw Normal View History

<?php
session_start();
if (!session_is_registered("clave_audio")) {
include("../login.php");
if (!$continuar) exit;
}
include('../db.php');
?>
<!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>Oferta</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
</head>
<body>
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="200"><a href="oferta_edit.php?op=add" class="button">[ a&ntilde;adir oferta ]</a></td>
<tr><td colspan="5"><img src="../_imgs/d.gif" width="200" height="5"></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<?php
$conn = db_connect();
if($conn) {
$query = "SELECT oferta_id, oferta_categoria, fab_nombre, oferta_nombre, oferta_estado, oferta_pvp, oferta_unidades, oferta_descripcion
FROM shoop_oferta
LEFT JOIN shoop_fabricantes on (oferta_fab_id=fab_id)
/* WHERE oferta_unidades > 0 */
ORDER BY oferta_categoria, oferta_id";
$result = mysql_query($query, $conn);
?>
<tr>
<td width="100" valign="top" class="hdr" align="left">Marca</td>
<td width="355" valign="top" class="hdr">Nombre</td>
<td width="40" valign="top" class="hdr" align="right">Uds.</td>
<td width="80" valign="top" class="hdr" align="right">PVP</td>
<td width="90" valign="top" class="hdr">&nbsp;</td>
</tr>
<?php
$secciones = array('', 'Altavoces', 'Electr&oacute;nicas', 'Reproductores de CD, convertidores D/A, etc.', 'Varios');
$curSeccion='';
while ($row = mysql_fetch_array($result))
{
$oferta_id = $row['oferta_id'];
$oferta_categoria = $row['oferta_categoria'];
$oferta_nombre = $row['oferta_nombre'];
$oferta_estado = $row['oferta_estado'];
$oferta_pvp = $row['oferta_pvp'];
$oferta_fab_nombre = $row['fab_nombre'];
$oferta_unidades = $row['oferta_unidades'];
$oferta_descripcion = $row['oferta_descripcion'];
if($oferta_categoria != $curSeccion){
$curSeccion = $oferta_categoria;
?>
<tr>
<td colspan="5" class="lbl"><?php echo $secciones[$oferta_categoria]; ?><img src="../_imgs/d.gif" width="15" height="20"></td>
</tr>
<?php
}
?>
<tr>
<td width="100" valign="top" align="left" class="data"><?php echo $oferta_fab_nombre; ?></td>
<td width="355" valign="top" class="data">&nbsp;&nbsp;<?php echo '<span class="lbl">' . $oferta_nombre . '</span>' . (strlen($oferta_estado) ? ' (' . $oferta_estado . ')': "") . (strlen($oferta_descripcion) ? '<br>&nbsp;&nbsp;<i>' . $oferta_descripcion . '</i>': "") ; ?></td>
<td width="40" valign="top" align="right" class="data"><?php echo $oferta_unidades; ?></td>
<td width="80" valign="top" align="right" class="data"><?php echo number_format($oferta_pvp, 2, ',', '.');; ?></td>
<td valign="top" class="data" align="center">&nbsp;<a href="oferta_edit.php?op=edit&id=<?php echo $oferta_id; ?>" class="button">[ editar ]</a></td>
</tr>
<tr>
<td bgcolor="#DBDEE6" colspan=7><img src="img/d.gif" width="5" height="1"></td>
</tr>
<?php
} // while
} else { // IF CONN
echo '<p>An error has occurred while accessing the database: ' . mysql_error();
}
?>
</table>
</body>
</html>