<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DFJSISCI.inc");
include ("varfun.php");
?>
<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('CXC10600_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("CXC10600_AG.php?tap2="+$(this).val(),'_self');
		//else if(confirm("Articulo:'" +row[0]+"'\nDesea Consultar/Modificar?"))
			//openpage("CXC10600_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:'CXC10600_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="">
    <table  align="center">
              <th colspan="2">              FACTURAS POR PROVEEDOR. </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">AGREGAR FACTURA  .</th>
      </tr>
      <tr>
        <td colspan="2"><div align="center">
          <input name="det_inv" type="button" id="det_inv" value="Agregar" onClick="openpage('CXC10600_AG.php','_self')">
           <input name="det_inv2" type="button" id="det_inv2" value="Agregar Conceptos" onClick="openpage('CXC10600_AG-DET.php','_self')">
        </div></td>
      </tr>   
    </table>
  </form>
</div>
<div align="center">
<form name="frm1" id="frm1" method="post" action=""
<?php

 
	$sql = mysqli_query($con ,"SELECT * FROM faqturacion");
	include("DE10000.php");
	?>
/>
<table width="345" border='1'>
      <tr>
        <th width="21"  nowrap><div align="center">SEL</div></th>
        <th width="43"  nowrap><div align="left">FOLIO. </div></th>
        <th width="148"  nowrap><div align="center">PROVEEDOR.</div></th>
	    <th width="105"  nowrap><div align="center">TOTAL CARGO.</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 faqturacion WHERE pdescrip like '%".$_POST['tbus']."%'");
	}
	while($reg = mysqli_fetch_array($sql))
	{
	  	echo "<tr>";
		echo '<td> <div align="center" style="background-color:'.$reg["almacen"].';"><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["pdescrip"] .' '. $reg["fapellido"] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg["total"] . "&nbsp;</div></td>";
		echo "</tr>";
	}
	mysqli_close($con);
	?>
  </table>
  </form>
</div>
</body>
</html>