<?php
date_default_timezone_set('America/Lima');
session_start();
if($_SESSION["sistema"]!= "1"){ header("location: ../login/index.php"); exit();}


require_once ("../../config/Cado.php");
	
require_once ("../usuario/cUsuarioprograma.php");
$oUsuarioprograma = new cUsuarioprograma();

$dts=$oUsuarioprograma->mostrar_uno($_SESSION['usuario_id'],'22');
$numrows = mysqli_num_rows($dts);
if($numrows>0){
	$bangestion_precio = true;
}else{
	$bangestion_precio = false;
}


if($bangestion_precio==true){

?>

<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Gestion de precios
			<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 precios</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>
	
	
	
	
	
	
	
	
	
	
	
			<div class="modal " id="div_mensaje_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-md"  role="document" >
			<div class="modal-content" style="padding:0px;">
			<div class="modal-body div_mensaje"  >
			
		
			
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>		
			
	<!-- Filter content -->
	<div id="div_preciogestion_filtro"></div>
	<!-- Table content -->
	<div id="div_preciogestion_tabla"></div>
	<!-- Form content -->
<script type="text/javascript">

	function preciogestion_filtro()
	{
		$.ajax({
			type: "POST",
			url: "../preciogestion/preciogestion_filtro.php",
			async:true,
			dataType: "html",                      
		//data: ({
			//producto: $('#txt_fil_pro').val()
		//}),
		beforeSend: function() {
			var divmen = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
			$('#div_preciogestion_filtro').html(divmen);
		},
		success: function(html){
			$('#div_preciogestion_filtro').html(html);
		},
		complete: function(){
		
		}
	});
	}
	
	
	function preciogestion_tabla()
	{
$('#div_mensaje_dialog').modal('show');
	
	$.ajax({
		type: "POST",
		url: "../preciogestion/preciogestion_tabla.php",
		async:true,
		dataType: "html",                      
		data: $("#for_fil_pro").serialize(),
		beforeSend: function() {
			var divmen = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
			$('.div_mensaje').html(divmen);
			$('#div_preciogestion_tabla').addClass("ui-state-disabled");
        },
		success: function(html){
			$('#div_preciogestion_tabla').html(html);
		},
		complete: function(){			
			$('#div_preciogestion_tabla').removeClass("ui-state-disabled");
			$('#div_mensaje_dialog').modal('hide');
		}/*,error: function(a){
			console.log(a);
		}*/
	});    
	}
$(function() {
	
	 $('#btn_actualizar').click(function() {
			$("#contenido").load("../preciogestion/preciogestion_vista.php");
		});
		preciogestion_filtro();	
		setTitle("GESTION DE PRECIOS - "+nombreEmpresa);	
	 
	
});
</script>




<?php }else{
?>	
	<br/>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-12" style="padding:0px;">
		    <div class="card">
		        <div class="card-header">
				<center>
					<span style="font-size:1.5rem;font-family:arial;" >Usted no tiene permisos para ver esta pantalla.</span>
		        </center>
				</div>
		    </div>
		</div>
	</div>
	</div>
</section>


	
<?php	
}?>







