<?php
include('../../../configuracion.php');
include('inc/formulario.php');
include('config.php');
?>

<!doctype html>
<html class="fixed">
	<head>
		<?php include("../../inc/head.php")?>
		<!-- ESPACIO HEAD ADICIONALES -->

		<!-- FIN ESPACIO HEAD ADICIONALES -->
	</head>
	<body>
		<section class="body">
			<!-- start: header -->
			<?php include("../../inc/header.php")?>
			<!-- end: header -->
			<div class="inner-wrapper">
				<!-- start: sidebar -->
				<?php include("../../inc/side-left.php")?>
				<!-- end: sidebar -->
				
                    

                <?php 
                    
                    set_include_path(get_include_path() . PATH_SEPARATOR . 'mago/lib/');
                    include '../../lib/PHPExcel/IOFactory.php';

                    $inputFileName = 'documento/cargar-listado.xlsx';

                    try {
                        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
                    } catch(Exception $e) {
                        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
                    }

                    $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
                    $arrayCount = count($allDataInSheet);

                    $datos_base = array();

                    
                    ?>



			



					<!-- start: page -->
					<div class="row">
							<div class="col">
                            <?php	if(count($arrayCount)){ ?>

								<section class="card">
									<div class="card-body">
										
										<table class="table table-bordered table-striped mb-none" id="datatable-default-no">
											<thead>
                                                <tr>
                                                    <th>SKU</th>
                                                    <th>ZONA</th>
                                                    <th>Rango 1 a 3.5</th>
                                                    <th>Rango 3.6 a 6</th>
                                                    <th>Rango 6.1 a 10</th>
                                                    <th>Rango 10.1 a 20</th>
                                                    <th>Rango 20.1 a 50</th>
                                                </tr>
											</thead>
											<tbody>
                                                <?php for($i=2;$i<=$arrayCount;$i++){?>
                                                <?php
                                                $sku = trim($allDataInSheet[$i]["A"]);
                                                $zona	  = trim($allDataInSheet[$i]["B"]);
                                                $rango_1 = trim($allDataInSheet[$i]["C"]);
                                                $rango_2 = trim($allDataInSheet[$i]["D"]);
                                                $rango_3 = trim($allDataInSheet[$i]["E"]);
                                                $rango_4 = trim($allDataInSheet[$i]["F"]);
                                                $rango_5 = trim($allDataInSheet[$i]["G"]);
                                                ?>
                                                <tr class="gradeX ">
                                                    <td><?php echo $sku?></td>
                                                    <td><?php echo $zona?></td>
                                                    <td><?php echo $rango_1?></td>
                                                    <td><?php echo $rango_2?></td>
                                                    <td><?php echo $rango_3?></td>
                                                    <td><?php echo $rango_4?></td>
                                                    <td><?php echo $rango_5?></td>
                                                </tr>
                                                <?php }?>
												
											</tbody>
										</table>

                                        <footer class="panel-footer">
										<div class="row">
											<div class="col-sm-12 text-right">
												<a href="<?php echo MAGO?>c/<?php echo MODULO?>" type="reset" class="btn btn-default">Cancelar</a>
                                                <a href="<?php echo MAGO?>c/<?php echo MODULO?>/carga-excel-finalizar.php" class="btn btn-primary">Realizar Carga</a>
											</div>
										</div>
									</footer>


									</div>
                                    

								</section>
                                
                                <?php }?>
							</div>
						</div>







		
					

		<!-- NO TOCAR -->
		<?php include("../../inc/side-right.php")?>
		<?php include("../../inc/bottom.php")?>
		<!-- NO TOCAR -->

		
		<!-- ESPACIO JS ADICIONALES -->

	

    </body>
</html>