<?php
session_start();
date_default_timezone_set('America/Lima');
require_once ("../formatos/formato.php");
require_once ("../formatos/fechas.php");
require_once ("../../config/Cado.php");
require_once ("../../config/Datos.php");

require_once ("../venta/cVenta.php");
$oVenta = new cVenta();
require_once ("../notacredito/cNotacredito.php");
$oNotacredito = new cNotacredito();
require_once ("../guiaremision/cGuiaremision.php");
$oGuiaremision = new cGuiaremision();

require_once("../tipocambiotesoreria/cTipocambiotesoreria.php");
$oTipocambiotesoreria = new cTipocambiotesoreria();
require_once("../tipocambio/cTipocambio.php");
$oTipocambio = new ctipocambio();
$y=date('Y');
$m=date('m');
$d=date('d');
$fecha = date('Y-m-d'); 
$rs = $oTipocambio->consultar($fecha);  
$rstes = $oTipocambiotesoreria->consultar($fecha);  
$rows = mysqli_num_rows($rs);




$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);
$ban = false;
 
if($numrowvensunat>0){
	$ban = true;
}

 
if($numrownotcresunat>0){
	$ban = true;
}

 
if($numrowguiasunat>0){
	$ban = true;
}

// echo '--------------'.$_SESSION['puntoventa_tipope'];


?>




<nav id="header_app" class="main-header navbar navbar-expand navbar-dark ">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
        <a href="?app=base" class="nav-link">Home</a>
      </li>
    </ul>
   
      <ul class="navbar-nav">
 
  <?php if($rows>0){
  $dt = mysqli_fetch_array($rs);
  $dttes = mysqli_fetch_array($rstes);
	?>
   <li class="nav-item " style="display: inline-block; white-space: nowrap;" >
        <a href="?app=base" class="nav-link">T.C.: S/ <?php echo formato_money3($dt['tb_tipocambio_dolsun']) ?></a>
   </li>
   
    <li class="nav-item d-none" style="display: inline-block; white-space: nowrap;" >
        <a href="?app=base" class="nav-link">TESORERIA: S/ <?php echo formato_money3($dttes['tb_tipocambiotesoreria_val']) ?></a>
   </li>  
   
   
   
  <?php 
  }else{
  ?>
 
  <input style="" id="txt_tipcam" type="text" class="form-control form-control-navbar" placeholder="INGRESE TIPO CAMBIO" name="">
	<?php 
  } ?>
  
     <li class="nav-item " style="display: inline-block; white-space: nowrap;" >
	<?php if($app_igv_val>=0){?>
        <strong><a href="?app=base" class="nav-link"><?php echo $app_igv_val."%"; ?></a></strong>
	<?php }else{
	?>
	<strong><a href="?app=base" class="nav-link" style="color:#00E676;font-size:20px;" >IGV NO ENCONTRADO</a></strong>
	<?php 
	} ?>
   </li>
   
      </ul>
   
 <!--
    <ul class="navbar-nav ml-auto float-right ">
      
      <li class="nav-item">      
			<a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button" ><i class="fas fa-th-large"></i>
			 <li class="d-none d-lg-block"><?php echo $_SESSION['usuario_nombre'].' | '.$_SESSION['usuariogrupo_nombre']; ?></li>
			</a>			
      </li>
	 	  
    </ul>
	-->
	
	 <ul class="navbar-nav ml-auto">
	<li class="nav-item dropdown user-menu">
        <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
          <img src="../../imagenes/logo_<?php echo $numero;?>.png" class="user-image img-circle elevation-2" alt="User Image">
          <span class="d-none d-md-inline"><?php echo $_SESSION['usuario_nombre'].' | '.$_SESSION['usuariogrupo_nombre']; ?></span>
        </a>
        <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
         
	
		 <li class="user-header bg-dark">
            <img src="../../admin/dist/img/AdminLTELogo.png" class="img-circle elevation-2" alt="User Image">
            <p>
              <?php echo $_SESSION['usuario_nombre']; ?>
              <small><?php echo $_SESSION['usuariogrupo_nombre']; ?></small>
            </p>
          </li>
		  
		   <div class="col-lg-12 col-md-12 col-xs-12 div_menu bg-dark" style="cursor:pointer">
		  
			<h6>Color Header</h6>
			<div class="d-flex">
			<div class="d-flex flex-wrap mb-3">
			<div data-name="navbar-secondary" data-name2="secondary"  class="bg-secondary elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-info" data-name2="info" class="bg-info elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-success" data-name2="success" class="bg-success elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-danger" data-name2="danger" class="bg-danger elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>			
			<div data-name="navbar-purple" data-name2="purple" class="bg-purple elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-navy" data-name2="navy" class="bg-navy elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-lightblue" data-name2="lightblue" class="bg-lightblue elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div data-name="navbar-gray-dark" data-name2="gray" class="bg-gray-dark elevation-2 btn_color_user " style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			</div>
			
			</div> 
		<!--	
			<h6>Menu Colores Oscuros</h6>
			
			<div class="d-flex">
			<div class="d-flex flex-wrap mb-3">
			<div data-name="sidebar-dark-primary" class="bg-primary elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-warning elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-info elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-danger elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-success elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-indigo elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-lightblue elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-navy elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-purple elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-fuchsia elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-pink elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-maroon elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-orange elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-lime elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-teal elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			<div class="bg-olive elevation-2" style="width: 40px; height: 20px; border-radius: 25px; margin-right: 10px; margin-bottom: 10px; opacity: 0.8; cursor: pointer;"></div>
			</div>
			</div>
			
			
			-->
			
			
		  </div>
		  
          <li class="user-footer">
            <a href="../login/cerrar_sesion.php" class="btn btn-danger btn-flat float-right">Cerrar Sesion</a>
          </li>
		  
		 
		  
        </ul>
      </li>
	  
	   <ul class="navbar-nav">

	   	
		<li class="nav-item" >
            <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
				<i class="fab fa-ioxhost"></i> <?php if($ban==true){?> <span class="badge badge-warning">+9</span><?php }?>
			</a>
          </li>
	  </ul>
	  
	   </ul>
	   
  </nav>
  
 