<?php include "../index/conexion.inc" ?>
<!doctype html>
<html lang="es">
	<head>
		<?php include '../index/head.php'; ?>
		<script>
			function datos(cV01, cV02)
			{
				d01 = cV01+"."+cV02;
				opener.document.neo99.cV04.value = d01;
				window.close()
			}
		</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>VENDEDORES</h2>
								<div class="clearfix"></div>
							</div>
							<div class="x_content">
								<div class="row">
									<table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
										<thead>
											<tr>
												<th>CODIGO</th>
												<th>VENDEDOR</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
												{
													// codigo SQL
													$sql = "SELECT * FROM VENDEDORES ORDER BY NOMVENDEDOR ASC";
													$pa1 = array();
													$op1 = array("scrollable" => SQLSRV_CURSOR_KEYSET);
													$re1 = sqlsrv_query($conexion, $sql, $pa1, $op1);
													while($fila = sqlsrv_fetch_array($re1))
													{
														$cV01 = $fila['CODVENDEDOR'];
														$cV02 = str_replace(" ","&nbsp;", $fila['NOMVENDEDOR']);
														echo "
															<tr OnMouseOver='Resaltar_On(this);' OnMouseOut='Resaltar_Off(this);' OnClick=datos('$cV01','$cV02')>
																<td>$cV01</td>
																<td>$cV02</td>
															</tr>
														";
													}
												}
												sqlsrv_free_stmt($re1);
												sqlsrv_close($conexion);
											?>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- /page content -->
			</div>
		</div>
		<?php include '../index/fbody.php'; ?>
	</body>
</html>