<?php
	include("stilos/config.inc.php");
	include("../clases/BDConexion.php");
  include("../clases/clsPer.php");
  include("funcion/funciones.php");
  include("Funciones.php");
  session_start();
  $objPer=new clsPer;
  
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><MMString:LoadString id="insertbar/formsHidden" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<link href="Estilos.css" rel="stylesheet" type="text/css">

<link href="stilos/Estilos.css" rel="stylesheet" type="text/css">
<SCRIPT language=JavaScript src="js/calendario.js"></SCRIPT>
<!-- Copyright 2000,2001 Macromedia, Inc. All rights reserved. -->
<script language="JavaScript"> 
<!--
function print_1(sURL,x,y) {
if (!window.focus) return;
			var par;
			par = "width=" +x + ",height="+y+","
			par = par + "dependent=no,scrollbars=yes,resizable=yes,"
			par = par + "menubar=no,toolbar=no,status=no"
			var ventana = window.open(sURL,"print1",par)
			ventana.focus();			
}
//--> 
</script>
<script language="JavaScript"> 
function radios(obj){
if(obj.value=="1"){
document.getElementById('sede').disabled=false;
document.getElementById('tipo').disabled=true;
document.getElementById('des').disabled=true;
document.getElementById('fecha1').disabled=true;
document.getElementById('fecha2').disabled=true;
}else if(obj.value=="2"){
document.getElementById('sede').disabled=true;
document.getElementById('tipo').disabled=false;
document.getElementById('des').disabled=false;
document.getElementById('fecha1').disabled=true;
document.getElementById('fecha2').disabled=true;
}else if(obj.value=="3"){
document.getElementById('sede').disabled=true;
document.getElementById('tipo').disabled=true;
document.getElementById('des').disabled=true;
document.getElementById('fecha1').disabled=false;
document.getElementById('fecha2').disabled=false;
}
}
</script>
</head>

