Advertisement
Guest User

cotizador PDF

a guest
Oct 23rd, 2017
1,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <?php
  2. /*-------------------------
  3. Autor: Obed Alvarado
  4. Web: obedalvarado.pw
  5. Mail: info@obedalvarado.pw
  6. ---------------------------*/
  7. ob_start();
  8. session_start();
  9. /* Connect To Database*/
  10. include("../../config/db.php");
  11. include("../../config/conexion.php");
  12. $session_id= session_id();
  13. $sql_count=mysqli_query($con,"select * from tmp_cotizacion where session_id='".$session_id."'");
  14. $count=mysqli_num_rows($sql_count);
  15. if ($count==0)
  16. {
  17. echo "<script>alert('No hay productos agregados a la cotizacion')</script>";
  18. echo "<script>window.close();</script>";
  19. exit;
  20. }
  21.  
  22. require_once(dirname(__FILE__).'/../html2pdf.class.php');
  23.  
  24. //Variables por GET
  25. $atencion=$_GET['atencion'];
  26. $tel1=$_GET['tel1'];
  27. $empresa=$_GET['empresa'];
  28. $tel2=$_GET['tel2'];
  29. $email=$_GET['email'];
  30. $condiciones=$_GET['condiciones'];
  31. $validez=$_GET['validez'];
  32. $entrega=$_GET['entrega'];
  33. //Fin de variables por GET
  34. $sql_cotizacion=mysqli_query($con, "select LAST_INSERT_ID(numero_cotizacion) as last from cotizaciones_demo order by id_cotizacion desc limit 0,1 ");
  35. $rwC=mysqli_fetch_array($sql_cotizacion);
  36. $numero_cotizacion=$rwC['last']+1;
  37. // get the HTML
  38.  
  39. include(dirname('__FILE__').'/res/cotizacion_html.php');
  40. $content = ob_get_clean();
  41.  
  42. try
  43. {
  44. // init HTML2PDF
  45. $html2pdf = new HTML2PDF('P', 'LETTER', 'es', true, 'UTF-8', array(0, 0, 0, 0));
  46. // display the full page
  47. $html2pdf->pdf->SetDisplayMode('fullpage');
  48. // convert
  49. $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
  50. // send the PDF
  51. ob_end_clean();
  52. $html2pdf->Output('Cotizacion.pdf');
  53. }
  54. catch(HTML2PDF_exception $e) {
  55. echo $e;
  56. exit;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement