The call to the printTable function does not work on the a tag, I add it through onclick (); am I coding wrong?, what would my mistake be. Could you please help me to identify where I am failing
<a title='Imprimir' data-toggle="tooltip" class='waves-effect waves-light' id="boton"><i class='fa fa-print'></i></a>
Here you should open a pdf
<script>
$(document).ready(function() {
$("#boton").click(function() {
var cliente= $('#NombreCliente').text();
var capitalp=$(this).parents("tr").find("td")[5].innerHTML;
var abono=$(this).parents("tr").find("td")[4].innerHTML;
var totalPago = $(this).parents("tr").find("td")[1].innerHTML;
var iva = $(this).parents("tr").find("td")[2].innerHTML;
var interes = $(this).parents("tr").find("td")[3].innerHTML;
var HTML ="<div style='position: relative; '><img src='<?= base_url() ?>plantilla/images/logo' style='position: absolute; background-size: 100% 100%; filter:alpha(opacity=25); filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.5); opacity:.25; left:100px; top: -10px;'></div>";
HTML+="<img src='<?= base_url()?>plantilla/images/logo.png' width='100'><div class='row text-center'><h1>PRESTAMAS DINERO AL INSTANTE S.A.</h1> </p><p>Comprobante de pago</p></div>";
HTML+= '<table class="table table-bordered">';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Cliente</strong> </td>';
HTML+= ' <td>'+cliente+'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Por</strong> </td>';
HTML+= '<td>'+totalPago+'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Abono capital</strong> </td>';
HTML+= '<td> '+abono+'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Intereses</strong> </td>';
HTML+= '<td>'+interes +'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Iva</strong> </td>';
HTML+= '<td>'+iva +'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td><strong>Capital pendiente</strong> </td>';
HTML+= '<td>'+capitalp +'</td>';
HTML+= '</tr>';
HTML+= '<tr class="tr tr1">';
HTML+= '<td colspan="2" style="font-size:12px;" align="center"><strong>CON SU ESFUERZO Y NUESTRO APOYO PROSPERARÁ SU NEGOCIO</strong> </td>';
HTML+= '</tr>';
HTML+= '</table>';
var pantalla=window.open(' ','popimpr');
pantalla.document.write('<link href="<?= base_url() ?>plantilla/css/bootstrap.min.css" rel="stylesheet" />');
pantalla.document.write(HTML+"<p>Contabilidad</p><br>"+HTML+"<p>Cliente</p>");
pantalla.document.close();
self.location ="<?= base_url()?>Creditos";
pantalla.focus();
pantalla.onload = function() {
pantalla.print();
pantalla.close();
};
//$(".ocultarImprimir").show();
});
});
</script>
Here you should open a pdf window