<?php
include ("../conexion.php"); 
include ("../funciones/fechas.php"); 

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

 
	$consulta = "SELECT * FROM traslados_inventario WHERE codtras='$codtras'";
	$resultado = $mysqli->query($consulta);
	$fila = $resultado->fetch_array();

        $marcaborrado = $fila["borrado"];
        $fecha        = $fila["fectras"];
		$fectras       = implode("-", array_reverse(explode("-", $fecha)));
        //$cdgtipaju    = $fila["cdgtipaju"];
		$numtras       = $fila["numtras"];
		$dettras       = $fila["dettras"];
		$cdgusu       = $fila["cdgusu"];
		$cdgbod       = $fila["cdgbod"];
		$cdgbodpar       = $fila["cdgbodpar"];
		


  
  if ($marcaborrado == 1) { $borrado="traslado de Inventario Anulado"; } else { $borrado=""; } 

	$query_usuarios = "SELECT * FROM usuarios WHERE codusu='$cdgusu'";
	$result = $mysqli->query($query_usuarios);
	$row = $result->fetch_array();
	$nomb = $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(codtras) {
	if (document.getElementById("marcaborrado").value==1) {
 alert ("traslado de inventario ya fue anulado no puede ser reimpreso favor verifique")
	 
	} else {	
				window.open("../fpdf/imprimir_traslado_PUNTO_VENTA.php?codtras="+codtras);
			
			}
		}

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_traslado.php">
					<table class="fuente8" width="98%" cellspacing=2 cellpadding=0 border=0>
						
						<tr>
						  <td>&nbsp;</td>
						  <td>&nbsp;</td>
						  <td>&nbsp;</td>
						  <td>&nbsp;</td>
						  <td>&nbsp;</td>
						  <td colspan="3">&nbsp;</td>
						  <td rowspan="3">&nbsp;</td>
					  </tr>
						<tr>
							<td width="12%">&nbsp;</td>
					      <td width="25%">&nbsp;</td>					
						  <td width="7%">&nbsp;</td>
						  <td width="15%">&nbsp;</td>
						  <td width="5%">&nbsp;</td>
						  <td colspan="3"><div align="center" class="Estilo1"></div></td>
					    </tr>
						<tr>
						  <td>Bodega Origen </td>
						  <td><select id="combobodega" name="combobodega" class="comboGrande"  onFocus="siguienteCampo ='numaju',  nombreForm ='formulario';"   >
			
								
						<?php 
					  	  	$tipo="SELECT * FROM bodegas WHERE cdgbod='$cdgbod'";
                        $resultado = $mysqli->query($tipo) 
						?>
						   <?php
							while ($fila = $resultado->fetch_assoc()) { ?>
                        <option value="<?php echo  $fila["cdgbod"]?>"><?php echo  $fila["dscbod"]?></option>
                        <?php 
								} ?>		
								
								
					      </select></td>
					      <td>Documento</td>
					      <td><input name="numtras" type="text" class="cajaGrande" id="numtras" size="20" maxlength="15" style='text-align:center;' value="<?php echo $numtras?>" readonly  autocomplete= "off" onFocus="siguienteCampo ='dettras' ,  nombreForm ='formulario';"></td>
				
					      <td>Fecha</td>
					      <td width="11%"><input name="fectras" type="text" class="cajaGrande" id="fectras" size="10" maxlength="10" style='text-align:center;' value="<?php echo $fectras?>" readonly></td>
					      <td width="7%">Usuario</td>
					      <td width="13%"><input name="cdgusu" type="text" class="cajaGrande" id="cdgusu" size="10" maxlength="10" style='text-align:center;' value="<?php echo $nomb?>" readonly></td>
					  </tr>
						<tr>
							<td width="12%">Bodega Destino</td>
					      <td><select id="combobodega_para" name="combobodega_para" class="comboGrande"  onFocus="siguienteCampo ='numaju',  nombreForm ='formulario';"   >
			
								
						<?php 
					  	  	$tipo="SELECT * FROM bodegas WHERE cdgbod='$cdgbodpar'";
                        $resultado = $mysqli->query($tipo) 
						?>
						   <?php
							while ($fila = $resultado->fetch_assoc()) { ?>
                        <option value="<?php echo  $fila["cdgbod"]?>"><?php echo  $fila["dscbod"]?></option>
                        <?php 
								} ?>		
								
								
					      </select></td>
					      <td>Detalle</td>
					      <td colspan="5"><input name="dettras" type="text" class="cajaGrande" id="dettras"  value="<?php echo $dettras?>" 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="codtras" name="codtras" value="<?php echo $codtras?>" type="hidden">
			
				
			
			<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 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 $codtras?>,<?php echo $marcaborrado?>) , seleccionaFoco() " onMouseOver="style.cursor=cursor"></div>
        </div>
	</body>
</html>