<?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: #000000;}  

th {background-color:  ;
	/*background-image:url(img/LINE2.jpg);*/
    font-family:helvetica;
    font-size:15px;
	color: #FFFFFF;} 

.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;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<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_cargos_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_cargos_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_cargos_AG.php?tap2="+$(this).val(),'_self');
//		//else if(confirm("Articulo:'" +row[0]+"'\nDesea Consultar/Modificar?"))
//			openpage("cat_cargos_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="center">
  <form name="form1" method="post" action="">
    <p>&nbsp;</p>
    <table  align="center" bordercolor=" " bordercolordark=" ">
      
	  <tr><th>CATALOGO DE CARGOS Y ABONOS</th></tr>
      <tr><th>BUSQUEDA</th></tr>
      <tr>
        <td><input type="submit" name="Submit" value="Buscar" class="original"/>
          <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>CATALOGO DE CARGOS Y ABONOS</th></tr>
      <tr>
        <td><div align="center">
          <input name="tbus2" type="text" onBlur="may(this)" size="50"
		<?php

			if(isset($_POST['tbus'])){ 
				echo 'value="' . $_POST['tbus'] .  '"';
			}
		?>
		/>
        </div></td>
      </tr>   
    </table>
  </form>
</div>
<!--</div>-->
<form name="frm1" method="post" action="" >
<body>
<div align="center">
<?php
 
	$sql = mysqli_query($con ,"SELECT * FROM valeryus09 ORDER BY descripcion");
       
	include("DE10000.php");
	?>
	
	<table width="832" border='1' bordercolor=" " bordercolordark=" ">
      <tr> <th colspan="9"> <div align="center"> 
           <input type="button" name="bot2" value="Agregar" onClick="openpage('cat_cargos_AG.php','_self')" class="bot_WsW"/>
            <input type="button" name="bot2" value="Modificar" onClick="openpage('cat_cargos_MO.php','_self')" class="bot_WsW"/>
          <input type="button" name="bot1" value="Eliminar" onClick="openpage('cat_cargos_EL.php','_self')" class="bot_RjR"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('cat_cargos_IM.php','_self')" class="original"/>
        </div> </th></tr>
      </table>
	  
	  <table width="832" border='1' bordercolor=" " bordercolordark=" ">
	  <tr>
      <th width="30"><div align="center">SEL</div></th>
      <th width="68"><div align="center">CODIGO</div></th>
	  <th width="115"><div align="center">DESCRIPCION</div></th>
	  <th width="77"><div align="center">TIPO DE CODIGO</div></th>
	  <th width="105"><div align="center">FORMA DE PAGO</div></th>
	  <th width="93">GRAVABLE</th>
	  <th width="118">NO GRAVABLE </th>
	  <th width="57">ISH</th>
	  <th width="111"><div align="center">PUNTO DE VENTA </div></th>
    </tr>
	
	 <?php

         $vart=(isset($_POST['tbus']))?$_POST['tbus']:"";
	echo '<input name="txt_bus" type="hidden" value="'.$vart.'">';
       $vars=(isset($_POST['submit']))?$_POST['submit']:"";
        if($vars=="")
           
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM valeryus09 WHERE descripcion like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td width="30"> <div align="center"><input name="bot" type="radio" value="'. $reg["n_reg"].'"></div></td>';
		echo "<td width='68'> <div align='center' style=' '><h5>" . $reg["pclave"] . "&nbsp;</h5></div></td>";
		echo "<td width='115'> <div align='center' style=' '><h5>" . $reg["descripcion"] . "&nbsp;</h5></div></td>";
		echo "<td width='77'> <div align='center' style=' '><h5>" . $reg["pmontomax"] . "&nbsp;</h5></div></td>";
		echo "<td width='105'> <div align='center' style=' '><h5>" . $reg["ppago"] . "&nbsp;</h5></div></td>";
		echo "<td width='93'> <div align='center' style=' '><h5>" . $reg["gra"] . "&nbsp;</h5></div></td>";
		echo "<td width='118'> <div align='center' style=' '><h5>" . $reg["no_gra"] . "&nbsp;</h5></div></td>";
		echo "<td width='57'> <div align='center' style=' '><h5>" . $reg["impuesto"] . "&nbsp;</h5></div></td>";
		if ($reg["restringido"] == 'SI'){
		echo "<td width='111'> <div align='center' style=' '><h5>PUNTO DE VENTA</h5></div></td>";
		}if ($reg["mini"] == 'SI'){
		echo "<td width='111'> <div align='center' style=' '><h5>MINI-BAR</h5></div></td>";
		}if ($reg["boutique"] == 'SI'){
		echo "<td width='111'> <div align='center' style=' '><h5>BOUTIQUE</h5></div></td>";
		}if ($reg["spa"] == 'SI'){
		echo "<td width='111'> <div align='center' style=' '><h5>SPA</h5></div></td>";
		}
		echo "</tr>";
	}
	mysqli_close($con);
	?>
  </table>
  
</div>
</body>
</form>
</body>
</html>