<?php 
include('../conexion.php'); 
 date_default_timezone_set('America/Costa_Rica');	
 include ("../funciones/fechas.php"); 

$codord=$_GET["codord"];
$cadena_busqueda=$_GET["cadena_busqueda"];

$query="SELECT * FROM orden_compra WHERE codord='$codord'";

$resultado = $mysqli->query($query);
$row = $resultado->fetch_array();

$numord = $row["numord"];
$fecord = $row["fecord"];
$cdgpro = $row["cdgpro"];
$dscpro = $row["dscpro"];
$fecord= implode("-", array_reverse(explode("-", $fecord))); 
$detord = $row["detord"];
$cdgusu = $row["cdgusu"];




$query_usuarios="SELECT * FROM usuarios WHERE codusu='$cdgusu'";


$resultado = $mysqli->query($query_usuarios);
$row = $resultado->fetch_array();
$cdgusu = $row["usu"];

?>

<html>
	<head>
		<title>Principal</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="../funciones/validar.js"></script>
		
		<script language="javascript">
		var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		
		function aceptar() {
			location.href="index.php?cadena_busqueda=<?php 
 echo $cadena_busqueda?>";
		}
		
		
	
	
	function chequearEnter(event) {
    if (event.keyCode == 13) {  ocultarVentana(); }
} 
		

		
		//////////////////////////////  funcion imprimir  ///////////////////////////////
		
		

	
	
	function imprimir(codord) {
		
		

	if (document.getElementById("marcaborrado").value==1) {
 alert ("orden de inventario ya fue anulado no puede ser reimpreso favor verifique")
	 
	} else {	
				window.open("../fpdf/imprimir_orden.php?codord="+codord);
			
			}
		}

function ocultarVentana()
{
    var ventana = document.getElementById('miVentana');
    ventana.style.display = 'none';
	
	}
	
	
	function seleccionaFoco(){ 
   	document.formulario_emergente.boton.focus() 
   	document.formulario_emergente.texto.select() 
}
	
					function nobackbutton(){	
   window.location.hash="no-back-button";	
   window.location.hash="Again-No-back-button" //chrome	
   window.onhashchange=function(){window.location.hash="no-back-button";}	
}
	 	function inicio() {
			document.getElementById("formulario_lineas").submit();
		}
		
		</script>
	
	    <style type="text/css">
<!--
.Estilo1 {color: #00FF33}
-->
        </style>
</head>
			<body onLoad=" inicio(); ">
				<div id="">
			<div id="zonaVentanas">
				<div align="center">

				
					<div class="contenidoFactura2">
				<form id="formulario" name="formulario" method="post" action="guardar_orden.php">
					<table class="fuente8" width="98%" cellspacing=2 cellpadding=0 border=0>
						
						<tr>
						  <td>&nbsp;</td>
						  <td>&nbsp;</td>
						  <td width="24%">&nbsp;</td>
						  <td width="15%">&nbsp;</td>
						  <td>&nbsp;</td>
						  <td colspan="3">&nbsp;</td>
						  <td rowspan="3">&nbsp;</td>
					  </tr>
						<tr>
							<td width="11%">Codigo</td>
					      <td width="10%"><input NAME="cdgpro" type="text" class="cajaGrande" id="cdgpro"  value="<?php 
 echo $cdgpro?>" readonly  maxlength="150"   autocomplete= "off"   onFocus="siguienteCampo ='cdgbar',  nombreForm ='formulario_lineas';"></td>					
						  <td><div align="right">Numero</div></td>
						  <td><input name="numord" type="text" class="cajaGrande" id="numord" size="20" maxlength="15" style='text-align:center;' value="<?php 
 echo $numord?>" readonly  autocomplete= "off" onFocus="siguienteCampo ='detord' ,  nombreForm ='formulario';"></td>
						  <td>Fecha</td>
						  <td><input name="fecord" type="text" class="cajaGrande" id="fecord" size="10" maxlength="10" style='text-align:center;' value="<?php 
 echo $fecord?>" readonly></td>
						  <td width="6%">Usuario</td>
						  <td><input name="cdgusu" type="text" class="cajaGrande" id="cdgusu" size="10" maxlength="10" style='text-align:center;' value="<?php 
 echo $cdgusu?>" readonly></td>
						</tr>
						<tr>
						  <td>Proveedor</td>
						  <td colspan="2"><input name="dscpro" type="text" class="cajaGrande" id="dscpro"  value="<?php 
 echo $dscpro?>" readonly  maxlength="150"   autocomplete= "off"   onFocus="siguienteCampo ='cdgbar',  nombreForm ='formulario_lineas';"></td>
						  <td>&nbsp;</td>
				
					      <td>&nbsp;</td>
					      <td width="11%">&nbsp;</td>
					      <td width="6%">&nbsp;</td>
					      <td width="13%">&nbsp;</td>
					  </tr>
						<tr>
							<td width="11%">Detalle</td>
					      <td colspan="7"><input NAME="detord" type="text" class="cajaGrande" id="detord"  value="<?php 
 echo $detord?>" readonly  maxlength="150"   autocomplete= "off"   onFocus="siguienteCampo ='cdgbar',  nombreForm ='formulario_lineas';"></td>
			   
						    <td width="5%"></td>
					  </table>		
	
											

				</form>
				
				<form id="formulario_lineas" name="formulario_lineas" method="post" action="frame_lineas_ver.php" target="frame_lineas">
     	<input  name="marcaborrado" type="hidden"  id="marcaborrado"  value="<?php 
 echo $marcaborrado?>" />
		 <input id="codord" name="codord" value="<?php 
 echo $codord?>" type="hidden">
				</div>
				
			
			<table class="fuente8" width="100%" cellspacing=0 cellpadding=3 border=0 ID="Table1">
						<tr class="cabeceraTabla">
						
							<td width="9%"><span >CODIGO</span></td>
							<td width="49%"><span >DETALLE</span></td>
							<td width="8%"><span>CANTIDAD</span></td>
							<td width="8%"><span >PRECIO</span></td>
							<td width="10%"><span>DCTO %</span></td>
							<td width="8%"><span>MONTO</span></td>
							<td width="3%">&nbsp;</td>
						</tr>
			</table>
			<div id="lineaResultado2">
			  <iframe width="100%" height="380" id="frame_lineas" name="frame_lineas" frameborder="0">
              <ilayer width="100%" height="380" id="frame_lineas" name="frame_lineas"></ilayer>
			  </iframe>
			</div>	
					
		    </div>
		  </div>
			  </div>
		  </div>
		</div>
	    <div id="botonBusquedaFACTURA">
	      <div align="center"><img src="../img/Symbol-Check_48x48-32.png" width="48" height="48"  border="0" onMouseOver="style.cursor=cursor" onClick="aceptar()"><img src="../img/HP_Printer_Icon_48.png" width="48" height="48" border="0" onClick="imprimir(<?php echo $codord?>) , seleccionaFoco() " onMouseOver="style.cursor=cursor"></div>
        </div>
	</body>
</html>