
<!DOCTYPE html>
<html>
<head>
	<title>Codigo de barras</title>
	<!-- Latest compiled and minified CSS -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
	<script src="JsBarcode.all.min.js"></script>
	
	
</head>
<body>

	<div class="container">
		<div class="row">
	


<?php 


$variable1=($_GET['variable1']);

"$variable1";


$servername = "";
$username = "cwe41631_prec";
$password = "mihogar182";
$database = "cwe41631_prec";
// Create connection
$conexion = mysqli_connect($servername, $username, $password, $database);
$sql="SELECT * FROM ruc WHERE FECHA_CARGA='$variable1' AND DECISION ='AP' ORDER BY FECHA_CARGA";
$result=mysqli_query($conexion,$sql);

		//declaramos arreglo para guardar codigos
$arrayCodigos=array();


$resultados=mysqli_query($conexion, "select COUNT(RUC) from ruc WHERE FECHA_CARGA='$variable1' AND DECISION ='AP' ");


$total=mysqli_fetch_array($resultados);

echo "<H3>"."Total = ".$total[0]."</H3>";

?>
 <td> <center><input type="button" class="btn btn-success" name="imprimir" value="Imprimir P&aacute;gina" onclick="window.print();"></center></td>

 <br>
 

 <table class="table table-bordered">
  <thead class="bg-success"  >
			<tr>
				<td>N°</td>
				<td>Fecha ASIGNACION</td>
				<td>RUC</td>
				<td>Codigo barras</td>
			</tr></thead>
			
			<?php 
			$n=0;
			while($ver=mysqli_fetch_row($result)):
				$arrayCodigos[]=(string)$ver[1]; 
				$n++;
				?>
				<tr>
					<td><?php echo $n ?></td>
					<td><?php echo $ver[11] ?></td>
					<td><?php echo $ver[1] ?></td>
					<td>
					<img src="barcode.php?text=<?php echo $ver['1']; ?>&size=30&orientation=horizontal&codetype=Code39&print=true&sizefactor=1" />
						</td>
					</tr>
				<?php endwhile; ?>

	
			</table>
		</div>
	</div>




	<script type="text/javascript">

		function arrayjsonbarcode(j){
			json=JSON.parse(j);
			arr=[];
			for (var x in json) {
				arr.push(json[x]);
			}
			return arr;
		}

		jsonvalor='<?php echo json_encode($arrayCodigos) ?>';
		valores=arrayjsonbarcode(jsonvalor);

		for (var i = 0; i < valores.length; i++) {

			JsBarcode("#barcode" + valores[i], valores[i].toString(), {
				format: "codabar",
				lineColor: "#000",
				width: 1,
				height: 20,
				displayValue: true
			});
		}
		
	</script>
		</div>

	<br>
	
</body>
</html>