<?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['facturacion']==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> Facturacion
                                            </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 Pagos a Facturacion
                                        </h3>
                                    </div>
                                    <div class="card-footer">
                                        <!-- Footer buttons -->
                                        <button onclick="procesarSeleccionados()" class="btn btn-danger btn-flat"><i class="fas fa-sync"></i> Procesar seleccionados</button>
                                    </div>
                                    <div class="card-body" style="display: block;">
                                        <div class="container-fluid">
                                                <table style="width:100%;" class="table table-bordered" id="producto">
                                                    <thead>
                                                    <tr>
                                                    <th>#</th>
                                                    <th>Fecha Pago</th>
                                                    <th>Tipo</th>
                                                    <th>Serie</th>
                                                    <th>Numero</th>                            
                                                    <th>Documento</th>
                                                    <th>Cliente</th>
                                                    <th>Moneda</th>
                                                    <th>Total</th>
                                                    <th>Estado Facturacion</th>
                                                    <th>Ver</th>
                                                    <th>Pdf</th>
                                                    <th>Sunat</th>
                                                    <th>Baja</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    </tbody>
                                                </table>
                                                <br>
                                            <div class="row">
                                                <br>
                                                <div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-12" align="center" >
                                                    <div style="text-align:center; font-size:large;font-weight: 500;" class="alert alert-success" >
                                                        <label>Egreso Total </label>
                                                        <p>
                                                        <span id="suma_egreso">0.00</span><span> Soles</span>
                                                        </p>
                                                    </div>
                                                </div>
                                                <div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-12" align="center" >
                                                    <div style="text-align:center; font-size:large;font-weight: 500;" class="alert alert-danger" >
                                                        <label>Ingreso Total </label>
                                                        <p>
                                                        <span id="suma_ingreso">0.00</span><span> Soles</span>
                                                        </p>
                                                    </div>
                                                </div>
                                        </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </section>                
                    </div>

            <div class="modal fade" id="modal_facturacion" tabindex="-1" role="dialog"  >
                <div class="modal-dialog modal-lg " role="document">
                    <div class="modal-content">
                        <div class="modal-header" >
                            <h5 class="modal-title" id="Label">DATOS DE COMPROBANTE</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span>&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form id="facturacion_Form">
                                <div class="row">
                                     <input type="hidden"  class="form-control" name="idpago" id="idpago">
                                     <div class="modal-body">
                                        <div id="row m-0 p-0">
                                            <div class="col-12 row m-0 p-0" >
                                                <div class="col-8 row m-0 p-0">
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3" id="TipoDocumento">VENTA: </label>
                                                        <label class="col-9 text-left" id="DocumentoID">F001-0001</label>
                                                    </div>
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3" id="ClienteDocumento"></label>
                                                        <label class="col-9 text-left" id="ClienteNumero">00000000000</label>
                                                        <input type="hidden" id="serie" name="serie" ></input>
                                                        <input type="hidden" id="correlativo" name="correlativo" ></input>
                                                        <input type="hidden" id="codigotipo_comprobante" name="codigotipo_comprobante" ></input>
                                                    </div>                            
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">NOMBRES: </label>
                                                        <label class="col-9 text-left" id="ClienteNombres">NOMBRE O RAZON SOCIAL</label>
                                                    </div>
                                                </div>
                                                <div class="col-4 row m-0 p-0">
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">FECHA: </label>
                                                        <label class="col-9 text-right" id="FechaRegistro">YYYY/MM/DD HH:MM:SS</label>
                                                    </div>
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">IMPORTE:</label>
                                                        <label class="col-9 text-right" id="Comprobante_Importe">0 (PEN)</label>
                                                    </div>                            
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">TOTAL: </label>
                                                        <label class="col-9 text-right" id="Comprobante_Total">0 (PEN)</label>
                                                    </div>
                                                    </div>
                                                </div>
                                                <hr class="col-12 my-2">
                                            </div>
                                            <div class="col-12 row m-0">
                                                <label class="col-12">JSON: </label>
                                                <textarea class="col-12 form-control" rows="20" id="Comprobante_Json"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary  btn-flat" data-dismiss="modal">Cerrar</button>
                                    <button type="submit" id="btnFacturacion" class="btn btn-flat" style='background-color:#3e038c;color: #FFFFFF'> <i class="fas fa-save"></i> Actualizar Facturacion</button>
                                </div>
                         </form>
                    </div>
                </div>
            </div>


            <div class="modal fade" id="modal_ver" tabindex="-1" role="dialog"  >
                <div class="modal-dialog modal-lg " role="document">
                    <div class="modal-content">
                        <div class="modal-header" >
                            <h5 class="modal-title" id="Label">DATOS DE COMPROBANTE</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span>&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form id="facturacion_Form">
                                <div class="row">
                                     <input type="hidden"  class="form-control" name="idpago" id="idpago">
                                     <div class="modal-body">
                                        <div id="row m-0 p-0">
                                            <div class="col-12 row m-0 p-0" >
                                                <div class="col-8 row m-0 p-0">
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3" id="TipoDocumento">VENTA: </label>
                                                        <label class="col-9 text-left" id="DocumentoID">F001-0001</label>
                                                    </div>
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3" id="ClienteDocumento1"></label>
                                                        <label class="col-9 text-left" id="ClienteNumero">00000000000</label>
                                                       
                                                    </div>                            
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">NOMBRES: </label>
                                                        <label class="col-9 text-left" id="ClienteNombres">NOMBRE O RAZON SOCIAL</label>
                                                    </div>
                                                </div>
                                                <div class="col-4 row m-0 p-0">
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">FECHA: </label>
                                                        <label class="col-9 text-right" id="FechaRegistro">YYYY/MM/DD HH:MM:SS</label>
                                                    </div>
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">IMPORTE:</label>
                                                        <label class="col-9 text-right" id="Comprobante_Importe">0 (PEN)</label>
                                                    </div>                            
                                                    <div class="col-12 row m-0 p-0">
                                                        <label class="col-3">TOTAL: </label>
                                                        <label class="col-9 text-right" id="Comprobante_Total">0 (PEN)</label>
                                                    </div>
                                                    </div>
                                                </div>
                                                <hr class="col-12 my-2">
                                            </div>
                                            <div class="col-12 row m-0">
                                                <label class="col-12">JSON: </label>
                                                <textarea class="col-12 form-control" rows="20" id="Comprobante_Json"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary  btn-flat" data-dismiss="modal">Cerrar</button>
                                </div>
                         </form>
                    </div>
                </div>
            </div>


           

               
<?php
}
require '../footer.php';
?>
<script type="text/javascript" src="../../scripts/facturacion.js"></script>
<?php 
}
ob_end_flush();
?>