<?php

require_once ("../../config/Cado.php");

require_once ("../catalogo/cCatalogo.php");

$oCatalogo = new cCatalogo();



require_once ("../categoria/cCategoria.php");

$oCategoria = new cCategoria();



require_once("../precioventa/cPrecioventa.php");

$oPrecioventa = new cPrecioventa();



require_once ("../formatos/formato.php");





$nom = $_POST['txt_fil_pro_nom'];

$codbar = $_POST['txt_fil_pro_codbar'];

$cat_id = $_POST['cmb_fil_cat_id'];

$mar_id = $_POST['cmb_fil_mar_id'];

$alm_id = $_POST['cmb_fil_alm_id'];

$condicion = $_POST['cmb_fil_condicion'];

if($alm_id>0)

{		              

	$dts1=$oCatalogo->catalogo_stock_check($nom,$codbar,$cat_id,$mar_id,$alm_id,$condicion);

	$num_rows= mysql_num_rows($dts1);

}

else

{

	$num_rows=0;

}



?>



<section class="content" id="table" style="min-height:0px;padding-bottom:0px;margin-bottom:-30px;">

	<div class="row">

		<div class="col-xs-12">

			<div class="box">

				<div class="box-body">

					<table id="tabla_producto" class="table table-bordered table-striped">

						<thead>

							<tr>

								<th>CODIGO</th>

								<th>NOMBRE</th>

								<th>MARCA</th>

								<th>CATEGORIA</th>  

								<th class="stockx">UNIDAD</th>                  

								<th align="right" nowrap>STOCK. MIN</th>

								<th  align="right" nowrap>STOCK. MAY</th>

								<th  align="right">STOCK ACTUAL</th>

							</tr>

						</thead>

						<tbody>

							<?php

							if($num_rows>=1){

								while($dt1 = mysql_fetch_array($dts1)){

									$stock=$dt1['tb_stock_num'];

									?>

									<tr>

										<td><?php echo $dt1['tb_presentacion_codbar']?></td>

										<td>

											<span style="">

												<?php echo $dt1['tb_producto_nom']?>

											</span>

										</td>

										<td><?php echo $dt1['tb_marca_nom']?></td>

										<td><?php echo $dt1['tb_categoria_nom']?></td>

										<td><?php echo $dt1['tb_unidad_nom']?></td>

										<td align="right"><?php echo $dt1['tb_presentacion_stomin']?></td>

										<td align="right"><?php echo $dt1['tb_presentacion_stomax']?></td>

										<td align="right"><?php echo $stock ?></td> 



									</tr>

									<?php

								}

								mysql_free_result($dts1);

							}



							?>

						</tbody>  

					</table>

				</div>

			</div>

		</div>

	</div>

</section>



<script type="text/javascript">

	$(function() {  

		$("#tabla_producto").DataTable( {

			"columnDefs": [

			{ "orderable": false, "targets": [1] }

			],

			"searching": false,

			"order":[[0,"asc"]]

		});

	}); 

</script> 