<?php
ob_start();
ini_set('session.gc_maxlifetime', 14400);
session_set_cookie_params(14400);
session_start();

if (!isset($_SESSION["nombre"]))
{
  header("Location: ../login/login.php");
}
else
{
    require '../header.php';

if($_SESSION['ingreso']==1){

?>

            <div class="content-wrapper">
                <!-- Breadcrumb Section -->
                <section class="content-header">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <nav aria-label="breadcrumb">
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item">
                                            <a href="#"><i class="fas fa-home"></i> Panel</a>
                                        </li>
                                        <li class="breadcrumb-item active" aria-current="page">
                                            <a href="list.php">
                                                <i class="module-icon"></i> Ingresos
                                            </a>
                                        </li>
                                    </ol>
                                </nav>
                            </div>
                          
                            <div class="col-sm-12" style="margin-top: 20px;">
                                <div class="card  ">
                                    <div class="card-header bg-primary">
                                        <h3 class="card-title">
                                            <i class="fas fa-search"></i>
                                            Listado de Ingresos
                                        </h3>
                                    </div>
                                     <div class="card-footer">
                                        <!-- Footer buttons -->
                                        <a href="create.php" class="btn btn-primary btn-flat">
                                            <i class="fas fa-plus"></i> Nuevo Registro
                                        </a>
                                        <a href="list.php" class="btn btn-success btn-flat">
                                            <i class="fas fa-sync-alt"></i> Actualizar
                                        </a>
                                    </div>
                                    <div class="card-body" style="display: block;">
                                        <div class="container-fluid">
                                            <div class="row">
                                            <div class="col-12 col-sm-12 col-md-3">
                                                </div>
                                                <div class="col-12 col-sm-12 col-md-2">
                                                    <div class="form-group">
                                                        <br>
                                                        <input name="ano" id="ano" class="form-control" type="text" placeholder="Ingrese el Año" required>
                                                    </div>
                                                </div>
                                                <div class="col-12 col-sm-12 col-md-2">
                                                    <div class="form-group">
                                                        <br>
                                                       <select class="form-control select2" required name="mes" id="mes"
                                                                style="width: 100%;">
                                                            <OPTION value="">Seleccione </OPTION>
                                                            <OPTION value="01">Enero</OPTION>
                                                            <OPTION value="02">Febrero</OPTION>
                                                            <OPTION value="03">Marzo</OPTION>
                                                            <OPTION value="04">Abril</OPTION>  
                                                            <OPTION value="05">Mayo</OPTION>
                                                            <OPTION value="06">Junio</OPTION>  
                                                            <OPTION value="07">Julio</OPTION>
                                                            <OPTION value="08">Agosto</OPTION>  
                                                            <OPTION value="09">Setiembre</OPTION>
                                                            <OPTION value="10">Octubre</OPTION>   
                                                            <OPTION value="11">Noviembre</OPTION>
                                                            <OPTION value="12">Diciembre</OPTION>                        
                                                        </select> 
                                                    </div>
                                                </div>
                                                 <div class="form-group col-lg-2 col-md-2 col-sm-2 col-xs-2">
                                                    <br>
                                                    <button class="btn btn-success btn-flat" style="margin-bottom:-10px" onclick="listar_total(event)"><i class="fa-solid fa-magnifying-glass"></i> Consultar Ingresos</button>
                                                </div>
                                              </div>  
                                    <div class="card-body" style="display: block;">
                                        <div class="container-fluid">
                                            <br>
                                            <table style="width:100%;" class="table table-bordered" id="ingreso_total">
                                                <thead>
                                                <tr>
                                                    <th>Fecha Registro</th>
                                                    <th>Nombre Cliente</th>
                                                    <th>Descripcion Pago</th>
                                                    <th>Tipo Contrato</th>
                                                    <th>Tipo Pago</th>
                                                    <th>Nro Recibo</th>
                                                    <th>Monto Pagado</th>
                                                    <th>Opcion</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                            <br>
                                            <div class="row">
                                                <br>
                                                <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" align="center" >
                                                    <div style="text-align:center; font-size:large;font-weight: 500;" class="alert alert-success" >
                                                        <label>Venta Total Efectivo </label>
                                                        <p>
                                                        <span id="sumaefectivo">0.00</span><span> Soles</span>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" align="center" >
                                                    <div style="text-align:center; font-size:large;font-weight: 500;" class="alert alert-danger" >
                                                        <label>Venta Total Transferencia </label>
                                                        <p>
                                                        <span id="sumatransferencia">0.00</span><span> Soles</span>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" align="center" >
                                                    <div style="text-align:center; font-size:large;font-weight: 500;" class="alert alert-dark" >
                                                        <label>Total Venta </label>
                                                        <p>
                                                        <span id="sumatotal">0.00</span><span> Soles</span>
                                                        </p>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                   
                                </div>
                            </div>
                        </div>
                    </div>
                </section>                
            </div>
               
<?php
}
require '../footer.php';
?>
<script type="text/javascript" src="../../scripts/ingreso.js"></script>
<?php 
}
ob_end_flush();
?>
   