<?php
session_start();
ob_start();


require_once "../../../config/database.php";

include "../../../config/fungsi_tanggal.php";

include "../../../config/fungsi_rupiah.php";

$hari_ini = date("d-m-Y");

$no = 1;


if (!($res = $mysqli->query("CALL stp_kardex"))) {
    echo "Falló la llamada: (" . $mysqli->errno . ") " . $mysqli->error;
}
 
/*E imprimimos el resultado para ver que el ejemplo ha funcionado*/


  //Query parametros perfil
$queryperfil = mysqli_query($mysqli, "SELECT * FROM perfil")
                                or die('error'.mysqli_error($mysqli));
$rows  = mysqli_num_rows($queryperfil);
$data_perfil  = mysqli_fetch_assoc($queryperfil);
$folio_perfil = $data_perfil['folio'];
$folio_rem_perfil = $data_perfil['folio2'];
$nombre_perfil = $data_perfil['nombre_empresa'];
$direccion_perfil = $data_perfil['direccion'];
$direccion_perfil = $data_perfil['direccion'];
$email_perfil = $data_perfil['email'];
$almacen_perfil = $data_perfil['almacen'];
$almacenista_perfil = $data_perfil['almacenista'];
  


?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head>
        <!--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>INFORME DE STOCK DE PRODUCTOS CDC</title>
		-->
		

        <link rel="stylesheet" type="text/css" href="../../assets/css/laporan.css" />
    </head>
    <body>
        <div id="title">
           Kardex de existencias almacen <?php echo $almacen_perfil ?>;
		    <?php
      echo "  con fecha  " . date("d") . "/" . date("m") . "/" . date("Y");
		   
		   ?>  


        </div>
        
        <hr><br>
<!---------------------------------  Tabla de articulos ------------------------------->
        <div id="isi">
		
            <table width="100%" border="0.3" cellpadding="0" cellspacing="0">
                <thead style="background:#e8ecee">
                    <tr class="tr-title">
                        <th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Codigo</small></th>
                        <th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Articulo</small></th>
						<th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Saldo Inicial</small></th>
                        <th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Entradas</small></th>
						<th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Salidas</small></th>
                        <th height="20" align="center" valign="middle"bgcolor="#005a6f" style="color: #ffffff;font-size:10px;"><small>Existencias</small></th>
				
						
                    </tr>
                </thead>
                <tbody>
        <?php
     
       while ($row = mysqli_fetch_assoc($res)) {
         
            echo "  <tr>                   
                        <td width='50' height='13' align='center' valign='middle' style='font-size:70%;'>$row[codigo]</td>
                        <td style='padding-left:5px;' width='250' height='13' valign='middle' style='font-size:65%;'>$row[articulo]</td>
						<td width='100' height='13' align='center' valign='middle' style='font-size:60%;'>$row[saldoinicial]</td>
						<td width='100' height='13' align='center' valign='middle' style='font-size:60%;'>$row[entradas]</td>
                        <td width='100' height='13' align='center' valign='middle' style='font-size:60%;'>$row[salidas]</td>
						<td width='90' height='13' align='center' valign='middle' style='font-size:60%;'>$row[existencia]</td>
                    </tr>";
            $no++;
        }
        ?>  
                </tbody>
            </table> 
			</div>
		<!---------------------------------  fin Tabla de sumatoria ------------------------------->
		
		
    </body>
</html>
<?php
$filename="Kardex.pdf"; 
//==========================================================================================================
$content = ob_get_clean();
$content = '<page style="font-family: freeserif">'.($content).'</page>';

require_once('../../../assets/plugins/html2pdf_v4.03/html2pdf.class.php');
try
{
    $html2pdf = new HTML2PDF('P','F4','en', false, 'ISO-8859-15',array(10, 10, 10, 10));
    $html2pdf->setDefaultFont('Arial');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output($filename);
}
catch(HTML2PDF_exception $e) { echo $e; }
?>