<?php

//ini_set('display_errors',1);

session_start();
 if($_SESSION['usuariogrupo_id']==1 || $_SESSION['usuariogrupo_id']==2){
		
}
else{ 
 	
	$punven_id = $_SESSION['puntoventa_id'];
}

date_default_timezone_set('America/Lima');
$hora = 17; //date('G');
require_once ("../formatos/formato.php");
require_once ("../formatos/fechas.php");
require_once ("../../config/Cado.php");
require_once ("../empresa/cEmpresa.php");
$oEmpresa = new cEmpresa();
require_once ("../venta/cVenta.php");
$oVenta = new cVenta();
require_once ("../compra/cCompra.php");
$oCompra = new cCompra();
require_once ("../notacredito/cNotacredito.php");
$oNotacredito = new cNotacredito();
require_once ("../guiaremision/cGuiaremision.php");
$oGuiaremision = new cGuiaremision();
require_once ("../cliente/cCliente.php");
$oCliente = new cCliente();
require_once ("../producto/cProducto.php");
$oProducto = new cProducto();
require_once ("../serviciopago/cServiciopago.php");
$oServiciopago = new cServiciopago();
require_once ("../configuracion/cConfiguracion.php");
$oConfiguracion = new cConfiguracion();
require_once ("../usuario/cUsuarioprograma.php");
$oUsuarioprograma = new cUsuarioprograma();

$y=date('Y');
$m=date('m');
$d=date('d');




