Ver Mensaje Individual
  #4 (permalink)  
Antiguo 13/09/2016, 23:37
fab2160225
 
Fecha de Ingreso: abril-2016
Mensajes: 90
Antigüedad: 8 años
Puntos: 1
Respuesta: Impresion y corte papel en impresora termica

Buenas, ayer no tenía el código a mano, es este:
Código PHP:
Ver original
  1. <p align="center"><a  href="javascript:imprSelec('Imprime')" ><img  src="print.png" width="80" height="80" /></a></p>
  2. <script language="javascript">
  3.  
  4.   function imprSelec(nombre)
  5.  
  6.   {
  7.  
  8.   ////////
  9.   var ficha = document.getElementById(nombre);
  10.  
  11.   var ventimp = window.open(' ', 'popimpr');
  12.  
  13.   ventimp.document.write( ficha.innerHTML );
  14.  
  15.   ventimp.document.close();
  16.  
  17.   ventimp.print( );
  18.  
  19.   ventimp.close();
  20.  
  21.   }
  22.  
  23. </script>
  24. <div id="Imprime" style="display:inline">
  25.     <?php
  26.    
  27.     $fechaactual=date("Y-m-d");
  28.        
  29.  
  30.        
  31.    
  32.         date_default_timezone_set("Europe/Madrid");
  33.         $fecha = date("d/m/Y H:i:s");
  34.         $idtienda = $_SESSION['nombre']; //se obtiene la sucursal respecto al usuario que inicio sesion
  35.  
  36.        
  37.          for($i=0; $i<$chkcount; $i++)
  38.         {
  39.             $id = $chk[$i];
  40.             $res=$SQLConn->query("SELECT * FROM tr WHERE idtv=".$id);
  41.             while($row=$res->fetch_array())
  42.             {
  43.        
  44.        
  45.     ?>
  46.     <table width="260" border="1" align="center">
  47.     <td>
  48.     -------------------------------------------<br>
  49.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $idtienda?><br>
  50.     -------------------------------------------<br>
  51.     Fecha: <?php echo $fecha ?><br>
  52.     Tienda destino: <?php echo $row['Tienda']; ?><br>  
  53.     Cod. Articulo: <?php  echo $row['Articulo']; ?><br>
  54.    
  55.     Descrripción: <?php echo $row['Descripcion']; ?><br>
  56.     Cantidad: <?php echo $row['Cantidad']; ?><br>
  57.    
  58.         </td>
  59.     </table>
  60.     <?php
  61.         }}
  62.     ?>
  63.  
  64.  
  65.  
  66.   <br>
  67.     </div>