Ver Mensaje Individual
  #4 (permalink)  
Antiguo 31/07/2008, 01:48
Rafix
 
Fecha de Ingreso: enero-2007
Mensajes: 2
Antigüedad: 17 años, 4 meses
Puntos: 0
Respuesta: coexistiendo php en javascript...

Muchas gracias por el interés.. si, es action venkman, se me fue la pinza.
lanavi, el fichero es extenso, voy a reducirlo un poco:

Código PHP:
<?php 
include ("../conectar.php"); 
include (
"../funciones/fechas.php"); 

$sel_lineas="SELECT * FROM factulinea WHERE codfactura='$codfactura' ORDER BY numlinea ASC";
$rs_lineas=mysql_query($sel_lineas);
echo 
$sel_lineas " ::: " mysql_num_rows($rs_lineas);

$contador=0;
while (
$contador mysql_num_rows($rs_lineas)) {
    echo 
"entro la vez: " $contador."<br>"
    
$codfamilia=mysql_result($rs_lineas,$contador,"codfamilia");
    
$codigo=mysql_result($rs_lineas,$contador,"codigo");
    
$precio=mysql_result($rs_lineas,$contador,"precio");
    
$sel_tmp="INSERT INTO factulineatmp (codfactura,codfamilia,codigo,cantidad,precio,importe,dcto) VALUES ('$codfacturatmp','$codfamilia','$codigo','$cantidad','$precio','$importe','$dcto')";
    
$rs_tmp=mysql_query($sel_tmp);
    echo 
"<br>".$sel_tmp."<br>";
    
$contador++;
}
?> 

<html>
    <head>
        <title>Principal</title>
        <link href="estilos/estilos.css" type="text/css" rel="stylesheet">
        <link href="calendario/calendar-blue.css" rel="stylesheet" type="text/css">
        <script type="text/JavaScript" language="javascript" src="../calendario/calendar.js"></script>
        <script type="text/JavaScript" language="javascript" src="../calendario/lang/calendar-sp.js"></script>
        <script type="text/JavaScript" language="javascript" src="../calendario/calendar-setup.js"></script>
        <script language="javascript">
        function validarcliente(){
            var codigo=document.getElementById("codcliente").value;
            miPopup = window.open("comprobarcliente.php?codcliente="+codigo,"frame_datos","width=700,height=80,scrollbars=yes");
        }    
        
        function cancelar() {
            location.href="index.php";
        }