////MODULO VENTAS ///
$dts=$oUsuarioprograma->mostrar_uno($_SESSION['usuario_id'],'61');
$numrows = mysqli_num_rows($dts);
if($numrows>0){
	$banCanchapos = true;
}else{
	$banCanchapos = false;
}






	$dts=$oVenta->mostrarcantXMes('1','01','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_ene=$dt['canttot'];
	mysqli_free_result($dts);
	
	
	$dts=$oVenta->mostrarcantXMes('1','02','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_feb=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','03','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_mar=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','04','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_abr=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','05','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_may=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','06','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_jun=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','07','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_jul=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','08','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_ago=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','09','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_sep=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','10','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_oct=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','11','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_nov=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oVenta->mostrarcantXMes('1','12','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_dic=$dt['canttot'];
	mysqli_free_result($dts);
	$dts=$oCompra->mostrarcantXMes('1','01','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_ene_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	
	$dts=$oCompra->mostrarcantXMes('1','02','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_feb_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','03','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_mar_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','04','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_abr_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','05','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_may_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','06','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_jun_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','07','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_jul_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','08','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_ago_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','09','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_sep_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','10','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_oct_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','11','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_nov_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	$dts=$oCompra->mostrarcantXMes('1','12','1');
	$dt = mysqli_fetch_array($dts);
	$cant_mes_dic_com=$dt['canttot'];
	mysqli_free_result($dts);
	
	
	
$fecha = date('Y-m-d'); 
$dtscli = $oCliente->filtrar('','');
$cancli = mysqli_num_rows($dtscli);

$dtsprod = $oProducto->mostrar_filtro_panel();
$totprod = mysqli_num_rows($dtsprod);
///////
//$dia = 15;
//$d = 1;
//echo '----------'.$hora;

$dtsc=$oConfiguracion->mostrarUno('1');
$dtcon = mysqli_fetch_array($dtsc);
$diaven=$dtcon['tb_configuracion_diaven'];
$tipdis=$dtcon['tb_configuracion_tipdis'];
mysqli_free_result($dtsc);

$fecha_hoy = $diaven.'-'.$m.'-'.$y;
list($day,$mon,$year) = explode('-',$fecha_hoy);
$fecha2dias=date('d-m-Y',mktime(0,0,0,$mon,$day+2,$year));
	
list($day,$mon,$year) = explode('-',$fecha_hoy);
$d2=date('d',mktime(0,0,0,$mon,$day+5,$year));


if($d>=$diaven && $d<=$d2){
$dtspagos = $oServiciopago->versi_pago(fecha_mysql($fecha_hoy),fecha_mysql($fecha2dias));
$rowspago = mysqli_num_rows($dtspagos);

if($rowspago>0){
	
$dias = 'info';	
}else
{
$fecha1=mktime(0,0,0,$m,$d,$y);
$fecha2=mktime(0,0,0,$m,$diaven,$y);
$diferencia=$fecha2-$fecha1;
$dias=$diferencia/(60*60*24);

if($d == $diaven){
	$dias='0';
}
}
}else{
	$dias = 'info';	
}


//echo '-----------------------------------------'.$dias;
$fecha_hoy = date('d-m-Y'); 
list($day,$mon,$year) = explode('-',$fecha_hoy);
$fecha_seis=date('d-m-Y',mktime(0,0,0,$mon,$day-6,$year)); 
$rs1 = $oVenta->ventas_asunat(fecha_mysql($fecha_seis),fecha_mysql($fecha_hoy));
$numrowvensunat = mysqli_num_rows($rs1);
$rs2 = $oNotacredito->notacredito_asunat(fecha_mysql($fecha_seis),fecha_mysql($fecha_hoy));
$numrownotcresunat = mysqli_num_rows($rs2);
$rs3 = $oGuiaremision->guia_asunat(fecha_mysql($fecha_seis),fecha_mysql($fecha_hoy));
$numrowguiasunat = mysqli_num_rows($rs3);
?>
<?php if($banCanchapos==true){ ?>

<div class="col-lg-12 col-sm-12 col-xs-12" style="height: 3px;"></div>
 
	<div class="container-fluid">
	<div class="row">
		<div class="col-lg-12 col-sm-12 col-xs-12" id="contenedor_base_canchapos" ></div>
		<div class="col-lg-12 col-sm-12 col-xs-12" id="contenedor_base_venta" ></div>
	</div>
	</div>
	
<?php } ?>
  
   <?php if($banCanchapos==false){ ?>
   
   
  <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h5 class="m-2">Escritorio
			<small>Panel de Control</small>
			<?php echo ' | '.fechaActual(1); ?></h5>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item active">Escritorio</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
  </div>
  
  
<div class="col-lg-12 col-sm-12 col-xs-12" style="height: 2px;"></div>
<div class="row">
<?php if($numrowvensunat>0){?>
<div class="col-lg-6 col-sm-6 col-xs-12" >
<div class="alert alert-dismissable" style="background-color:#CC0000;color:#fff;">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <strong>¡Cuidado!</strong> Tienes FACTURAS/BOLETAS de los ultimos 7 dias, en <a target="_blank" href="?app=venta"> ventas </a> por enviar a sunat.
</div>
</div>
<?php }?>
<?php if($numrownotcresunat>0){?>
<div class="col-lg-6 col-sm-6 col-xs-12" >
<div class="alert alert-dismissable" style="background-color:#3F729B;color:#fff;">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <strong>¡Cuidado!</strong> Tienes DOCUMENTOS de los ultimos 7 dias, en <a target="_blank" href="?app=notacredito"> notas de credito </a> por enviar a sunat.
</div>
</div>
<?php }?>
<?php if($numrowguiasunat>0){?>
<div class="col-lg-6 col-sm-6 col-xs-12" >
<div class="alert alert-dismissable" style="background-color:#ef6c00;color:#fff;">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <strong>¡Cuidado!</strong> Tienes DOCUMENTOS de los ultimos 7 dias, en <a target="_blank" href="?app=guiaremision"> guias de remision </a> por enviar a sunat.
</div>
</div>
<?php }?>
 
 </div>
 

<section class="content">
   
	<div class="container-fluid">
		
	<div class="row">
	
	<div class="col-lg-12 col-sm-12 col-xs-12">
		<small id="msj_escritorio" class="ui-state-highlight ui-corner-all" style="width:auto; float:right; padding:2px; display:none"></small>	
	</div>
	
	
	
	<div class="col-lg-12 col-sm-12 col-xs-12 "  >
	<div class="row">
	<div class="col-lg-8 col-sm-8 col-xs-12" >
	<div class="row">
		
		
	<?php if($_SESSION['usuariogrupo_id']==6){
	?>		
   
   
		  
		  <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=venta">
			<div class="info-box">
              <span class="info-box-icon bg-success elevation-1"><i class="fas fa-cart-plus"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">VENTAS</span>
                <span class="info-box-number">     
                  <small>Menú/Ventas</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		    
		   <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=kardex">
			<div class="info-box">
              <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-shopping-basket"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">KARDEX</span>
                <span class="info-box-number">     
                  <small>Menú/Almacen</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		  	 <div class="col-md-3 col-sm-6 col-12">
		   <a href="?app=kardex">
            <div class="info-box bg-gradient-success">
              <span class="info-box-icon"><i class="fas fa-user"></i></span>
              <div class="info-box-content">
                <span class="info-box-text">Menú/Cliente</span>
                <span class="info-box-number">CLIENTES</span>
              </div>            
            </div>
			</a>
          </div>
	
	
	<?php 	
	}else if ($_SESSION['usuariogrupo_id']=='4'){
	?>
	
	<?php 	
	}else{
	?>
				 
		 
		  
		  
		  <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=compra">
			<div class="info-box">
              <span class="info-box-icon bg-info elevation-1"><i class="fas fa-shopping-cart"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">COMPRAS</span>
                <span class="info-box-number">     
                  <small>Menú/Compras</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		  <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=venta">
			<div class="info-box">
              <span class="info-box-icon bg-success elevation-1"><i class="fas fa-cart-plus"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">VENTAS</span>
                <span class="info-box-number">     
                  <small>Menú/Ventas</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		  
		
		 <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=notalmacen">
			<div class="info-box">
              <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-cart-plus"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">NT. ALMACEN</span>
                <span class="info-box-number">     
                  <small>Menú/Almacen</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		   <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=kardex">
			<div class="info-box">
              <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-shopping-basket"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">KARDEX</span>
                <span class="info-box-number">     
                  <small>Menú/Almacen</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		  
		  
			<div class="col-12 col-sm-6 col-md-4">
            <a href="?app=producto">
			<div class="info-box">
              <span class="info-box-icon bg-gray elevation-1"><i class="fas fa-dolly-flatbed"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">PRODUCTO</span>
                <span class="info-box-number">     
                  <small>Menú/Mant. Int.</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
		  
		  <div class="col-12 col-sm-6 col-md-4">
            <a href="?app=flujocaja">
			<div class="info-box">
              <span class="info-box-icon bg-info elevation-1"><i class="fab fa-cc-diners-club"></i></span>

              <div class="info-box-content">
				 <span class="info-box-text">CAJA</span>
                <span class="info-box-number">     
                  <small>Menú/Caja</small>
                </span>
				
              </div>  
            </div>
			</a>
          </div>
		  
	
	
	<?php }?>
		<div id="container_reporte_soles" class="col-lg-12 col-sm-12 col-xs-12" style="height:400px;" >
		</div>
	</div>
</div>
	<div class="col-lg-4 col-sm-4 col-xs-12 ">
	<div class="col-lg-12 col-sm-12 col-xs-12 bg-white" >
	
	<div class="col-lg-12  col-sm-12 col-xs-12">				
		<label for="cmb_fil_puntoventa_id">Punto Venta:</label>
		<select name="cmb_fil_puntoventa_id" id="cmb_fil_puntoventa_id" class="form-control "></select>
	</div>
	
	<div class="col-lg-12 col-sm-12 col-xs-12" style="height:10px;"></div>
	
		<div class="col-lg-12 col-sm-12 col-xs-12 no-padding"  id="div_inforapida">
		
		</div>
		
		<div class="col-md-12 col-sm-12 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-yellow"><i class="fas fa-chalkboard-teacher"></i></span>
            <div class="info-box-content">
              <span class="info-box-text">Total Clientes</span>
              <span style="font-size:3rem;" class="info-box-number"><?php echo $cancli; ?></span>
            </div>
           
          </div>
         
        </div>
		
		<div class="col-md-12 col-sm-12 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-blue"><i class="fas fa-box-open"></i></span>
            <div class="info-box-content">
              <span class="info-box-text">Total Productos</span>
              <span style="font-size:3rem;" class="info-box-number"><?php echo $totprod; ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
		
		
</div>
</div>
	
	
	
	<?php 
	 if ($_SESSION['usuariogrupo_id']=='6'){}else{
	 ?>
	<div class="col-lg-12 col-sm-12 col-xs-12" style="height:5px;" > </div>
	
	<div class="col-lg-12 col-sm-12 col-xs-12"  > 
		<span class="btn btn-sm btn-primary float-right" style="cursor:pointer;" onclick="cuentapagar()" >Ver cronograma de pagos</span>
	</div>
	
	
	
	<div class="col-lg-12 col-sm-12 col-xs-12" style="height:5px;" > </div>
	
	<div id="div_cuentapagar_inicio" class="col-lg-12 col-sm-12 col-xs-12" > </div>
	 <?php }?>
	</div>
	</div>
</div>

<?php } ?>
			<div class="modal fade" id="div_cuentacobrar_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg" style="width:90%;"  role="document" >
			<div class="modal-content" style="background:transparent;" >
			<div class="modal-body div_cuentacobrar_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_cuentapagar_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog" style="width:90%;"  role="document" >
			<div class="modal-content" style="background:transparent;" >
			<div class="modal-body div_cuentapagar_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
<!--MODAL PARA TOMAR PEDIDOS-->
			
			<div class="modal fade" id="div_efectuar_pedidos" role="dialog"  style="overflow-y:scroll;" >
			<div class="modal-dialog " style="width: 95% !important;" >
			<div class="modal-content">
			<div class="modal-body div_efecturar_conte" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>			
			
	<!--MODAL PARA PAGAR PEDIDOS-->
			
			<div class="modal fade" id="div_venta_form" role="dialog" style="padding:0px; overflow-y:scroll ">
			<div class="modal-dialog " style="width: 95% !important;"  >
			<div class="modal-content">
			<div class="modal-body div_venta_form_conten" style="padding:0px;"   >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
	<!--MODAL PARA CORREO ELECTRONICOS-->
			
			
			<div class="modal fade" id="div_venta_correo_form" role="dialog" data-keyboard="false" data-backdrop="static" style="padding:0px; overflow-y:scroll ">
			<div class="modal-dialog modal-lg"  >
			<div class="modal-content">
			<div class="modal-body div_venta_correo_conten" style="padding:0px;"   >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
		<!-- formulario de registro -->
			
<!-- formulario de nuevo cliente -->
			
			
			<div class="modal fade" id="div_comprapagoarchivos_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content">
			<div class="modal-body div_comprapagoarchivos_form" style="padding:0%;"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
	
		
			<div class="modal " id="div_egreso_form_dialog" role="dialog" style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content">
			<div class="modal-body div_egreso_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_egresoletra_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content ">
			<div class="modal-body div_egresoletra_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_egresofac_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content ">
			<div class="modal-body div_egresofac_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			<div class="modal fade" id="div_letra_form_dialog" role="dialog" data-keyboard="true"  data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content">
			<div class="modal-body div_letra_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
						<!-- formulario de registro -->
			<div class="modal fade" id="div_productomarca_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-xl" style=""   role="document" >

			<div class="modal-content">

			<div class="modal-body div_productomarca_form" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
		
				
			
			<!-- formulario de registros-->
			<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>		
		
		<div class="modal fade div_venta_form_dialog " id="div_venta_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;z-index:999999;">
			<div class="modal-dialog " style="width: 95% !important;" role="document" >
			<div class="modal-content">
			<div class="modal-body div_venta_form" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
	
		<!-- formulario de registro -->
			<div class="modal fade" id="div_compra_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-xl" style="width: 95% !important;"   role="document" >
			<div class="modal-content">
			<div class="modal-body div_compra_form" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			
			<div class="modal fade" id="div_canchapos_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-xl" style="width: 95% !important;"   role="document" >
			<div class="modal-content">
			<div class="modal-body div_canchapos_form" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			<div class="modal fade" id="div_canchapos_form" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-md" style="width: 95% !important;"   role="document" >
			<div class="modal-content">
			<div class="modal-body div_canchapos_form2" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
			
			<div class="modal fade" id="div_canchapos_info_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-md" style="width: 95% !important;"   role="document" >
			<div class="modal-content">
			<div class="modal-body div_canchapos_info" style="padding:0%;" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		
			
			<div class="modal fade" id="div_cliente_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px; overflow-y:scroll;">
			<div class="modal-dialog modal-lg"  role="document" >
			<div class="modal-content">
			<div class="modal-body div_cliente_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>		
			
			
			<div class="modal fade" id="div_pago_form_dialog" role="dialog"  tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-lg" style=""   role="document" >
			<div class="modal-content">
			<div class="modal-body div_pago_form"  >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
			
				<div class="modal fade" id="div_enviowhatsap_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;overflow-y:scroll;">
			<div class="modal-dialog modal-sm" style=""   role="document" >

			<div class="modal-content">

			<div class="modal-body div_enviowhatsap_form" >

			</div>
			<br />
			<br />
			</div>
			</div>
			</div> 
			
			
			
</div>
</section>
  
  
  <script type="text/javascript">
	
	
	
	function enviar_whatsap_reserva(res_id){
				
			$('#div_enviowhatsap_form_dialog').modal();
			$.ajax({
				type: "POST",
				url: "../enviowhatsap/enviowhatsapreserva_form.php",
				async:true,
				dataType: "html",                      
				data: ({
					res_id: res_id
				}),
				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_enviowhatsap_form').html(div);
				},
				success: function(html){
					$('.div_enviowhatsap_form').html(html);				
				}
			});
		}
	
	
<?php if($_SESSION['usuariogrupo_id']==6){
 }else if ($_SESSION['usuariogrupo_id']=='4'){
	 
 }else
{?>
	//cuentacobrar();
	//cuentapagar();
 <?php }?>
	// resumenventas();
	// resumencompras();
	traertipocambio();
    $('#txt_tipcam').keydown(function(e){
      if(e.which==13){
        registrartipocambio($(this).val());
        
        return false;
      }
    });
	
	

	
	
	
	<?php if($dias=='info'){
		
	}else if($dias=='0'){
	    if($hora>=17){
	?>
	
		pago_form('falta','<?php echo $dias?>');
	<?php 
	}
	} else{
	    if($hora>=17){
	?>	
		pago_form('falta','<?php echo $dias?>');
	<?php 
	    }
	}
	?>
	
	 <?php if($banventa==true){ ?>
	
	$("body").addClass('sidebar-collapse');
	
	 <?php } ?>
	 
	//venta_form_inicio();
	canchapos_form();
	//canchapos_form_calendar();
	
	
	
	
		function pago_form(act,dias){
				
			$('#div_pago_form_dialog').modal();
			$('body').css('overflow-y','hidden');
			$.ajax({
				type: "POST",
				url: "../serviciopago/serviciopago_form.php",
				async:true,
				dataType: "html",                      
				data: ({
					action: act,
					dias:dias
				}),
				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_pago_form').html(div);
				},
				success: function(html){
					$('.div_pago_form').html(html);				
				}
			});
		}
	
	
	
	
		
	function venta_form_inicio(){
		
			/* $('#div_mensaje_dialog').modal('show');
			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_mensaje').html(div); */
				
			$.ajax({
				type: "POST",
				url: "../venta/venta_form_inicio.php",
				async:true,
				dataType: "html",                      
				data: ({
					action : "insertar"
				}),
				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>";	
					//$('#contenedor_base_venta').html(div);
				},
				success: function(html){
					$('#contenedor_base_venta').html(html);				
				}
			});
		}
		
		
		
		
		function canchapos_form(){
		
			/* $('#div_mensaje_dialog').modal('show');
			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_mensaje').html(div); */
				
			$.ajax({
				type: "POST",
				url: "../canchapos/canchapos_tabla.php",
				async:true,
				dataType: "html",                      
				data: ({
					action : "insertar"
				}),
				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>";	
					//$('#contenedor_base_venta').html(div);
				},
				success: function(html){
					$('#contenedor_base_canchapos').html(html);				
				}
			});
		}
		
		
	function canchapos_form_vista(act,idf){
		
		
		
		//$('#div_canchapos_form_dialog').modal();
	
		$.ajax({
			type: "POST",
			url: "../canchapos/canchapos_calendar.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				cancha_id:	idf
			}),
			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>";	
					
				//$('#contenedor_base_venta').html(div); 
			},
			success: function(html){
				$('#contenedor_base_venta').html(html);	
			},
			complete: function(){
			}
		});
	}


		
	
		
	function compra_form(act,idf,pagar){
			$('#div_compra_form_dialog').modal();
		//$('body').css('overflow-y','hidden');
			$.ajax({
				type: "POST",
				url: "../compra/compra_form.php",
				async:true,
				dataType: "html",                      
				data: ({
					action: act,
					com_id:	idf,
					com_pagar:pagar,
					vista:'cuent_pagar'
				}),
				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_compra_form').html(div);
				},
				success: function(html){
					$('.div_compra_form').html(html);				
				}
			});
		}
		
	function ver_archivos(compagsid,numdoc){
			$('#div_comprapagoarchivos_form_dialog').modal();
			$('body').css('overflow-y','hidden');
			
			$.ajax({
				type: "POST",
				url: "../cuentapagar/archivos_form.php",
				async:true,
				dataType: "html",                      
				data: ({
					compagsid:compagsid,
					numdoc:numdoc,
					vista:'compra_tabla'
				}),
				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_comprapagoarchivos_form').html(div);
				},
				success: function(html){
					$('.div_comprapagoarchivos_form').html(html);				
				}
			});
		}
	
