<?php require "php/cabecera3.inc";
	echo "<INPUT TYPE='HIDDEN' ID='IDSX' VALUE='$IDS'>";
?>
<script type="text/javascript" src="jt/jquery.js"></script>
<script language="javascript" src="jt/shCore.js"></script>
<script type="text/javascript" src="jt/table.js"></script>
<br><br>
<table class="columns" cellspacing="0" border="0">
<td class="left" rowspan="2">
<table id="t1" class="example table-autosort table-autofilter table-autopage:<?php echo $st['PAGINACION']?> table-stripeclass:alternate table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount" style="border:none;width:100%;table-layout:fixed;margin:auto;">
<thead>
	<tr style='background-image:none;background-color:#fff;'><td><FORM ACTION="tab.php" METHOD='GET'><input type='hidden' name='IDS' value='<?php echo $_GET['IDS']?>'><input type='text' name="BSQ" autofocus value='<?php echo $_GET['BSQ'];?>' placeholder="Nombre,descripción,sku..."/></td><td colspan="5"><input type='submit' class='btn' value='Buscar' style='margin-left:10px;'></FORM>
		<?php if(isset($_GET['BSQ'])){echo "<a href='tab.php?IDS=$_GET[IDS]'><button class='btn'>Ver todo</button></a>";}?>
		</td></tr>
	<tr>
		<th class="table-sortable:default">SKU</th>
		<th class="table-sortable:default">Descripci&oacuten</th>
		<th class="table-sortable:default">Detalles</th>
		<th class="table-filterable table-sortable:default">Categor&iacutea</th>
		<th class="table-sortable:currency">Costo</th>
		<th class="table-sortable:numeric">Disponibilidad</th>
	</tr>
	</thead>
<tbody>
<?php
	if(!isset($_GET['BSQ'])){$consulta= "SELECT ID,IMAGEN,DESCRIPCION,LEYENDA,SKU,COSTOECOM,FAMILIA FROM tabla_altaproducto WHERE CUENTA='$_GET[IDS]'";}
	else
	{$consulta="SELECT * FROM tabla_altaproducto WHERE CUENTA='$_GET[IDS]' AND (SKU LIKE '%$_GET[BSQ]%' OR DESCRIPCION LIKE '%$_GET[BSQ]%' OR FAMILIA LIKE '%$_GET[BSQ]%' OR LEYENDA LIKE '%$_GET[BSQ]%')";}
	$resultado = mysqli_query($conexion, $consulta);
	if(mysqli_num_rows($resultado)==0 AND $_GET['BSQ']!=NULL){echo "<tr><td colspan='6' style='text-align:center'>No se encontraron resultados para \"$_GET[BSQ]\".</td></tr>";}
	while($fila = mysqli_fetch_array($resultado)){
		if($fila['IMAGEN']==NULL){$IMG='photo/Default.png';}else{$IMG="photo/$fila[IMAGEN]";}
			echo "<tr><td>$fila[SKU]</td><td>$fila[DESCRIPCION]</td><td style='text-align:center;'><SPAN class='tooltip'><a href='$IMG' target='_blank'><img height='30px' src='$IMG'></a><span><strong>$fila[DESCRIPCION]<br></strong><br>$fila[LEYENDA]<br><br><center><img WIDTH='190PX' src='$IMG'/></center></span></SPAN></td><td>$fila[FAMILIA]</td><td style='text-align:center;'>$ $fila[COSTOECOM]</td><td style='text-align:center;'><div id='cargador-$fila[ID]'><button class='botonadd' onclick=\"carga_dispo('".(($fila['ID']))."')\">...</button></div></td></tr>";
			}
?>
</tbody>
<tfoot>
	<tr>
		<td class="table-page:previous" style="cursor:pointer;"><img src="<?php echo "img/".$st['C-ICON']."/fiz.png";?>"> Anterior</td>
		<td colspan="4" style="text-align:center;"><span id="t1page"></span>/<span id="t1pages"></span></td>
		<td class="table-page:next" style="cursor:pointer; text-align:right">Siguiente <img src="<?php echo "img/".$st['C-ICON']."/fde.png";?>"></td>
</tr>
<!--<tr><td colspan="6">Mostrando <span id="t1filtercount"></span>&nbsp;de <span id="t1allcount"></span>&nbsp;articulos</td></tr>!-->
</tfoot>
</table>

<?php require "php/pie.inc" ?>