<?php include "../index/conexion.inc" ?>
<?php include "../index/validacion.php" ?>
<!doctype html>
<html lang="es">
	<head>
		<?php include '../index/head.php'; ?>
		<script>
			function datos(cD01, cD02)
			{
				var v01 = cD01;
				var v02 = cD02;
				opener.location.href="ubicacion_registra.php?id="+v01+"&id2="+v02;
				window.close()
				opener.location.href="etiquetas4x4.php";
			}
		</script>
	</head>
	<body>
		<div class="container body">
			<div class="main_container">
				<!-- page content -->
				<div class="right_col" role="main">
					<div class="">
						<div class="clearfix"></div>
						<div class="x_panel">
							<div class="x_title">
								<h2>CAJA MASTER <?php echo $_GET['id']; ?></h2>
								<div class="clearfix"></div>
							</div>
							<div class="x_content">
								<table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
									<thead>
										<tr>
											<th>ID UBICACION</th>
											<th>CODUBICACION</th>
											<th>BODEGA</th>
											<th>ID ZONA</th>
											<th>PASILLO</th>
										</tr>
									</thead>
									<tbody>
										<?php
											$cV00 = $_GET['id'];
											// conexión
											$servername = $svr_servidor;
											$conectioninfo = array("Database"=>$svr_base, "UID"=>$svr_usuario, "PWD"=>$svr_contrasena, "CharacterSet"=>"UTF-8");
											$conexion = sqlsrv_connect($servername, $conectioninfo);
											if ($conexion == false)
											{
												$mensaje = "Existe un error al intentar conectarse con el servidor...";
											}
											else
											{
												// codigo SQL
												$sql = "SELECT * FROM JOIN_UBICACIONES";
												$pa1 = array();
												$op1 = array("scrollable" => SQLSRV_CURSOR_KEYSET);
												$re1 = sqlsrv_query($conexion, $sql, $pa1, $op1);
												while($fila = sqlsrv_fetch_array($re1))
												{
													$cV01 = $fila['IDUBICACION'];
													$cV02 = $fila['CODUBICACION'];
													$cV03 = $fila['BODEGA'];
													$cV04 = str_replace(" ","&nbsp;", $fila['IDZONA']);
													$cV05 = str_replace(" ","&nbsp;", $fila['PASILLO']);
													echo "
														<tr OnMouseOver='Resaltar_On(this);' OnMouseOut='Resaltar_Off(this);' OnClick=datos('$cV00','$cV01')>
															<td>$cV01</td>
															<td>$cV02</td>
															<td>$cV03</td>
															<td>$cV04</td>
															<td>$cV05</td>
														</tr>
													";
												}
												sqlsrv_free_stmt($re1);
											}
											sqlsrv_close($conexion);
										?>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<!-- /page content -->
			</div>
		</div>
		<?php include '../index/fbody.php'; ?>
	</body>
</html>