function letra_form(act,id_let,vis){	
	
	$('#div_letra_form_dialog').modal('show'); 
	
	$.ajax({
		type: "POST",
		url: "../cuentapagar/letra_form.php",
		async:true,
		dataType: "html",                      
		data: ({
			action: act,
			compag_id : id_let,
			vista:vis
		}),
		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_letra_form').html(div); 
		},
		success: function(html){
			$('.div_letra_form').html(html);				
		},
		complete: function(html){
		}
	});
}
	function pagos_form(idcompag){
			$('#div_pago_form_dialog').modal();
		//$('body').css('overflow-y','hidden');
			$.ajax({
				type: "POST",
				url: "../egreso/egreso_form_vista.php",
				async:true,
				dataType: "html",                      
				data: ({
					action: 'ver_pagos',
					compag_id:	idcompag,
					vista:'cuenta_pagar'
				}),
				beforeSend: function() {
					var div = "<center><div class='overlay col-lg-12 col-sm-12 col-xs-12' style='background-color:#fff;padding:0%;font-size:3rem;' >  <i class='fa fa-refresh fa-spin ' ></i> </div>  </center>";	
					$('.div_pago_form').html(div);
				},
				success: function(html){
					$('.div_pago_form').html(html);				
				}
			});
		}
		
function egresoletra_form(act,id_cp){	
	
	$('#div_egresoletra_form_dialog').modal('show'); 
	
	$.ajax({
		type: "POST",
		url: "../cuentapagar/egreso_cuentapagarletra.php",
		async:true,
		dataType: "html",                      
		data: ({
			action: act,
			compag_id : id_cp,
			vista: 'cuentasxpagar_panel'
		}),
		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_egresoletra_form').html(div); 
		},
		success: function(html){
			$('.div_egresoletra_form').html(html);				
		},
		complete: function(html){
		}
	});
}
		function pagosletra_form(idcompag){
			$('#div_pago_form_dialog').modal();
		
			$.ajax({
				type: "POST",
				url: "../egreso/egreso_form_vista_letra.php",
				async:true,
				dataType: "html",                      
				data: ({
					action: 'ver_pagos',
					compag_id:	idcompag,
					vista:'cuentasxpagar_panel'
				}),
				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_pago_form').html(div);
				},
				success: function(html){
					$('.div_pago_form').html(html);				
				}
			});
		}
	
		
	
