
11/03/2009, 10:47
|
 | | | Fecha de Ingreso: noviembre-2005 Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 19 años, 4 meses Puntos: 1 | |
Respuesta: tengo problemas para grabar me envia un solo reguistro este es el que carga los datos anterior mente selecionados Código PHP: <?php
session_start();
include("../funciones/funcionesbox.php");
function cambiaf_a_mysql ($fecha){
ereg( "([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})", $fecha, $mifecha);
$lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1];
return $lafecha;
}
?>
<script language='javascript' src="../Funciones/popcalendar.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SIAP Guías Despacho</title>
<link href="../css/siap.css" rel="stylesheet" type="text/css" />
<script>
function objetoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}//Funcion Desarrollada por Jesus Liñán [email protected] ribosomatic.com
//************************************************para la insercion de registros*************************************************
function enviarDatos(idProd, destino)
{
//donde se mostrará lo resultados
var divResultado = document.getElementById('AgregaProductos');
//divResultado.innerHTML="<center>Cargando ...</center>";
//valores de los inputs
var cadenaFormulario = 'id='+encodeURI(idProd);
alert(cadenaFormulario);
//instanciamos el objetoAjax
ajax=objetoAjax();
//uso del medotod POST
//archivo que realizará la operacion
//registro.php
ajax.open("POST", destino, true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
//mostrar resultados en esta capa
Contenido=divResultado.innerHTML;
alert(Contenido);
divResultado.innerHTML = Contenido+ajax.responseText;
}
/*else
{
divResultado.innerHTML="<center>Cargando ... </center>";
}*/
}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//enviando los valores
ajax.send(cadenaFormulario);
}
function eliminaProducto(num)
{
var id='div_'+num;
prod = document.getElementById(id);
if (!prod){
alert("El elemento selecionado no existe");
} else {
padre = prod.parentNode;
padre.removeChild(prod);
}
}
</script>
<style media="screen">
/* Nube de enlaces-------*/
#tagcloud{
text-align:center;
margin:5px;
border: none;
}
#tagcloud .tag1{ font-size:0.9em; color:#da080c;margin:5px;}
#tagcloud .tag2{ font-size:1.2em; color:#7c9fbd;margin:5px;}
#tagcloud .tag3{ font-size:1.4em; color:#a6c4e1;margin:5px;}
#tagcloud .tag4{ font-size:1.3em; color:#0fd580;margin:5px;}
#tagcloud a{ text-decoration:none; margin:5px;}
#tagcloud a:hover{ text-decoration:underline; margin:5px; cursor:pointer;}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.Estilo5 {
color: #000000;
font-weight: bold;
}
.Estilo7 {color: #000000; font-weight: bold; font-size: 3ç; }
</style>
</head>
<body>
<?php
//include ("../jao/conexion.php");
$enlace = mysql_connect("localhost", "root", "") or die("No pudo conectarse : " . mysql_error());
mysql_select_db("name") or die("No pudo seleccionarse la BD.");
$cliente=$_POST['tblclientes'];
$fechaFormat=$_POST['FechaInicio'];
$fecha=cambiaf_a_mysql($fechaFormat);
$operario=$_POST['tblempleados'];
$Turno=$_POST['tbltipoturno'];
$Numero=$_POST['Numero'];
$insert="insert into tbl_op (Fecha, id_Cliente, Id_Empleado, id_TipoTurno) values ('".$fecha."',".$cliente.",".$operario.",".$Turno.")";
$resIns=mysql_query($insert);
$idop=mysql_insert_id();
/*echo"<script>alert(\"$cliente\")</script>";*/
$sql = "SELECT * FROM tblproducto WHERE id_cliente='".$cliente."'";
/*echo"<script>alert(\"$sql\")</script>";*/
$resSql=mysql_query($sql);
$numProductos=mysql_num_rows($resSql);
//para el cliente
$sqlC = "SELECT * FROM tblempleados WHERE Id_Empleado='".$operario."'";
/*echo"<script>alert(\"$sqlC\")</script>";*/
$resSqlC=mysql_query($sqlC);
$rowClient=mysql_fetch_array($resSqlC);
//para el N de Guiass
$sqlA = "SELECT * FROM tbl_op WHERE id_op='".$idop."'";
/*echo"<script>alert(\"$sqlA\")</script>";*/
$resSqlA=mysql_query($sqlA);
$rowGuias=mysql_fetch_array($resSqlA);
//para el cliente
$sqlo = "SELECT * FROM tblclientes WHERE id_Cliente='".$cliente."'";
/*echo"<script>alert(\"$sqlC\")</script>";*/
$resSqlo=mysql_query($sqlo);
$rowCliente=mysql_fetch_array($resSqlo);
?>
<div>
<table width="905" border="0" cellpadding="0" cellspacing="0" bordercolor="0" class="inputcontacto">
<!--DWLayoutTable-->
<tr>
<td width="5" height="27"></td>
<td width="5"></td>
<td width="7"> </td>
<td width="229"> </td>
<td width="192"> </td>
<td width="62"> </td>
<td width="98"></td>
<td width="156"></td>
<td width="149"></td>
</tr>
<tr>
<td height="37"></td>
<td></td>
<td colspan="6" valign="top" background="../iconos/bg_footer.jpg"><img src="../iconos/images/card_f2.png" width="32" height="32"><span class="Estilo7"> Trabajador </span></td>
<td></td>
</tr>
<tr>
<td height="12"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="18"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td rowspan="5" valign="top" class="menu_noti"> <div align="center"><a href=""><img src="../iconos/index_foto.jpg" width="66" height="91" border="0" /></a></div></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td></td>
<td></td>
<td valign="baseline" class="menu_noti"><div align="left">Rut ...: <?php echo $rowClient['Rut'];?></div></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td></td>
<td></td>
<td colspan="2" valign="baseline" class="menu_noti"><div align="left">Señor. :<?php echo $rowClient['Nombre'];?></div></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22"></td>
<td></td>
<td></td>
<td colspan="2" valign="baseline" class="menu_noti"><div align="left">Nª OP.: <?php echo $rowGuias['id_op']; ?></div></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="7"></td>
<td></td>
<td></td>
<td colspan="2" rowspan="2" valign="baseline" class="subrayado"><div align="left">Fecha. :<span class="estilo2"><?php echo $rowGuias['Fecha']; ?></span></div></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="15"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="33"></td>
<td></td>
<td></td>
<td> </td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="37"></td>
<td></td>
<td colspan="6" valign="top" background="../iconos/bg_footer.jpg"><img src="../iconos/images/move_f2.png" width="32" height="32"><span class="Estilo5"> Productos de :</span> <?php echo $rowCliente['Nombre'];?></td>
<td></td>
</tr>
<tr>
<td height="22"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="30"> </td>
<td colspan="7" valign="top"><div class="inputcontacto" id="tagcloud">
<?php
$NumClase=1;
for($i=0; $i<$numProductos; $i++)
{
$myrow=mysql_fetch_array($resSql);
echo "<a onClick=\"javascript: enviarDatos('".$myrow['id_Producto']."', 'agregaProducto.php');\" class=\"tag".$NumClase."\">".$myrow['Nombre']."</a>";
$NumClase++;
if($NumClase==4){$NumClase=1;}
}
?>
</div>
<form id="form1" name="form1" method="post" action="insertaProductos.php">
<div style="width:80%; border:solid 1px #003366;">
<div style="width:40%; text-align:left; float:left;">Producto</div>
<div style="width:35%; text-align:left; float:left;">Categorías</div>
<div style="width:15%; text-align:left; float:left;">Unidades</div>
<div style="width:10%; text-align:left; float:left;">Acción</div>
</div>
<div style="clear:both"></div>
<div id="AgregaProductos" style="width:80%;">
</div>
<input type="hidden" name="id_op" value="<?php echo $idop;?>">
<div style="clear:both"></div>
<div><a href="ingr_guias.php" title="Regresar a clientes"> << Regresar</a></div>
<input type="submit" name="Enviar" value="Enviar">
</form></td>
<td></td>
</tr>
<tr>
<td height="187"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<h3> </h3>
</body>
</html> |