Guest User

Untitled

a guest
Jan 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. $.ajax({
  2. url: 'vistas/modulos/secundaria.php',
  3. method: 'POST',
  4. data: parametros,
  5. dataType: 'json',
  6. cache: false,
  7. contentType: false,
  8. processData: false,
  9. success: function(registros){
  10.  
  11. var opcion;
  12. var entrega;
  13. var costo;
  14. var auxiliar = 0;
  15.  
  16. $.each(registros, function(i, registro){
  17.  
  18. if (typeof (registro.primer_aviso) != "undefined") {
  19. opcion = registro.primer_aviso;
  20. entrega = registro.entrega_primer;
  21. costo = registro.costo_primer;
  22. }
  23. else{
  24. opcion = registro.testimonio;
  25. entrega = registro.entrega_testimonio;
  26. costo = registro.costo_testimonio;
  27. }
  28.  
  29. auxiliar = parseInt(auxiliar) + parseInt(costo);
  30.  
  31. $('#consultaSecundaria').append(
  32. '<tr>'+
  33. '<td>'+registro.municipio+'</td>'+
  34. '<td>'+registro.escritura+'</td>'+
  35. '<td>'+registro.enajenante+'</td>'+
  36. '<td>'+registro.adquiriente+'</td>'+
  37. '<td>'+opcion+'</td>'+
  38. '<td>'+entrega+'</td>'+
  39. '<td>'+costo+'</td>'+
  40. '</tr>'
  41. );
  42. });
  43.  
  44. }
  45. });
  46.  
  47. $('#pdf').on('click', function() {
  48.  
  49. var auxiliar = $('#consultaSecundaria').html();
  50. var contenido = "<table border='1'>"+auxiliar+"</table>";
  51. //contenidoPdf(contenido);
  52. window.open ("vistas/modulos/pdf.php?contenido="+contenido, '_blank');
  53.  
  54. });
  55.  
  56. <?php
  57.  
  58. require '../../vendor/autoload.php';
  59. use SpipuHtml2PdfHtml2Pdf;
  60.  
  61. $imprimir = $_GET['contenido'];
  62.  
  63. $objeto = new Html2Pdf();
  64. $objeto -> writeHTML($imprimir);
  65. $objeto -> output('archivo.pdf');
  66.  
  67. ?>
Add Comment
Please, Sign In to add comment