<style type="text/css">
select{
	cursor:pointer;
}
</style>
<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Gestion de datos por stock
			<small>modulo</small>
			</h1>
		</div>	
		
		<div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item" >Almacen</li>
				<li class="breadcrumb-item active">Gestion de datos por stock</li>
            </ol>
          </div>
		</div>
	</div>
</div>
<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:0px;" >
		    <div class="card">
		        <div class="card-header">
		          <button id="btn_actualizar" class="btn btn-default">Actualizar</button>		        
		        </div>
		    </div>
		</div>
	</div>
	</div>
</section>
	<!-- busqueda de registros -->
	<div id="div_inventarioinicial_filtro"></div>
	<!-- listado de registros -->
	<div id="div_inventarioinicial_tabla"></div>
	
<script type="text/javascript">
	function gestionxstock_filtro()
	{
		$.ajax({
			type: "POST",
			url: "../gestionxstock/gestionxstock_filtro.php",
			async:true,
			dataType: "html",                      
		data: ({
		}),
		beforeSend: function() {
			var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
				$('#div_inventarioinicial_filtro').html(div);
		},
		success: function(html){
			$('#div_inventarioinicial_filtro').html(html);
		},
		complete: function(){
		}
	});
	}
	function gestionxstock_tabla()
	{
		$.ajax({
			type: "POST",
			url: "../gestionxstock/gestionxstock_tabla.php",
			async:true,
			dataType: "html", 
			data: $("#for_fil_pro").serialize(),                    
			beforeSend: function() {		
				$('#div_inventarioinicial_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_inventarioinicial_tabla').html(html);
			},
			complete: function(){			
				$('#div_inventarioinicial_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	
	function agregar_dato(act,catid,marid,fecven,preven)
	{
		$.ajax({
			type: "POST",
			url: "../gestionxstock/gestionxstock_reg.php",
			async:true,
			dataType: "json", 
			data: ({
				action : act,
				catid : catid,
				marid : marid,
				fecven : fecven,
				preven : preven
			}),                    
			beforeSend: function() {		
				
			},
			success: function(data){
				toastr["info"](data.msj);
			},
			complete: function(){			
				gestionxstock_tabla();
			}
		});     
	}
$(function() {
	
	$('#btn_actualizar').click(function() {
		$("#contenido").load("../gestionxstock/gestionxstock_vista.php");
	});
	 
	gestionxstock_filtro();	
	setTitle("GESTION DE DATOS POR STOCK - "+nombreEmpresa);	
	
});
</script>