Ver Mensaje Individual
  #20 (permalink)  
Antiguo 19/04/2013, 14:09
Avatar de pdominguez0608
pdominguez0608
 
Fecha de Ingreso: enero-2013
Ubicación: Alcobendas
Mensajes: 40
Antigüedad: 11 años, 3 meses
Puntos: 0
una auyuda, por favor

Muy buenas.
basándome en los ficheros que has puesto, he creado un documento de factura, este, llama datos de MySQL (5 juegos de registro), he puesto el
Código PHP:
<?php echo $strHTML ?>
y por pantalla sale bien.
he dejado solo el botón de PDF_7 (nombre aleatorio en directorio) y no he modificado el fichero "convertToPDF.php", bueno, he cambiado el directorio pdfs por facturas.
y al dar al botón para imprimir me da el error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
(que genérico....)

y no se por donde puede estar el error...

¿alguna idea?
gracias
aquí dejo el código:
emitir_factura.php

Código PHP:
AQUI LAS CONSULTAS DE MySQL

</head>

<body>

<div class='container'>
  <div class='contentFactura'>
      <div class='factura'>  
   <?php 
$strHTML 
'<table width="100%" border="0" cellspacing="0" cellpadding="10"><tr>';
$strHTML $strHTML.'<td width="39%"><img src="http://www.forosdelweb.com/f18/images/punto3.jpg" width="205" height="76" alt="Logo"></td>';
$strHTML $strHTML.'<td width="61%">&nbsp;</td></tr>';
$strHTML $strHTML.'<tr><td><strong>Fecha Factura: </strong>'.date("d-m-Y").' <br />
      <strong>Fecha de compra</strong>: '
.$row_DatosCompra['fchCompra'].'</td>';
$strHTML $strHTML.'<td><strong>Factura N&deg;: </strong>AA '.date("Y").'-'.$row_DatosCompra['idCompra'].'</td></tr>';

$strHTML $strHTML.'</table><br>';
$strHTML $strHTML.'<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr>';
$strHTML $strHTML.'<td width="15%" align="right"><strong>Nombre:</strong></td>';
$strHTML $strHTML.'<td width="36%">'.$row_DatosUsuario['strNombre'].' '.$row_DatosUsuario['strApellidos'].'</td>';
$strHTML $strHTML.'<td width="15%" rowspan="7">&nbsp;</td>';
$strHTML $strHTML.'<td width="34%"><h2>'.$row_DatosTienda['strRazonSocial'].'</h2></td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>D.N.I./C.I.F.:</strong></td>';
$strHTML $strHTML.'<td>'.$row_DatosUsuario['strDni'].'</td>';
$strHTML $strHTML.'<td>'.$row_DatosTienda['strCIF'].'</td></tr>';
$strHTML $strHTML.' <tr><td align="right"><strong>Direcci&oacute;n:</strong></td>';
$strHTML $strHTML.'<td>'.$row_DatosDireccion['strCalle'].', '.$row_DatosDireccion['strNumero'].' '.$row_DatosDireccion['strPiso'].' '.$row_DatosDireccion['strLetra'].'<br />'.$row_DatosDireccion['strExtension'].'</td>';
$strHTML $strHTML.' <td>'.$row_DatosTienda['strCalle'].', '.$row_DatosTienda['strNumero'].' '.$row_DatosTienda['strPiso'].' '.$row_DatosTienda['strLetra'].'<br />'.$row_DatosTienda['strExtension'].'</td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>Poblaci&oacute;n:</strong></td>';
$strHTML $strHTML.'<td>'.$row_DatosDireccion['strPoblacion'].'</td>';
$strHTML $strHTML.'<td>'.$row_DatosTienda['strPoblacion'].'</td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>C.P.:</strong></td>';
$strHTML $strHTML.'<td>'.$row_DatosDireccion['intCP'].'</td>';
$strHTML $strHTML.'<td>'.$row_DatosTienda['intCP'].'</td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>Provincia:</strong></td>';
$strHTML $strHTML.'<td>'.MostrarNombreProvincia($row_DatosDireccion['intProvincia']).'</td>';
$strHTML $strHTML.'<td>'.MostrarNombreProvincia($row_DatosTienda['intProvincia']).'</td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>Pais:</strong></td>';
$strHTML $strHTML.'<td>'.MostrarNombrePais($row_DatosDireccion['intPais']).'</td>';
$strHTML $strHTML.'<td>'.MostrarNombrePais($row_DatosTienda['intPais']).'</td></tr></table><br><br>';
$strHTML $strHTML.'<table border="0" cellspacing="0" cellpadding="3">';
$strHTML $strHTML.'<tr align="center">';
$strHTML $strHTML.'<td><strong>Marca</strong></td>';
$strHTML $strHTML.'<td><strong>Producto</strong></td>';
$strHTML $strHTML.'<td><strong>Color</strong></td>';
$strHTML $strHTML.'<td><strong>Talla</strong></td>';
$strHTML $strHTML.'<td><strong>Precio</strong></td>';
$strHTML $strHTML.'<td><strong>Cant.</strong></td>';
$strHTML $strHTML.'<td><strong>Dto.</strong></td>';
$strHTML $strHTML.'<td><strong>Total</strong></td>';
$strHTML $strHTML.' <td colspan="2"><strong>I.V.A.</strong></td>';
$strHTML $strHTML.'<td><strong>Total Linea</strong></td></tr>';
     do { 
   if (
$row_DatosLineas['idProducto']!=90000){
   
//*********** VARIABLES ************
//    *********************************************
                
$precioTicket=0;
                
                     
$descuentoEnLinea=($row_DatosLineas['intCantidad']*$row_DatosLineas['intPrecioUnitario']/100)*$row_DatosCompra['intDescuento'];
                     
$TotalLinea=$row_DatosLineas['intCantidad']*$row_DatosLineas['intPrecioUnitario']-$descuentoEnLinea
                     
$IVALinea=$TotalLinea*$row_DatosLineas['intIVA'];
                     
$IVA=$row_DatosLineas['intIVA']*100;
    
//*********** VARIABLES ************
//    *********************************************
$strHTML $strHTML.' <tr><td align="left">'.ObtenerNombreMarcadeProducto($row_DatosLineas['idProducto']).'</td>';
$strHTML $strHTML.'<td align="left">'.ObtenerNombreProducto($row_DatosLineas['idProducto']).'</td>';
$strHTML $strHTML.'<td align="center">'.ObtenerNombreTalla($row_DatosLineas['intColor']).'</td>';
$strHTML $strHTML.'<td align="center">'.ObtenerNombreTalla($row_DatosLineas['intTalla']).'</td>';
$strHTML $strHTML.'<td align="right">'.$row_DatosLineas['intPrecioUnitario'].'€</td>';
$strHTML $strHTML.'<td align="center">'.$row_DatosLineas['intCantidad'].'</td>';
$strHTML $strHTML.' <td align="center">'.$row_DatosCompra['intDescuento'].'%</td>';
$strHTML $strHTML.'<td align="right">'.round($TotalLinea,2).'€</td>';
$strHTML $strHTML.'<td >'.$IVA.'%</td>';
$strHTML $strHTML.'<td align="right">'.round($IVALinea,2).'€</td>';
$strHTML $strHTML.'<td align="right">'.round($TotalLinea+$IVALinea,2).'€</td></tr>';
       }
               else
              { 
              
//CONTROLAMOS EL TICKET DE DESCUENTO 
               
$precioTicket=$row_DatosLineas['dblTicket'];
      
      
$strHTML $strHTML.'<tr><td>&nbsp;</td>';
                
$strHTML $strHTML.'<td>Ticket Descuento</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td align="right">-'.$row_DatosLineas['dblTicket'].'€</td>';
      
        
//FIN DE CONTROLAMOS EL TICKET DE DESCUENTO
               
}
     } while (
$row_DatosLineas mysql_fetch_assoc($DatosLineas));