function egreso_form(act,id_cp){	
	
	$('#div_egresofac_form_dialog').modal('show'); 
	
	$.ajax({
		type: "POST",
		url: "../cuentapagar/egreso_cuentapagar.php",
		async:true,
		dataType: "html",                      
		data: ({
			action: act,
			compag_id : id_cp,
			vista: 'cuentasxpagar_panel'
		}),
		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_egresofac_form').html(div); 
		},
		success: function(html){
			$('.div_egresofac_form').html(html);				
		},
		complete: function(html){			
			cuentacobrar();
		}
	});
}
	

  
	
	function venta_form_directa(act,idf){
		$('#div_venta_form_dialog').modal();
		$('body').css('overflow-y','hidden');
		$.ajax({
			type: "POST",
			url: "../venta/venta_form.php",
			async:true,
			dataType: "html",   
			position:'top',                   
			data: ({
				action: act,
				ven_id:	idf
			}),
			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_venta_form').html(div);
			},
			success: function(html){
				$('.div_venta_form').html(html);				
			},
			complete: function(){
			}
		});
	}
	
	function traertipocambio(){
		$.ajax({
			type: "POST",
			url: "../tipocambio/tipocambio_sunat.php",
			async:true,
			dataType: "html",                      
			data: ({
			}),
			beforeSend: function() {
				
			},
			success: function(html){				
			
			tipcam = html.trim();
			if(tipcam==""){
				
			}
			else{
				$(".div_tipcam").hide();
				registrartipocambio(tipcam)
			}
			
			},
			complete: function(){
				
			}
		});	 
  }
  
  cmb_fil_puntoventa_id(<?php echo $punven_id; ?>);
