<?php include "../index/conexion.inc" ?>
<?php include "../index/validacion.php" ?>
<!doctype html>
<html lang="es">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<!-- Meta, title, CSS, favicons, etc. -->
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="../images/me.ico" type="image/ico" />
	<title>Join Manager</title>
	<!-- Bootstrap -->
	<link href="../config/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	<!-- Font Awesome -->
	<link href="../config/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<!-- NProgress -->
	<link href="../config/vendors/nprogress/nprogress.css" rel="stylesheet">
	<!-- iCheck -->
	<link href="../config/vendors/iCheck/skins/flat/green.css" rel="stylesheet">	
	<!-- Datatables -->
	<link href="../config/vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
	<link href="../config/vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
	<link href="../config/vendors/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
	<link href="../config/vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
	<link href="../config/vendors/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">
	<!-- Custom Theme Style -->
	<link href="../config/build/css/custom.min.css" rel="stylesheet">
	</head>
	<div class="top_nav">
		<div class="container body">
			<div class="main_container">
				<!-- page content -->
				<div class="right_col" role="main">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="x_panel">
							<div class="x_title">
								<h2>Documento No. <?php echo $_GET['id'];?></h2>
								<div class="clearfix"></div>
							</div>
							<div class="x_content">
							<table id="datatable-fixed-header" class="table table-striped table-bordered">
								<thead>
									<tr>
										<th>COD.ARTICULO</th>
										<th>DESCRIPCION</th>
										<th>PROVEEDOR</th>
										<th>TALLA</th>
										<th>COLOR</th>
										<th>CANTIDAD SOLICITADA</th>
										<th>CANTIDAD DEVUELTA</th>
									</tr>
								</thead>
								<tbody>
									<?php
										// 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
										{
											$cV00 = $_GET['id'];
											// CONSULTA SQL
											$sql = "SELECT D.CODIGOARTICULO, A.DESCRIPCION, A.REFPROVEEDOR, D.TALLA, D.COLOR, D.CANTSOLICITADA, D.CANTIDADDEVUELTA \n"
												  ."FROM JOIN_DEVOLUCIONES AS D \n"
												  ."INNER JOIN ARTICULOS AS A ON (D.CODIGOARTICULO = A.CODARTICULO) \n"
												  ."WHERE (D.DOCUMENTO = '".$cV00."') \n"
												  ."ORDER BY FECHA DESC";
											$pa1 = array();
											$op1 = array("scrollable" => SQLSRV_CURSOR_KEYSET);
											// Lanzar la consulta
											$re1 = sqlsrv_query($conexion, $sql, $pa1, $op1);
											while($fila = sqlsrv_fetch_array($re1))
											{
												echo "
													<tr>
														<td>".$fila['CODIGOARTICULO']."</td>
														<td>".$fila['DESCRIPCION']."</td>
														<td>".$fila['REFPROVEEDOR']."</td>
														<td>".$fila['TALLA']."</td>
														<td>".$fila['COLOR']."</td>
														<td>".$fila['CANTSOLICITADA']."</td>
														<td>".$fila['CANTIDADDEVUELTA']."</td>
													</tr>
												";
											}
										}
									?>
								</tbody>
							</table>
							</div>
						</div>
					</div>
				</div>
				<!-- /page content -->
			</div>
		</div>
	</div>
    <!-- jQuery -->
    <script src="../config/vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../config/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="../config/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="../config/vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="../config/vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="../config/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="../config/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="../config/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../config/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="../config/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="../config/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="../config/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="../config/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="../config/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="../config/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="../config/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="../config/vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="../config/vendors/jszip/dist/jszip.min.js"></script>
    <script src="../config/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="../config/vendors/pdfmake/build/vfs_fonts.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="../config/build/js/custom.min.js"></script>
	</body>
</html>
<script>
	var mipopup;
	function popup02(d01)
	{
		v01 = d01;
		posicion_x=(screen.width/2)-(1000/2);
		posicion_y=(screen.height/2)-(600/2)-50;
		mipopup = window.open("reporte_06_xls.php?id="+v01, "neo", "width=1000, Height=600, menubar=0, toolbar=0,directories=0,scrollbars=no,resizable=no,left="+posicion_x+",top="+posicion_y+"");
		mipopup.focus()
	}
</script>
<script>
	var mipopup;
	function popup98(d01, d02, d03)
	{
		v01 = d01;
		v02 = d02;
		v03 = d03;
		posicion_x=(screen.width/2)-(400/2);
		posicion_y=(screen.height/2)-(200/2)-50;
		mipopup = window.open("reporte_06_bar.php?id="+v01+"&id2="+v02+"&id3="+v03, "neo98", "width=400, Height=200, menubar=0, toolbar=0,directories=0,scrollbars=no,resizable=no,left="+posicion_x+",top="+posicion_y+"");
		mipopup.focus()
	}
</script>
<script>
	var mipopup;
	function popup99(d01, d02, d03)
	{
		v01 = d01;
		v02 = d02;
		v03 = d03;
		posicion_x=(screen.width/2)-(400/2);
		posicion_y=(screen.height/2)-(200/2)-50;
		mipopup = window.open("reporte_06_und.php?id="+v01+"&id2="+v02+"&id3="+v03, "neo99", "width=400, Height=200, menubar=0, toolbar=0,directories=0,scrollbars=no,resizable=no,left="+posicion_x+",top="+posicion_y+"");
		mipopup.focus()
	}
</script>