$strHTML $strHTML.'</table><br><br>';
$strHTML $strHTML.'<br /><br /><br />';
$strHTML $strHTML.'<table border="0" align="right" cellpadding="4" cellspacing="0"><tr>';
$strHTML $strHTML.'<td align="right"><strong>Sub-Total:</strong></td>';
$strHTML $strHTML.' <td align="right">'.$row_DatosCompra['dblSubTotal'].'€</td></tr>';
$strHTML $strHTML.' <tr><td align="right"><strong>Total I.V.A.:</strong></td>';
$strHTML $strHTML.'<td align="right">'.$row_DatosCompra['dblTotalIVA'].'€</td></tr>';
$strHTML $strHTML.'<tr><td align="right"><strong>Gastos de env&iacute;o:</strong></td>';
$strHTML $strHTML.' <td align="right">'.$row_DatosCompra['dblGastosEnvio'].'€</td></tr>';

  if (
$precioTicket>0) {
  
$strHTML $strHTML.'<tr><td align="right"><strong>Ticket Dto.:</strong></td>';
$strHTML $strHTML.'<td align="right">-'.$precioTicket.'€</td></tr>';
      }
  
$totalFactura=$row_DatosCompra['dblTotal']-$precioTicket;
$strHTML $strHTML.'<tr><td align="right"><strong>TOTAL:</strong></td>';
$strHTML $strHTML.'<td align="right">'.$totalFactura.'€</td></tr></table>';



if ( isset(
$_POST['PDF_7']) ) 
    
doPDF("",$strHTML,true,"style.css",true); //lo guardamos en la carpeta pdfs     
 
echo $strHTML ?>
 <!-- end .contentfactura --></div>
   <!-- end .content --></div>
  <div class='footer'>
    <p><div class="formulario">
<form  action='<?php echo $_SERVER['PHP_SELF'?>' method='POST'> 
<input name='PDF_7' type='submit' value='CREAR FACTURA' />

</form> </div></p>




  </div>
<!-- end .container --></div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result
($DatosTienda);

mysql_free_result($DatosUsuario);

mysql_free_result($DatosCompra);

mysql_free_result($DatosLineas);

mysql_free_result($DatosDireccion);
?>

Última edición por pdominguez0608; 19/04/2013 a las 14:16