function cmb_fil_puntoventa_id(punven){
		$.ajax({
 					type: "POST",
 					url: "../puntoventa/cmb_punven_id.php",
 					async:true,
 					dataType: "html",                      
 					data: ({						
 						emp_id:'',
						punven_id :punven,
 						vista:	''
 					}),
 					beforeSend: function() {
 						$('#cmb_fil_puntoventa_id').html('<option value="">Cargando...</option>');
 					},
 					success: function(html){			
 						$('#cmb_fil_puntoventa_id').html(html);
 					},
 					complete: function(){
 						$('#txt_punven_id').val($('#cmb_fil_puntoventa_id').val());
 						verinforapida($('#cmb_fil_puntoventa_id').val());
						}
 					});
}
   
   function verinforapida(punven_id){
		$.ajax({
			type: "POST",
			url: "../base/info_rapida.php",
			async:true,
			dataType: "html",                      
			data: ({
				punven_id : punven_id
			}),
			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_inforapida').html(div);
			},
			success: function(html){				
				$("#div_inforapida").html(html);
			},
			complete: function(){
				
			}
		});	 
  }
   
  function registrartipocambio(tipcam){
		$.ajax({
			type: "POST",
			url: "../tipocambio/tipocambio_reg.php",
			async:true,
			dataType: "json",                      
			data: ({
				vista:'panel',
				action_tipocambio : 'insertar',
				txt_tipcam_val : tipcam
			}),
			beforeSend: function() {
				
			},
			success: function(data){				
					$("#msj_escritorio").html(data.tipcam_msj);	
					$("#msj_escritorio").show();	
			},
			complete: function(){
				 setTimeout(function(){ 
						 $('#msj_escritorio').hide(100);
					 }, 8000);
           setTimeout(function(){ 
            location.reload();
           }, 4000);
			}
		});	 
  }
  	
 /* 
  function cuentacobrar(){
	$.ajax({
		type: "POST",
		url: "../cuentacobrar/cuentacobrar_inicio.php",
		async:true,
		dataType: "html",                      
		data: ({
			
			//action: act,
			//mar_id:	idf
		}),
		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_cuentacobrar_inicio').html(div);
        },
		success: function(html){
			$('#div_cuentacobrar_inicio').html(html);				
		}
	});
} */