<body background="../imagenes/fondo.jpg">
<table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="25"><img src="../estilo_tabla/parte_sup_izq.gif" width="25" height="25"></td>
    <td width="700" background="../estilo_tabla/parte_sup_cen.gif" valign="bottom">
      <div align="left" class="lblTitulo" >Lista de Guias Emitidas </div></td>
    <td width="25"><img src="../estilo_tabla/parte_sup_der.gif" width="25" height="25" border="0" usemap="#MapMap"></td>
  </tr>
  <tr>
    <td width="25" background="../estilo_tabla/parte_med_izq.gif">&nbsp;</td>
    <td width="700" height="86" background="../estilo_tabla/parte_med_cen.gif"><div align="center">
        <table width="692" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="15"><div align="center"></div></td>
          </tr>
          <tr>
            <form action="p_guias_lista.php" method="post" name="form1" id="form1">
              <td height="15">
                <div align="left" class="lblForm">
                  <table width="599" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><div align="center">
                        <input name="opt" type="radio" value="1" onclick="radios(this)"<? if($opt=='1'){?>  checked <? }?>>
                      </div></td>
                      <td><div align="left">Sede</div></td>
                      <td width="110"><div align="left">
                        <select name="sede" id="sede">
                            <option value="0">Todas</option>
                            <option value="012">Iquitos</option>
                            <option value="013">LBC</option>
                        </select>
                      </div></td>
                      <td width="423">                      <input name="t" type="hidden" id="t2" value="1"></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                        <input name="opt" type="radio" value="2"  onclick="radios(this)"<? if($opt=='2'){?> checked <? }?>>
                      </div></td>
                      <td><div align="left">Tipo</div></td>
                      <td><select name="tipo" id="tipo">
                        <option value="0" <? if($tipo=='0'){?> selected <? }?>>Todas</option>
                        <option value="num_guia" <? if($tipo=='num_guia'){?> selected <? }?>>Nro Guia</option>
                        <option value="denominacion" <? if($tipo=='denominacion'){?> selected <? }?>>Transportista</option>
                        <option value="ruct">RUC Trans.</option>
                      </select></td>
                      <td><div align="left">
                        <input name="des" type="text" id="des" value="<?=$des?>" size="30">
                      </div></td>
                    </tr>
                    <tr>
                      <td width="23"><div align="center">
                        <input name="opt" type="radio" value="3" onclick="radios(this)" <? if($opt=='3'){?> checked <? }?>>
                      </div></td>
                      <td width="43"><div align="left">Fechas</div></td>
                      <td colspan="2"><div align="left">
                        <table width="192" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="105"><table width="87" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="67"><div align="left">
                                      <input name="fecha1" type="text" class="lblCampo" id="fecha12" value="<? echo $fecha1?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                                  </div></td>
                                  <td width="10">&nbsp;</td>
                                  <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha1');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                </tr>
                            </table></td>
                            <td width="104"><div align="right">
                                <table width="87" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="67"><div align="left">
                                        <input name="fecha2" type="text" class="lblCampo" id="fecha2" value="<? echo $fecha2?>" size="12" maxlength="10" title="FORMATO dd/mm/AA">
                                    </div></td>
                                    <td width="10">&nbsp;</td>
                                    <td width="109"><div align="left"> <a onMouseOver="window.status='Calendario';return true;" onMouseOut="window.status='';return true;"  href="javascript:show_calendar('form1.fecha2');"> <img src="../imagenes/calendar.jpg" alt="Calendario" width="16" height="15" border="0"> </a> </div></td>
                                  </tr>
                                </table>
                            </div></td>
                          </tr>
                        </table>
                      </div>                          </td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td><div align="center">
                      </div></td>
                      <td><input type="submit" name="Submit" value="..:: Buscar ::.." style="<?=$stylo['st2']?>" class="botira"></td>
                    </tr>
                  </table>
              </div></td>
            </form>
          </tr>
          <tr>
            <td><div align="center">
                <table width="685" border="1" cellpadding="0" cellspacing="0" style="<?=$stylo['tabla']?>" bgcolor="<?=$c_fondo['fondo tabla']?>" bordercolor="<?=$bordetabla?>">
                  <tr valign="top" class="lblCampoBlanco" bgcolor="<?=$c_fondo_tr["fondo tr"]?>">
                    <td width="29"><div align="center">Serie</div></td>
                    <td width="56"><div align="left"></div>
                        <div align="center">Nro</div></td>
                    <td width="67">
                      <div align="center">Fecha</div></td>
                    <td width="198"><div align="center">Punto de llegada </div></td>
                    <td width="84"><div align="center">RUC</div></td>
                    <td width="130">Transportista</td>
                    <td width="88"><div align="center">Placa</div></td>
                    <td><div align="center"> </div></td>
                  </tr>
                  <? 				    
					if($opt=='1'){										
					$resultado=$objPer->getGuiaLista($sede,$tipo,$des,extraerfechamysql($fecha1),extraerfechamysql($fecha2),$opt);				
				    }elseif($opt=='2'){
					$resultado=$objPer->getGuiaLista($sede,$tipo,$des,extraerfechamysql($fecha1),extraerfechamysql($fecha2),$opt);				
					}elseif($opt=='3'){
					$resultado=$objPer->getGuiaLista($sede,$tipo,$des,extraerfechamysql($fecha1),extraerfechamysql($fecha2),$opt);
					}
                  while($filas=$objPer->NextRow($resultado))
                   {
				   $rs=$objPer->getGuiaDetalle($filas['id_guia']);
				   $n=0;
				   ?>
                  <tr valign="top" class="lblForm" >
                    <td class="lblForm">
                      <div align="center"><?=substr($filas['num_guia'],0,3)?></div></td>
                    <td class="lblForm"><div align="left"> </div>
                        <div align="center">
                          <?=substr($filas['num_guia'],4,8)?>
                        </div></td>
                    <td class="lblForm">
                      <div align="center">
                        <?=extraerfechanormal($filas['fecha'])?>
</div></td>
                    <td class="lblForm"><div align="center">
                      <?=$filas['llegada']?>
                    </div></td>
                    <td class="lblForm"><div align="center">
                      <?=$filas['ruct']?>
                    </div></td>
                    <td class="lblForm"><div align="center">
                      <?=$filas['denominacion']?>
                    </div></td>
                    <td class="lblForm"><div align="center">
                      <?=$filas['marcaplaca']?>
                    </div></td>
                    <td width="15">
                      <div align="center"> 
					  <a href="javascript:print_1('cvp_mani_print.php?cod_man=<? echo $filas['cod_man']?>&via=<? echo $filas['via']?>&mat_trans=<? echo $filas['mat_trans']?>&tipo_trans=<? echo $filas['tipo_trans']?>&fecha_man=<? echo $filas['fecha_man']?>&fecha_ruta=<? echo $filas['fecha_ruta']?>&testimado_ruta=<? echo $filas['testimado_ruta']?>&horasal_ruta=<? echo $filas['horasal_ruta']?>&horallega_ruta=<? echo $filas['horallega_ruta']?>&obser=<? echo $filas['obser']?>',800,600)"> 
					  <img src="../imagenes/imprimir.gif" alt="Imprimir Manifiesto" width="15" height="15" border="0"> 
					  </a>								  </div></td>
                  </tr>
                  <tr valign="top" class="lblForm" >
                    <td colspan="3" class="lblForm">&nbsp;</td>
                    <td colspan="5" class="lblForm"><div align="left">
                      <table width="520" border="0" cellspacing="0" cellpadding="0">
                        <tr bgcolor="#999999">
                          <td width="37"><div align="center">Item</div></td>
                          <td width="312"><div align="center">Descripcion</div></td>
                          <td width="51"><div align="center">Cant.</div></td>
                          <td width="65"><div align="center">UM</div></td>
                          <td width="55"><div align="center">Peso Kg </div></td>
                        </tr>
						<? 
						while($row=$objPer->NextRow($rs)){
						
						?>
                        <tr>
                          <td><div align="center"><?=++$n;?></div></td>
                          <td><div align="left">
                            <?=$row['des'];?>
                          </div></td>
                          <td><div align="center">
                            <?=$row['cantidad'];?>
</div></td>
                          <td><div align="center">
                            <?=$row['um'];?>
</div></td>
                          <td><div align="right">
                            <?=$row['peso'];?>
</div></td>
                        </tr>
						<? 
			}
			$objPer->Liberar($rs);   
			?>
                      </table>
                    </div></td>
                  </tr>
                  <? 
			}
			$objPer->Liberar($resultado);   
			?>
                </table>
            </div></td>
          </tr>
          
          <tr>
		  <form name="form2" method="post" action="p_guias_detalle_dir.php">
            <td><div align="center">
              <input type="submit" name="Submit2" value="..:: Imprimir ::..">
              
              
              <input name="opt" type="hidden" id="opt" value="<?=$opt?>">
              <input name="sede" type="hidden" id="sede" value="<?=$sede?>">
              <input name="tipo" type="hidden" id="tipo" value="<?=$tipo?>">
              <input name="des" type="hidden" id="des" value="<?=$des?>">
              <input name="fecha1" type="hidden" id="fecha1" value="<?=$fecha1?>">
              <input name="fecha2" type="hidden" id="fecha2" value="<?=$fecha2?>">
            </div></td>
			</form>
          </tr>
          <tr class="lblCampo">
            <td><div align="center">
            </div></td>
          </tr>
          
        </table>
    </div></td>
    <td background="../estilo_tabla/parte_med_der.gif">&nbsp;</td>
  </tr>
  <tr>
    <td><img src="../estilo_tabla/parte_inf_izq.gif" width="25" height="20"></td>
    <td background="../estilo_tabla/parte_inf_cen.gif">&nbsp;</td>
    <td><img src="../estilo_tabla/parte_inf_der.gif" width="25" height="20"></td>
  </tr>
</table>
<map name="MapMap">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
<map name="Map">
  <area shape="rect" coords="2,5,22,21" href="fondo.php">
</map>
</body>

</html>

