<?php

session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("JQUERY.inc"); 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<head>

<style type="text/css">
BODY {
scrollbar-face-color:#000000;
scrollbar-highlight-color: ;
scrollbar-shadow-color: ; 
scrollbar-3dlight-color:#000000; 
scrollbar-arrow-color: ; 
scrollbar-track-color: ;
scrollbar-darkshadow-color:#000000;
}

td {/*background-color:#F0FFF0;*/
   /* background-image:url(img/tdn.jpg);*/
   font-family:helvetica;
   font-style:italic;
   font-size:14px;
   color: #FFFFFF;}  

th {background-color:  ;
	/*background-image:url(img/LINE2.jpg);*/
    font-family:helvetica;
    font-size:15px;
	color: #FFFFFF;} 
	
.original{ 
text-align:center;
background: url(img/boton_4.jpg);
font-size:10pt;
 ;
font-weight:bold;
border-style: dashed;
border-color:#99dd56;
border-width:1px;}

.bot_WsW{ 
text-align:center;
background: url(img/boton_5.jpg);
font-size:10pt;
 ;
font-weight:bold;
border-style: dashed;
border-color:#99dd56;
border-width:1px;}

.bot_ZaZ{ 
text-align:center;
background: url(img/boton_3.jpg);
font-size:10pt;
 ;
font-weight:bold;
border-style: dashed;
border-color:#99dd56;
border-width:1px;}

.bot_RjR{ 
text-align:center;
background: url(img/boton_2.jpg);
font-size:10pt;
 ;
font-weight:bold;
border-style: dashed;
border-color:#99dd56;
border-width:1px;}

.bot_NgN{ 
text-align:center;
background: url(img/boton_1.jpg);
font-size:10pt;
 ;
font-weight:bold;
border-style: dashed;
border-color:#99dd56;
border-width:1px;}


</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Registro con AJAX</title>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
     $(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	var pagRes='cat_tarifas_AU.php';
	var idObjDes='tbus';
//	var idObjCve='id_ope';
        var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({ //Des
	    source:pagRes,	
            minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		cacheLength: 0,
		delay: 200,                  //Retardo de autocompletar 
		width: 500,                  //ancho del cuadro de despliegue
		highlight: false,            //Resalta letras coincidentes
		autoFill: true,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 100,           //alto del cuadro para el scroll
		
		 select: function( event, ui ) {
                    
                      $("#"+idObjDes).val(ui.item.descripcion);	

                }
	});	
	
});
//$(document).ready(function(){
//	$("#tbus").autocomplete('cat_tarifas_AU.php',{
//		minChars: 1,                 //Caracteres Minimos antes de autocompletar
//		//max:3                        //maximo de resultados mostrados, se manda como limit en autosugestion
//		selectFirst:false,
//		delay: 200,                  //Retardo de autocompletar 
//		width: 500,                  //ancho del cuadro de despliegue
//		highlight: false,            //Resalta letras coincidentes
//		autoFill: false,             //autocompleta en texto la posible palabra
//		scroll: true,				 //si cuadro tiene barra scroll
//		scrollHeight: 500,           //alto del cuadro para el scroll
//		formatItem:function (row, i, n, value) { //formato de presentacion de las posibles busquedas
//			return "(<strong>"+row[1]+"</strong>)"+row[0];
//		},	     
//		formatResult:function(row){  //formato de seleccion de busqueda
//			return row[0];
//		},
//		extraParams:{tipBus:'d'}     //Parametros Extra a Mandar en autosugestion
//	});
//	$("#tbus").result(function(event, row, formatted){
//		//if(!row && confirm("Articulo:'"+$(this).val()+"'\nDesea AGREGARLO?"))
//			openpage("cat_tarifas_AG.php?tap2="+$(this).val(),'_self');
//		//else if(confirm("Articulo:'" +row[0]+"'\nDesea Consultar/Modificar?"))
//			openpage("cat_tarifas_MO.php?bot="+row[1],'_self');
//	}).keypress (function(){
//    	var evt = (evt) ? evt : event; 
//    	var tecla = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode:((evt.which) ? evt.which : 0)); 
//    	if(tecla==13){
//			$(this).search();
//			return false;	
//		}
//		return true;
//	});	
//
//});
</script>
</head>


<body onLoad = "self.focus (); document.form1.tbus2.focus ()">
<div id="resultado" align="left">
<div align="right" id="formulario" style="display:none;"></div>
<div align="left">

</div>

<div align="center">
  <form name="form1" method="post" action="">
    <table  align="center" bordercolor=" " bordercolordark=" ">
                <th colspan="2">TARIFAS INDIVIDUALES/PAQUETES   </th>
      </tr>
      
      <tr>
        <th>BUSQUEDA X DESCRIPCION  </th>
      </tr>
    
      <tr>
        <td colspan="2"><input type="submit" name="Submit" value="Buscar" class="bot_WsW"/>
          <img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" />
        <input name="tbus" id="tbus" type="text" onBlur="may(this)" size="30"/></td>
      </tr>
      <tr>
        <th colspan="2">TARIFAS INDIVIDUALES/PAQUETES </th>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input name="tbus2" type="text" id="tbus" onBlur="may(this)" size="50"
		<?php

			if(isset($_POST['tbus'])){ 
				echo 'value="' . $_POST['tbus'] .  '"';
			}
		?>
		/>
        </div></td>
      </tr>   
    </table>
  </form>

</div>
<form name="frm1" method="post" action="" >

<body>
<div align="center">
<?php
 
	$sql = mysqli_query($con ,"SELECT * FROM ftarifas order by gclave");
	include("DE10000.php");
	?>
<table width="723" border='1' bordercolor=" " bordercolordark=" ">
      <tr>
        <th colspan="6"> 
          <div align="center">
		  <input name="det_inv" type="button" id="det_inv" value="Agregar Tarifa" onClick="openpage('cat_tarifas_AG.php','_self')" class="original">
		  	  <input name="det_inv" type="button" id="det_inv" value="Detalle" onClick="openpage('cat_tarifas_AG-DET.php','_self')" class="original">
            <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('cat_tarifas_CO.php','_self')" class="bot_WsW"/>
            <input type="button" name="bot2" value="Modificar" onClick="openpage('cat_tarifas_MO.php','_self')" class="original"/>
            <input type="button" name="bot1" value="Eliminar" onClick="openpage('cat_tarifas_EL.php','_self')" class="bot_RjR"/>
            <input type="button" name="bot4" value="Imprimir " onClick="openpage('cat_tarifas_IM.php','_self')" class="bot_WsW"/>
          </div>
   		</th></tr>
<tr>
      <th width="46"  nowrap><div align="center">SEL</div></th>
        <th width="111"  nowrap><div align="center">CLAVE</div></th>
        <th width="303"  nowrap><div align="center">DESCRIPCION</div></th>
		<th width="133"  nowrap>TEMPORADA</th>
		<th width="96"  nowrap>TOTAL</th>
		<th width="96"  nowrap>STATUS</th>
	</tr>
	   <?php

	  
         $var2=(isset($_POST['tbus']))?$_POST['tbus']:"";
	echo '<input name="txt_bus" type="hidden" value="'.$var2.'">';
	$vars=(isset($_POST['submit']))?$_POST['submit']:"";
	if($vars=="")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
           
		@$sql = mysqli_query($con ,"SELECT * FROM ftarifas WHERE gdescrip like '%".$var2."%' order by gclave");//
	}
	$fecha = (isset($dt_empres['fec_alta']))?$dt_empres['fec_alta']:"";
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center" ><input name="bot" type="radio" value="'. $reg["n_reg"].'"></div></td>';
		
		$varn=(isset($reg["fapellido"]))?$reg["fapellido"]:"";
                echo "<td> <div align='center'><h5>" . $reg["gclave"] .' '. $varn . "&nbsp;</h5></div></td>";
		echo "<td> <div align='center'><h5>" . $reg["gdescrip"] . "&nbsp;</h5></div></td>";
		echo "<td> <div align='center'><h5>" . $reg["cclave"] . "&nbsp;</h5></div></td>";	
		
		if (isset($reg["gtotal"]) && $reg["gtotal"]=='0'){
		echo "<td style='FF2244'> <div align='center'><h5>$" .  number_format($reg['gtotal'], 2, '.', ',') . "</h5></div></td>";
		}else{
		echo "<td> <div align='center'><h5>$" .  number_format($reg['gtotal'], 2, '.', ',') . "</h5></div></td>";
		}
		
		$fecini=$reg["gfecini"];
		$fecfin=$reg["gfecfin"];
		if ( $fecini >= ''.$fecha.'' and  $fecfin <= ''.$fecha.''){
		echo "<td> <div align='center'><h5></h5></div></td>";
		}else{
		echo "<td style='FF0000'> <div align='center' style=' '><h5>VENCIDA</h5></div></td>";
		}
		echo "</tr>";
	}
	mysqli_close($con);
	?>
  </table>
</div>

</form>

</div>


</body>
</html>