function cuentapagar(){
	$.ajax({
		type: "POST",
		url: "../cuentapagar/cuentapagar_inicio.php",
		async:true,
		dataType: "html",                      
		data: ({
			vista:'base'
			//action: act,
			//mar_id:	idf
		}),
		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_cuentapagar_inicio').html(div);
        },
		success: function(html){
			$('#div_cuentapagar_inicio').html(html);				
		}
	});
}



	///  FACTURACION
	
	
	
	

 function venta_ticket_datos(id_ven,imprimir){	
		
		/* alert(id_ven); */
		
		$.ajax({
			type: "POST",
			url: "../venta/venta_ticket_datos.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			venid: id_ven
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				 //console.log(data); 
				
				if(data!=""){					
					if(data.ven_docabr=="F" /* && data.cli_nom !='CLIENTE' */ ){
					generarFactura_xml(data,data.url_genfac,data.emp_ruc,data.ven_numdoc,id_ven,data.cli_id,imprimir);
					}else if(data.ven_docabr=="B" /* && data.cli_nom !='CLIENTE' */ ){
					generarBoleta_xml(data,data.url_genbol,data.emp_ruc,data.ven_numdoc,id_ven,data.cli_id,imprimir);
					}else if(data.ven_docabr=="T"){
						if(imprimir=='1'){
							venta_ticket_impresion(data,data.imp_doc);
						}
					}		
				}else{
					
				}
			}
		});
	
}


 function venta_ticket_datos_tabla(id_ven){	
		
		/* alert(id_ven); */
		
		$.ajax({
			type: "POST",
			url: "../venta/venta_ticket_datos.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			venid: id_ven
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				// console.log(data); 
				
				if(data!=""){					
					if(data.ven_docabr=="T"){
					venta_ticket_impresion(data,data.imp_doc);
					}		
				}else{
					
				}
			}
		});
	
}



