<?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;} 
	
#width_cabe{
width:450px; /*fondo blanco*/
margin:0 auto;
margin-top:0px;
margin-bottom:40px;
border:0px solid #000;
background-color:#fff;
background-image:url(img/white_grid.png);
padding:15px; /*ancho fondo blanco*/
/*position:absolute; top:20px; left:320px;/*altura y ancho*/
}
#width_cabe td.titulo{
background-image:url(img/fondotitulos.jpg);
color:#FFF;
font-weight:bold;
text-align:center;
font-size:18px;
font-family:helvetica;
}
#width_cabe td{
background-color:#731E35;
color:#FFF;
text-align:left;
padding:5px 5px 5px 5px;
font-weight:bold;
}
	
	
</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_conceptos_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.agdescrip);	
//		$('#fcodgrupo').focus();
              
                }
	});	
	
});
//$(document).ready(function(){
//	$("#tbus").autocomplete('cat_conceptos_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_conceptos_AG.php?tap2="+$(this).val(),'_self');
//		//else if(confirm("Articulo:'" +row[0]+"'\nDesea Consultar/Modificar?"))
//			openpage("cat_conceptos_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.tbus.focus ()">
<!--<div id="resultado" align="left">
<div align="right" id="formulario" style="display:none;"></div>-->
<div align="center">
  <form name="form1" id="form1" method="post" action="">
       <p>&nbsp;</p>
	 <table  align="center" bordercolor=" " bordercolordark=" ">
             <tr>  <th colspan="2">CATALOGO DE CONCEPTOS </th></tr> 
      
      <tr> <th>BUSQUEDA</th> </tr>
    
      <tr>
        <td><input type="submit" name="Submit" value="Buscar" class="bot_WsW" />
		<img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" />
        <input name="tbus" type="text" id="tbus" onBlur="may(this)" size="50"
		<?php

			if(isset($_POST['tbus'])){ 
				echo 'value="' . $_POST['tbus'] .  '"';
			}
		?>
		/>
		</td>
      </tr>
    </table>
	
  </form>
</div>
<form name="frm1" method="post" action="" >
<body>
<div align="center">
<?php
 				 
	$sql = mysqli_query($con ,"SELECT * FROM hot_fac order by h_reg");
	include("DE10000.php");
	?>
<table width="507" border='1' bordercolor=" " bordercolordark=" ">
      <tr>
        <th colspan="3"> 
          <div align="center">
		    <!--input type="button" name="bot3" value="Consultar"  onClick="openpage('cat_conceptos_CO.php','_self')"/-->
			<input type="button" name="bot2" value="Modificar" class="original" onClick="openpage('cat_conceptos_MO.php','_self')"/>
            <input type="button" name="bot4" value="Imprimir" class="bot_WsW"   onClick="openpage('cat_conceptos_IM.php','_self')"/>  
            <input type="button" name="bot422" value="Eliminar" class="bot_RjR" onclick="openpage('cat_conceptos_EL.php','_self')"/>
            <!--input type="button" name="bot42" value="Exporta Exel" class="original" onClick="openpage('AL10000_IME.php','_self')"/-->
            <!--input type="button" name="Submit" value="Atributos" onClick="openpage('cat_conceptos_AG-DET.php','_self')"/-->
          </div>
   		</th></tr>
<tr>
      <th width="55"><div align="center">SEL</div></th>
      <th width="123"><div align="center">CLAVE</div></th>
      <th width="307"><div align="center">DESCRIPCION</div></th>
    </tr>
	  <?php

	  //if(!isset($_POST['tbus']))$_POST['tbus']="";
	$nu=(isset($_POST['tbus']))?$_POST['tbus']:"";
          echo '<input name="txt_bus" type="hidden" value="'.$nu.'">';
       $vars=(isset($_POST['submit']))?$_POST['submit']:"";
	if($vars=="")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM hot_fac WHERE descrip like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg["h_reg"].'"></div></td>';
		echo "<td> <div align='center' style=' '><strong>" . $reg["h_reg"] . "&nbsp;</strong></div></td>";
		echo "<td> <div align='center' style=' '><strong>" . $reg["descrip"] . "&nbsp;</strong></div></td>";
		//echo "<td> <div align='center' style=' '><strong>" . $reg["ntfa_senc"] . "&nbsp;</strong></div></td>";
		echo "</tr>";
				
	}
	    
	mysqli_close($con);
	?>
  </table>
</div>
</body>
</form>
</div>

</html>