<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");

include("DFJSISCI.inc");
?>
<html>
<head>

<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<?php

require_once("DFJQUERY.inc");
?>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">
$(document).ready(function(){
	$("#tbus").autocomplete('CXC10500_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("CXC10500_AG.php?tap2="+$(this).val(),'_self');
		//else if(confirm("Articulo:'" +row[0]+"'\nDesea Consultar/Modificar?"))
			openpage("CXC10500_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;
	});	

});

function busca(){
	getOnLayer({
			action:'CXC10500_PR-SRV.php',
			idLayer:'regBus'
		},{
			tbus:ge('tbus').value
	});
}

</script>
 
</head>
<body onLoad = "self.focus (); document.form1.tbus2.focus ()">

<div align="center">
  <form name="form1" method="post" action="">
    <p>&nbsp;</p>
    <table  align="center">
      
	  <tr>
        <th colspan="2">MOVIMIENTOS CUENTAS POR PAGAR.</th>
      </tr>
      
      <tr>
        <th>BUSQUEDA.          </th>
      </tr>
    
      <tr>
        <td colspan="2"><input type="submit" name="Submit" value="Buscar" />
        <input name="tbus" type="text" onBlur="may(this)" size="30"/></td>
      </tr>
      <tr>
        <th colspan="2">MOVIMIENTOS CUENTAS POR PAGAR.</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>
<div align="center">
<form name="frm1" id="frm1" method="post" action=""
<?php
 
	$sql = mysqli_query($con ,"SELECT * FROM mov_cxp ORDER BY n_reg");
	include("DE10000.php");
	?>
>
<table width="566" border='1'>
      <tr>
        <th colspan="13"> <div align="center">
          <input type="Submit" name="bot3" value="Consultar"  onClick="openpage('CXC10500_CO.php','_self')"/>
          <input type="button" name="bot2" value="Modificar" onClick="openpage('CXC10500_MO.php','_self')"/>
          <input type="button" name="bot1" value="Eliminar" onClick="openpage('CXC10500_EL.php','_self')"/>
          <input type="button" name="bot4" value="Imprimir " onClick="openpage('CXC10500_IM.php','_self')"/>
        </div></th>
      </tr>
      <tr>
        <th width="24"  nowrap><div align="center">SEL.</div></th>
        <th width="52"  nowrap><div align="center">CODIGO.</div></th>
		<th width="198" nowrap><div align="center">PROVEEDOR.</div></th>
		<th width="84" nowrap><div align="center">TIPO DE MOV.</div></th>
		<th width="105" nowrap><div align="center">NUM. DE CHEQUE.</div></th>
		<th width="63" nowrap><div align="center">ABONO.</div></th>
	  </tr>
	  <?php

	echo '<input name="txt_bus" type="hidden" value="'.$_POST['tbus'].'">';
	if($_POST['r1']=="")
	{
		echo '<input name="tip_bus" type="hidden" value="nombre">';
		@$sql = mysqli_query($con ,"SELECT * FROM mov_cxp WHERE pdescrip like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg["n_reg"].'"></div></td>';
		echo "<td> <div align='center'>" . $reg["n_reg"] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg["proveedor"] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg["movimiento"] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg["cheque"] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg["importe"] . "&nbsp;</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);
	?>
    </table>
  </form>
</div>
</body>
</html>