function venta_ticket_impresion(data,url){	

	$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "html",                      
		data: data,
		beforeSend: function()
		{
			//console.log(data);	
		},
		success: function(html){
				
			
		}
	});
}

function generarFactura_xml(data,url,emp_ruc,ven_numdoc,id_ven,id_cli,imprimir){
		/* alert(url); */
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: data,
		beforeSend: function()
		{
			
		},
		success: function(data){
				/* alert(html); */
				//tip_com = '01';
		/* crear_xml(html,emp_ruc,ven_numdoc,tip_com,id_ven,id_cli); */
		firmar(data.url,data.arc,emp_ruc,ven_numdoc,data.tipcom,id_ven,id_cli,imprimir);
		}
	});

}

function generarBoleta_xml(data,url,emp_ruc,ven_numdoc,id_ven,id_cli,imprimir){
		/* alert(url); */
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: data,
		beforeSend: function()
		{
			
		},
		success: function(data){
			
			firmar(data.url,data.arc,emp_ruc,ven_numdoc,data.tipcom,id_ven,id_cli,imprimir);			
			/* alert(html); */
		//tip_com = '03';
		//crear_xml(html,emp_ruc,ven_numdoc,tip_com,id_ven,id_cli);
		}
	});

}

// function crear_xml(xml,emp_ruc,ven_numdoc,tip_com,id_ven,id_cli){
		// /* alert(url); */
		// $.ajax({
		// type: "POST",
		// url: '../../docgeneracion/crearxml.php',
		// async:true,
		// dataType: "json",                      
		// data: ({
			// xml : xml,
			// emp_ruc : emp_ruc,
			// ven_numdoc : ven_numdoc,
			// tip_com : tip_com,
		// }),
		// beforeSend: function()
		// {
			
		// },
		// success: function(data){
		
			// firmar(data.url,data.arc,emp_ruc,ven_numdoc,data.tipcom,id_ven,id_cli);
				
		// }
	// });

// }

function firmar(url,arc,emp_ruc,ven_numdoc,tipcom,id_ven,id_cli,imprimir){
		/* alert(url); */
		$.ajax({
		type: "POST",
		url: url,
		async:true,
		dataType: "json",                      
		data: ({
			arc : arc,
			emp_ruc : emp_ruc,
			ven_numdoc:ven_numdoc,
			tipcom:tipcom,
			venid:id_ven
		}),
		beforeSend: function()
		{
			
		},
		success: function(data){			
			generar_pdf(id_ven);
			//generarPDF417(data);
			traer_datos_doc(id_ven,data.fil_name_xml,imprimir);
			enviarSunat(data.xml_nom,data.fil_name_zip,data.fil_name_xml,data.filenom,id_ven,id_cli,tipcom);
			
				
			
		}
	});

}