// Esta es la función que llamo para validar los campos: 


        function validar_cabecera()
            {
                var mensaje="";
                if (document.getElementById("nombre").value=="") mensaje+="  - Nombre\n";
                if (document.getElementById("fecha").value=="") mensaje+="  - Fecha\n";
                if (mensaje!="") {
                    alert("Atencion, se han detectado las siguientes incorrecciones:\n\n"+mensaje);
                } else {
                    <? //if ($Dtime=="no"){ exit; } ?>
                    document.getElementById("formulario").submit(); // y este el submit....
                }
            }    
        }    
        </script>
    </head>
    <body onLoad="inicio()">
        <div id="pagina">
            <div id="zonaContenido">
                <div align="center">
                <div id="tituloForm" class="header">INSERTAR FACTURA</div>
                <div id="frmBusqueda">
                <? echo "<br>".$Dtime."<br>"?>
                <form id="formulario" name="formulario" method="post" action="guardar_factura.php">
                    <table class="fuente8" width="98%" cellspacing=0 cellpadding=3 border=0>
                        <tr>
                            <td width="15%">C&oacute;digo Cliente </td>
                          <td colspan="3"><input NAME="codcliente" type="text" class="cajaPequena" id="codcliente" size="6" maxlength="5" onClick="limpiarcaja()" value="<? echo $codcliente?>">
                            <img src="../img/ver.png" width="16" height="16" onClick="abreVentana()" title="Buscar cliente" onMouseOver="style.cursor=cursor"> <img src="../img/cliente.png" width="16" height="16" onClick="validarcliente()" title="Validar cliente" onMouseOver="style.cursor=cursor"></td>                    
                        </tr>
                        <tr>
                            <td width="6%">Nombre</td>
                            <td width="27%"><input NAME="nombre" type="text" class="cajaGrande" id="nombre" size="45" maxlength="45" value="<? echo $nombre?>" readonly><input id="segundavez" name="segundavez" value="si" type="hidden">
                            <input id="mivariable" name="mivariable" value="<? echo $mivariablep?>" type="hidden"></td>
                            <td width="3%">NIF</td>
                            <td width="64%"><input NAME="nif" type="text" class="cajaMedia" id="nif" size="20" maxlength="15" value="<? echo $nif?>" readonly></td>
                        </tr>
                        <? $hoy=date("d/m/Y"); ?>
                        <tr>
                            <td width="6%">Fecha</td>
                            <td width="27%"><input NAME="fecha" type="text" class="cajaPequena" id="fecha" size="10" maxlength="10" value="<? echo implota($fecha)?>" readonly> <img src="../img/calendario.png" name="Image1" id="Image1" width="16" height="16" border="0" id="Image1" onMouseOver="this.style.cursor='pointer'">
        <script type="text/javascript">
                    Calendar.setup(
                      {
                    inputField : "fecha",
                    ifFormat   : "%d/%m/%Y",
                    button     : "Image1"
                      }
                    );
        </script></td>
                            <td width="3%">IVA</td>
                            <td width="64%"><input NAME="iva" type="text" class="cajaPequena" id="iva" size="5" maxlength="5" value="16" onChange="cambio_iva()" value="<? echo $iva?>"> %</td>
                        </tr>
                        <tr>
                          <td>C&oacute;digo de factura</td>
                          <td colspan="2"><?php echo $codfactura?></td>
                      </tr>
                    </table>                                        
              </div>
              <input id="codfacturatmp" name="codfacturatmp" value="<? echo $codfacturatmp?>" type="hidden">
              <input id="codfactura" name="codfactura" value="<? echo $codfactura?>" type="hidden">
              <input id="baseimpuestos2" name="baseimpuestos" value="<? echo $baseimpuestos?>" type="hidden">
              <input id="baseimponible2" name="baseimponible" value="<? echo $baseimponible?>" type="hidden">
              <input id="preciototal2" name="preciototal" value="<? echo $preciototal?>" type="hidden">
              <input id="accion" name="accion" value="modificar" type="hidden">              
              </form>
              <br>
              <div id="frmBusqueda">
                <form id="formulario_lineas" name="formulario_lineas" method="post" action="frame_lineas.php" target="frame_lineas">
                <table class="fuente8" width="98%" cellspacing=0 cellpadding=3 border=0>
                  <tr>
                    <td width="11%">Referencia</td>
                    <td colspan="10"><input NAME="referencia" type="text" class="cajaMedia" id="referencia" size="15" maxlength="15" readonly> <img src="../img/ver.png" width="16" height="16" onClick="ventanaArticulos()" onMouseOver="style.cursor=cursor" title="Buscar articulos"></td>
                  </tr>
                  <tr>
                    <td>Descripcion</td>
                    <td width="19%"><input NAME="descripcion" type="text" class="cajaMedia" id="descripcion" size="30" maxlength="30" readonly></td>
                    <td width="5%">Precio</td>
                    <td width="11%"><input NAME="precio" type="text" class="cajaPequena2" id="precio" size="10" maxlength="10" onChange="actualizar_importe()"> €</td>
                    <td width="5%">Cantidad</td>
                    <td width="5%"><input NAME="cantidad" type="text" class="cajaMinima" id="cantidad" size="10" maxlength="10" value="1" onChange="actualizar_importe()"></td>
                    <td width="4%">Dcto.</td>
                    <td width="9%"><input NAME="descuento" type="text" class="cajaMinima" id="descuento" size="10" maxlength="10" onChange="actualizar_importe()"> %</td>
                    <td width="5%">Importe</td>
                    <td width="11%"><input NAME="importe" type="text" class="cajaPequena2" id="importe" size="10" maxlength="10" readonly> €</td>
                    <td width="15%"><img src="../img/botonagregar.jpg" width="72" height="22" border="1" onClick="validar()" onMouseOver="style.cursor=cursor" title="Agregar articulo"></td>
                  </tr>
                </table>
                </div>
                <input name="codarticulo" value="<? echo $codarticulo?>" type="hidden" id="codarticulo">
                <br>
                <div id="frmBusqueda">
                <table class="fuente8" width="98%" cellspacing=0 cellpadding=3 border=0 ID="Table1">
                        <tr class="cabeceraTabla">
                            <td width="5%">ITEM</td>
                            <td width="18%">REFERENCIA</td>
                            <td width="41%">DESCRIPCION</td>
                            <td width="8%">CANTIDAD</td>
                            <td width="8%">PRECIO</td>
                            <td width="7%">DCTO %</td>
                            <td width="8%">IMPORTE</td>
                            <td width="3%">&nbsp;</td>
                        </tr>
                </table>
                <div id="lineaResultado">
                    <iframe width="100%" height="250" id="frame_lineas" name="frame_lineas" frameborder="0">
                        <ilayer width="100%" height="250" id="frame_lineas" name="frame_lineas"></ilayer>
                    </iframe>
                </div>                    
              </div>
              <div id="frmBusqueda">
            <table width="25%" border=0 align="right" cellpadding=3 cellspacing=0 class="fuente8">
              <tr>
                <td width="27%" class="busqueda">Sub-total</td>
                <td width="73%" align="right"><div align="center">
                  <input class="cajaTotales" name="baseimponible" type="text" id="baseimponible" size="12" align="right" value="<? echo number_format($baseimponible,2)?>" readonly> 
                €</div></td>
              </tr>
              <tr>
                <td class="busqueda">IVA</td>
                <td align="right"><div align="center">
                  <input class="cajaTotales" name="baseimpuestos" type="text" id="baseimpuestos" size="12" align="right" value="<? echo number_format($baseimpuestos,2)?>" readonly> 
                €</div></td>
              </tr>
              <tr>
                <td class="busqueda">Precio Total</td>
                <td align="right"><div align="center">
                  <input class="cajaTotales" name="preciototal" type="text" id="preciototal" size="12" align="right" value="<? echo number_format($preciototal,2)?>" readonly> 
                €</div></td>
              </tr>
        </table>
              </div>
                <div id="botonBusqueda">                    
                  <div align="center">
                    <img src="../img/botonaceptar.jpg" width="85" height="22" onClick="validar_cabecera()" border="1" onMouseOver="style.cursor=cursor">
                    <img src="../img/botoncancelar.jpg" width="85" height="22" onClick="cancelar()" border="1" onMouseOver="style.cursor=cursor">
                    <input id="codfamilia" name="codfamilia" value="<? echo $codfamilia?>" type="hidden">
                    <input id="codfacturatmp" name="codfacturatmp" value="<? echo $codfacturatmp?>" type="hidden">
                    <input id="modif" name="modif" value="0" type="hidden">                    
                  </div>
                </div>
                      <iframe id="frame_datos" name="frame_datos" width="0" height="0" frameborder="0">
                    <ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
                    </iframe>
              </form>
             </div>
          </div>
        </div>
    </body>
</html>
muchas gracias