Ver Mensaje Individual
  #18 (permalink)  
Antiguo 07/11/2008, 15:34
Avatar de hoberwilly
hoberwilly
 
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Envio de mensaje js al no haber stock disponible

Bien, dejo el codigo completo:
<?php
session_start();
include('conec.php');
conectarse();
$id_boton_seleccionado=$_POST['radioboton'];
echo "recibo= ".$id_boton_seleccionado;
$qry=mysql_query("select * from factura left join usuario on factura.idUsername=usuario.username where idFactura='$id_boton_seleccionado'") or die("Error en consulta:" .mysql_error() );
if($row=mysql_fetch_array($qry))
{
$_SESSION['carritodesserializado']=unserialize($row['compra_serializada']);
$carro=$_SESSION['carritodesserializado'];
}
?>
<html>
<head>
<title>Extraccion de Pedidos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<a name="inicio"></a>
<h1 align="center">ORDEN DE PEDIDO Nº <?php echo $row['idFactura'] ?></h1>
<p>
<h3 align="center">Fecha y Hora de Pedido: <?php echo $row['fechaFactura'] ?></h3>
<p>
<table width="95%" border="0" align="center" cellpadding="4" cellspacing="0" class="prod">
<tr bordercolor="#FFFFFF" bgcolor="red" valign="middle" align="center" class="tit">
<td colspan=3 align="left">Datos del Destinatario</td>
</tr>
<tr>
<td width="30%">Categoría:</td>
<td width="70%" align="left"><?php echo $row['categoria'] ?></td>
</tr>
<tr>
<td width="30%">Establecimiento Farmacéutico:</td>
<td width="70%" align="left"><?php echo $row['establecimiento'] ?></td>
</tr>
</table>
<p>
<table>
<tr>
<td width="5%"></td>
<td width="8%">Cód.</td>
<td width="37%">Sustancia / Medicamento</td>
<td width="10%">Cant.<br>Solicitada</td>
<td width="10%">Cant.<br>Asignada</td>
<td width="10%">Stock<br>Existente</td>
<td width="5%"></td>
</tr>
<?php
$color=array("#ffffff","lightyellow");
$contador=0;
$suma=0;
foreach($carro as $k => $v){
$subto=$v['cantidad']*$v['precio'];
$suma=$suma+$subto;
$contador++;
?>
<form name="a<?php echo $v['identificador'] ?>" method="post" action="agregacarrito2.php?<?php echo SID ?>" id="a<?php echo $v['identificador'] ?>" onSubmit="return valida(this);">
<tr bgcolor="<?php echo $color[$contador%2]; ?>" class='prod'>
<td align="center"><a href="borracarrito2.php?<?php echo SID ?>&id=<?php echo $v['id'] ?>" >Eliminar</a></td>
<td align="center"><?php echo $v['id'] ?></td>
<td><?php echo $v['medicamento']." ".$v['presentacion']." ".$v['concentracion']." ".$v['formaFarmaceutica'] ?></td>
<td align="center"><?php echo $v['cantidad'] ?></td>
<td align="center"><input type="text" name="cantidad_autorizada" id="cantidad" value=" " size="4" maxlength='6' onKeypress="return acceptNumNumero(this)"></td>
<td align="right">
<?php
$qry2=mysql_query("select stock from catalogo where '".$v['id']."'");
if($row2=mysql_fetch_assoc($qry2)){
echo $row2['stock'];
}
?>
</td>
<td align="center"><input type="image" name="imageField" src="actualizar.gif" width="11" height="11" border="0" alt="Actualizar"></td>
</tr>
<?php }?>
</table>
<p>
<div align="right"><a href="#inicio"><img src="arriba.gif" width="20" height="20" border="0" alt="Arriba"></a></div>
<center>
<table border="0" cellpadding="15" class="prod">
<td><a href="listadoNoatendido.php"><img src="button_anterior.gif" border="0" alt="Anterior"></a></td>
<td><a href="autorizarNoatendido.php"><img src="button_guardar.GIF" border="0" alt="Autorizar"></a></td>
</table>
</body>
</html>

como te mencione como primer paso es obtener el stock disponible que esta en la bd???????