function enviarSunat(nomxml,fil_name_zip,fil_name_xml,filenom,id_ven,id_cli,tipcom){
		$.ajax({
		type: "POST",
		url: '../../docgeneracion/enviosunat.php',
		async:true,
		dataType: "json",                      
		data: ({
			nomxml:nomxml,
			name_zip:fil_name_zip,
			nomfile:filenom,
			id_ven:id_ven,
			xmlarchivo:fil_name_xml,
			tipcom:tipcom
		}),
		beforeSend: function()
		{
			toastr["error"]('Esperando respuesta de sunat');
		},
		success: function(data){
			
			toastr["success"](data.msj);
			
			if(data.est==1){
				//enviarCorreo(id_ven,id_cli);
				
				//abrirEnPestana('="../../../../files/venta/venta_impcpe_doc.php?venid='+id_ven);
				venta_tabla();
			}else{
				toastr["info"]('El documento no se ha emitido.');
			}
			
		}
	});

}


 function generar_pdf(id_ven){	
		
//alert(id_ven); 
		
		$.ajax({
			type: "GET",
			url: "../venta/venta_generar_doc.php",
			async:true,
			dataType: "json",                      
			data: ({ 
			venid: id_ven
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				toastr["info"]('Pdf generado');
				}
		});
	
}

function enviarCorreo(venid,cliid){
	
	$('#div_venta_correo_form').modal();
	//$('body').css('overflow-y','hidden');
				
	$.ajax({
			type: "POST",
			url: "../venta/venta_correo_form.php",
			async:true,
			dataType: "html",
			data: ({
				venta_id:venid,
				cli_id:cliid	
			}),
			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_venta_correo_conten').html(div);
	       


		   },
			success: function(html){
				$('.div_venta_correo_conten').html(html);				
			}
		});
	
}

function traer_datos_doc(venid,urlxml,imprimir){
	
	
	
	$.ajax({
			type: "POST",
			url: "../venta/venta_doc_datos.php",
			async:true,
			dataType: "json",                      
			data:({ 
			venid: venid,
			urlxml :urlxml
			}),
			beforeSend: function() {
				
			},
			success: function(data){
				/* console.log(data); */
			
			//generarPDF417(data);
			
			
			if(imprimir=='1'){
			venta_doc_impresion(data,data.imp_doc);
			}
			
			/* if(data.cli_ema==""){
				
			}else{
				act ="enviar";
				enviarCorreo(data);
			}	 */	
			
			}
		});
	
}

function generarPDF417(data){
	
	console.log(data);
	
	$.ajax({
			type: "POST",
			url: "../venta/generarPdf417.php",
			async:true,
			dataType: "json",                      
			data:data,
			beforeSend: function() {
				
			},
			success: function(data){			

			}
		});	 
		
}

function venta_doc_impresion(data,url){
	$.ajax({
			type: "POST",
			url: url,
			async:true,
			dataType: "json",                      
			data: data ,
			beforeSend: function() {
				//console.log(data);
			},
			success: function(data){
				
				
			}
		});
}






////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$(".btn_color_user").click(function(){
		
		var namheader = $(this).attr('data-name');
		var namslider = $(this).attr('data-name2');
		
		$.ajax({
		type: "POST",
		url: "../usuario/usuario_reg.php",
		async:true,
		dataType: "html",                      
		data: ({
			namheader : namheader,
			namslider : namslider
		}),
		beforeSend: function() {
			
        },
		success: function(html){
					
		}
	});
	});	
	
	
	
	$("#cmb_fil_puntoventa_id").change(function(){
		verinforapida($('#cmb_fil_puntoventa_id').val());
	});
		
		
		
	$("#div_efectuar_pedidos").on('hidden.bs.modal', function () {
		$("#content").load("../base/base_vista.php");	
		$('body').css('overflow-y','scroll');
    });
	
	$("#div_comprapagoarchivos_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
    });
	
	$("#div_pago_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
    });
	
	$("#div_ingreso_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','hidden');
    });
	$("#div_cuentacobrar_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
    });
	$("#div_egreso_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','hidden');
    });
	$("#div_cuentapagar_form_dialog").on('hidden.bs.modal', function () {
		   	$('body').css('overflow-y','scroll');
    });
  
  </script>
  
     