<script type="text/javascript">

	$('#btn_filtrar').button({

		icons: {primary: "ui-icon-search"},

		text: false

	});

	$('#btn_resfil').button({

		icons: {primary: "ui-icon-arrowrefresh-1-w"},

		text: false

	});

	

	function cmb_fil_cat_id()

	{	

		$.ajax({

			type: "POST",

			url: "../categoria/cmb_cat_id.php",

			async:true,

			dataType: "html",                      

			data: ({

			//cat_id: "<?php //echo $cat_id?>"

		}),

			beforeSend: function() {

				$('#cmb_fil_cat_id').html('<option value="">Cargando...</option>');

			},

			success: function(html){

				$('#cmb_fil_cat_id').html(html);

			}

		});

	}

	function cmb_fil_mar_id()

	{	

		$.ajax({

			type: "POST",

			url: "../marca/cmb_mar_id.php",

			async:true,

			dataType: "html",                      

			data: ({

			//cat_id: "<?php //echo $cat_id?>"

		}),

			beforeSend: function() {

				$('#cmb_fil_mar_id').html('<option value="">Cargando...</option>');

			},

			success: function(html){

				$('#cmb_fil_mar_id').html(html);

			}

		});

	}

	function cmb_fil_alm_id()

	{	

		$.ajax({

			type: "POST",

			url: "../almacen/cmb_alm_id.php",

			async:false,

			dataType: "html",                      

			data: ({

				alm_id: '<?php echo $alm_id?>'

			}),

			beforeSend: function() {

			//$('#cmb_fil_pro_alm').html('<option value="">Cargando...</option>');

		},

		success: function(html){

			$('#cmb_fil_alm_id').html(html);

			$('#cmb_fil_alm_id').val(1);

		},

		complete: function(){

		}

	});

	}



	function cmb_fil_pro_alm()

	{	

		$.ajax({

			type: "POST",

			url: "../almacen/cmb_alm_id.php",

			async:false,

			dataType: "html",                      

			data: ({

				alm_id: '<?php echo $alm_id?>'

			}),

			beforeSend: function() {

				$('#cmb_fil_pro_alm').html('<option value="">Cargando...</option>');

			},

			success: function(html){

				$('#cmb_fil_pro_alm').html(html);

			},

			complete: function(){

			}

		});

	}



	$(function() {		

		cmb_fil_cat_id();

		cmb_fil_mar_id();

		cmb_fil_alm_id();

		stockgeneral_tabla();

		$("#txt_fil_pro_codbar").focus();

		$( "#txt_fil_pro_nom" ).autocomplete({

			minLength: 1,

			source: "../producto/producto_complete_nom.php",

			select: function() {

				stockgeneral_tabla();

			}

		});

		$( "#txt_fil_pro_nom" ).keydown(function(e){

			if(e.which==13)

			{

				stockgeneral_tabla();

				e.preventDefault();

			}

		});



		$( "#chk_fil_stockvacio" ).click(function(event) {

			stockgeneral_tabla();

		});





		

		$("#txt_fil_pro_codbar").keydown(function(e)

		{

			if(e.which==13)

			{

				$("#txt_fil_pro_nom").val('');				

				stockgeneral_tabla();

				$(this).val('');

			//$(this).focus();

			e.preventDefault();

		}

	});



		$('#cmb_fil_cat_id, #cmb_fil_mar_id,#cmb_fil_alm_id').change(function(){

			stockgeneral_tabla();

		});

	});

</script>



<section class="content" id="filter" 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">

					<div class="row">

                        <form id="for_fil_pro" method="POST">

                         <div class="col-lg-2 col-xs-6">

                            <label>Código de Barras:</label>

							<input name="txt_fil_pro_codbar" type="text" id="txt_fil_pro_codbar" class="form-control">

					    </div>

                        <div class="col-lg-3 col-xs-6">

							<label>Nombre:</label>

							<input name="txt_fil_pro_nom" type="text" id="txt_fil_pro_nom" class="form-control">

						</div>	

                        <div class="col-lg-2 col-xs-6">

							<label>Categoría:</label>

							<select name="cmb_fil_cat_id" id="cmb_fil_cat_id" class="form-control">

							</select>

                        </div>	

                        <div class="col-lg-2 col-xs-6">

							<label>Marca:</label>

							<select name="cmb_fil_mar_id" id="cmb_fil_mar_id" class="form-control"></select>

							

						</div>

                        <div class="col-lg-2 col-xs-6" style="padding-top: 23px;">

							<button  onClick="stockgeneral_tabla()"  class="btn btn-primary">Filtrar</button>

							<button  onClick="stockgeneral_filtro()" class="btn btn-default">Restablecer</button>

                        </div>

                        	</form>

	                   </div>

				

				</div>

			</div>

		</div>

	</div>

</section>

