<?php include "../index/conexion.inc" ?>
<?php include "../index/validacion.php" ?>
<?php
	$cV01 = $_POST['v1'];	/* SERIE */
	$cV02 = $_POST['v2'];	/* NUMERO */
?>
<?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
	{
		// CONSULTA SQL
		$sql = "SELECT NUMSERIE, NUMFACTURA, ENVIADO_SAP, DOCENTRY_SAP, SERIEFEL, DOCUMENTOFEL, FECHAHORACERTIFICACI, UUID, ERROR_FEL, SERIEYNUMICG \n"
			  ."FROM FACTURASVENTACAMPOSLIBRES \n"
			  ."WHERE (NUMSERIE = '".$cV01."') AND (NUMFACTURA = ".$cV02.")";
		$pa1 = array();
		$op1 = array("scrollable" => SQLSRV_CURSOR_KEYSET);
		// Lanzar la consulta
		$re1 = sqlsrv_query($conexion, $sql, $pa1, $op1);
		if (sqlsrv_num_rows($re1) != 0)
		{
			echo "
			<div class='x_panel'>
				<div class='x_title'>
					<h3>Datos firma factura</h3>
					<div class='clearfix'></div>					
				</div>
				<div class='table-responsive'>
					<table class='table table-striped jambo_table bulk_action'>
						<thead>
							<tr>
								<th>SERIE</th>
								<th>FACTURA</th>
								<th>ENVIADO SAP</th>
								<th>DOCENTRY SAP</th>
								<th>SERIE FEL</th>
								<th>DOCUMENTO FEL</th>
								<th>FECHA CERTIFICADO</th>
								<th>UUID</th>
								<th>ERROR_FEL</th>
								<th>SERIE Y NUM ICG</th>
							</tr>
						</thead>";
						while($fila = sqlsrv_fetch_array($re1))
						{
							echo "
								<tbody>
									<tr>
										<td>".$fila['NUMSERIE']."</td>
										<td>".$fila['NUMFACTURA']."</td>
										<td>".$fila['ENVIADO_SAP']."</td>
										<td>".$fila['DOCENTRY_SAP']."</td>
										<td>".$fila['SERIEFEL']."</td>
										<td>".$fila['DOCUMENTOFEL']."</td>
										<td>".$fila['FECHAHORACERTIFICACI']."</td>
										<td>".$fila['UUID']."</td>
										<td>".$fila['ERROR_FEL']."</td>
										<td>".$fila['SERIEYNUMICG']."</td>
									</tr>
								</tbody>
							";
						}
					echo "
					</table>
				</div>
			</div>
			";
		}
		else
		{
			echo "
			<div class='alert alert-warning alert-dismissible fade in' role='alert'>
			<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span>
			</button>
				Registros <strong>NO</strong> localizados.
			</div>
			";
		}
		sqlsrv_free_stmt($re1);
	}
	sqlsrv_close($conexion);
?>