<?php

	include('../../php/conn.php');
  	include('libs/barcode.php');

	require_once 'dompdf/autoload.inc.php';
	use Dompdf\Dompdf;

	$cod_interno = $_GET["CI"];
	$fecha_recepcion = $_GET["FR"];
	$elemento_analisis = $_GET["EA"];
	$tipo_analisis = $_GET["TA"];

	// Gnera ls códigos de barra
		barcode( 'images/bc/'.$cod_interno.'.png', "*".substr($cod_interno, 6)."*", 20, 'horizontal', 'code39', false );
	// barcode( 'images/bc/'.$cod_interno.'.png', "*".'?¡][;:_'."*", 20, 'horizontal', 'code39', false );
	// barcode( 'images/bc/'.$cod_interno.'.png', str_replace('-', '', $cod_interno), 20, 'horizontal', 'code128', false );

// echo substr($cod_interno, 6);

	$html = '<!DOCTYPE html>
			<html lang="es">
				<head>
			        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
			        <meta charset="utf-8">
			        <meta http-equiv="X-UA-Compatible" content="IE=edge">
			        <meta name="viewport" content="width=device-width, initial-scale=1">

			        <title>Impresión de Etiquetas</title>

			        <!-- Bootstrap -->
			        <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

					<style type="text/css">
				        html {
							margin: 0;
						}
						body {
							font-family: "Times New Roman", Times, serif;
						}
					</style>
			    </head>

				<body class="nav-md" style="background-color: #ffffff" onload="print_document();">
					<div class="container body" style="font-size: 8.2px; color: #000000">
						<div style="margin-left: -20px">
							<div class="row" style="margin-top: 0.7mm; font-size: 8.5">
								<center>
									<div class="col-md-6 col-sm-6 col-xs-6">
										<b>'.$cod_interno.'</b>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -32mm">
										<b>'.$cod_interno.'</b>
									</div>
								</center>
							</div>
							<div class="row" style="font-size: 7px">
								<center>
									<div class="col-md-6 col-sm-6 col-xs-6">
										<b>'.$fecha_recepcion.'</b>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -32mm">
										<b>'.$fecha_recepcion.'</b>
									</div>
								</center>
							</div>
							<div class="row" style="margin-top: 0.9mm; font-size: 7.5">
								<center>
									<div class="col-md-6 col-sm-6 col-xs-6">
										<b>'.$elemento_analisis.'</b>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -32mm">
										<b>'.$elemento_analisis.'</b>
									</div>
								</center>
							</div>
							<div class="row" style="margin-top: 0.3mm; margin-left: -0.5mm text-align: center;">
								<center>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -5mm">
										<img src="images/bc/'.$cod_interno.'.png" width="180mm"/>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -25mm">
										<img src="images/bc/'.$cod_interno.'.png" width="180mm"/>
									</div>
								</center>
							</div>
							<div class="row" style="margin-top: -1.5mm; font-size: 7.5; position: absolute">
								<center>
									<div class="col-md-6 col-sm-6 col-xs-6">
										<b>'.$tipo_analisis.'</b>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" style="margin-left: -32mm">
										<b>'.$tipo_analisis.'</b>
									</div>
								</center>
							</div>
						</div>
					</div>
				</body>
			  </html>';

	// $options = new Options();
	// $options -> set('enable-javascript', TRUE);

	// $document = new Dompdf($options);
	$document = new Dompdf();

	$document -> loadHtml($html,'UTF-8');
	$document -> setPaper(array(0, 0,340, 75), 'portrait');
	$document -> render();
	$document -> stream("Recibo", array('Attachment' => 0));


?>
