Tul xxx Tul
User / IP
:
216.73.216.191
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
gimnasiofitnes
/
app
/
Views
/
admin
/
reportes
/
Viewing: index.php
<?= $this->extend('layout/app'); ?> <?php $this->section('title'); ?> Centro de Reportes <?php $this->endSection(); ?> <?php $this->section('css'); ?> <link rel="stylesheet" href="<?= base_url('assets/DataTables/datatables.min.css'); ?>"> <style> body { background-color: #f8f9fa; } .report-header { margin-bottom: 25px; } .report-header h2 { font-weight: 700; color: #1e293b; margin-bottom: 5px; display: flex; align-items: center; } .report-header h2 i { color: #0ea5e9; margin-right: 10px; font-size: 1.5rem; } .filter-container { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 20px; } .quick-filters .btn { border-radius: 20px; padding: 6px 16px; font-weight: 600; font-size: 0.85rem; color: #64748b; background: #f1f5f9; border: none; margin-right: 8px; margin-bottom: 8px; } .quick-filters .btn.active, .quick-filters .btn:hover { background: #0ea5e9; color: #fff; } .nav-tabs-line { border-bottom: 2px solid #e2e8f0; margin-bottom: 25px; display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #0ea5e9 #f1f5f9; -webkit-overflow-scrolling: touch; padding-bottom: 5px; } .nav-tabs-line::-webkit-scrollbar { height: 4px; } .nav-tabs-line::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 10px; } .nav-tabs-line::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; } .nav-tabs-line::-webkit-scrollbar-thumb:hover { background: #0ea5e9; } .nav-tabs-line .nav-item { margin-bottom: -2px; } .nav-tabs-line .nav-link { border: none; color: #64748b; font-weight: 600; padding: 12px 20px; background: transparent; white-space: nowrap; border-bottom: 3px solid transparent; transition: all 0.2s; } .nav-tabs-line .nav-link:hover { color: #0ea5e9; } .nav-tabs-line .nav-link.active { color: #0ea5e9; border-bottom: 3px solid #0ea5e9; } .summary-card { border-radius: 16px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); height: 100%; display: flex; flex-direction: column; justify-content: center; border: none; } .summary-title { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 8px; display: flex; align-items: center; } .summary-title i { margin-right: 6px; font-size: 0.9rem; } .summary-value { font-size: 2rem; font-weight: 800; line-height: 1.2; } .table-container { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); } .table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #f1f5f9; } .table-title { font-weight: 700; color: #1e293b; margin: 0; display: flex; align-items: center; } .table-title i { color: #0ea5e9; margin-right: 10px; } .export-btns .btn { border-radius: 20px; padding: 6px 16px; font-weight: 600; font-size: 0.85rem; } /* DataTable overrides */ table.dataTable { border-collapse: collapse !important; } table.dataTable thead th { background-color: #f8fafc; color: #64748b; font-size: 0.75rem; text-transform: uppercase; font-weight: 700; border-bottom: 1px solid #e2e8f0 !important; padding: 12px 10px; } table.dataTable tbody td { font-size: 0.9rem; color: #334155; font-weight: 600; border-bottom: 1px solid #f1f5f9; padding: 12px 10px; vertical-align: middle; } </style> <?php $this->endSection(); ?> <?php $this->section('content'); ?> <div class="report-header"> <h2><i class="bi bi-bar-chart-steps"></i> Centro de Reportes</h2> <p class="text-muted small mb-0" id="current-date-range">Cargando...</p> </div> <!-- Filtros Globales --> <div class="filter-container"> <div class="row align-items-center"> <div class="col-xl-5 col-lg-12 mb-3 mb-xl-0"> <div class="quick-filters"> <button type="button" class="btn active" onclick="setQuickDate('todo', this)"><i class="bi bi-infinity me-1"></i> Todo</button> <button type="button" class="btn" onclick="setQuickDate('hoy', this)"><i class="bi bi-gear me-1"></i> Hoy</button> <button type="button" class="btn" onclick="setQuickDate('semana', this)"><i class="bi bi-calendar-week me-1"></i> Semana</button> <button type="button" class="btn" onclick="setQuickDate('mes', this)"><i class="bi bi-calendar-month me-1"></i> Mes</button> <button type="button" class="btn" onclick="setQuickDate('trimestre', this)"><i class="bi bi-calendar2-range me-1"></i> Trimestre</button> <button type="button" class="btn" onclick="setQuickDate('ano', this)"><i class="bi bi-graph-up me-1"></i> Año</button> </div> </div> <div class="col-xl-7 col-lg-12"> <form id="filter-form" class="row gx-2 align-items-end justify-content-xl-end"> <div class="col-auto"> <label class="form-label small fw-bold text-muted mb-1">Desde</label> <input type="date" class="form-control form-control-sm border-0 bg-light" style="border-radius: 8px; padding: 8px 12px;" id="fecha_desde"> </div> <div class="col-auto"> <label class="form-label small fw-bold text-muted mb-1">Hasta</label> <input type="date" class="form-control form-control-sm border-0 bg-light" style="border-radius: 8px; padding: 8px 12px;" id="fecha_hasta"> </div> <div class="col-auto" id="warehouse-filter-container" style="display: none;"> <label class="form-label small fw-bold text-muted mb-1">Bodega</label> <select class="form-select form-select-sm border-0 bg-light" style="border-radius: 8px; padding: 8px 12px;" id="warehouse_id"> <option value="">Todas las Bodegas</option> <?php foreach ($warehouses as $w): ?> <option value="<?= $w['id'] ?>"><?= esc($w['name']) ?></option> <?php endforeach; ?> </select> </div> <div class="col-auto"> <button type="submit" class="btn btn-primary btn-sm px-3" style="border-radius: 8px; padding: 8px 16px;"><i class="bi bi-funnel-fill me-1"></i> Aplicar</button> </div> <div class="col-auto"> <button type="button" class="btn btn-light btn-sm px-3 border" style="border-radius: 8px; padding: 8px 16px;" onclick="resetFilters()"><i class="bi bi-arrow-counterclockwise me-1"></i> Reset</button> </div> </form> </div> </div> </div> <!-- Navegación de Pestañas --> <ul class="nav nav-tabs-line" id="reportTabs" role="tablist"> <li class="nav-item"> <button class="nav-link active" data-type="caja"><i class="bi bi-cash-stack me-2"></i>Cierre de Caja</button> </li> <li class="nav-item"> <button class="nav-link" data-type="cuentas-cobrar"><i class="bi bi-arrow-down-circle me-2"></i>Cuentas x Cobrar</button> </li> <li class="nav-item"> <button class="nav-link" data-type="cuentas-pagar"><i class="bi bi-arrow-up-circle me-2"></i>Cuentas x Pagar</button> </li> <li class="nav-item"> <button class="nav-link" data-type="ventas"><i class="bi bi-cart-check me-2"></i>Ventas Generales</button> </li> <li class="nav-item"> <button class="nav-link" data-type="compras"><i class="bi bi-bag-plus me-2"></i>Compras</button> </li> <li class="nav-item"> <button class="nav-link" data-type="membresias"><i class="bi bi-person-vcard me-2"></i>Membresías</button> </li> <li class="nav-item"> <button class="nav-link" data-type="gastos"><i class="bi bi-graph-down-arrow me-2"></i>Gastos</button> </li> <li class="nav-item"> <button class="nav-link" data-type="asistencia"><i class="bi bi-calendar-check me-2"></i>Asistencia</button> </li> <li class="nav-item"> <button class="nav-link" data-type="productos"><i class="bi bi-box-seam me-2"></i>Productos</button> </li> <li class="nav-item"> <button class="nav-link" data-type="traslados"><i class="bi bi-arrow-left-right me-2"></i>Traslados</button> </li> <li class="nav-item"> <button class="nav-link" data-type="ajustes"><i class="bi bi-box-arrow-in-down-right me-2"></i>Ajustes Inv.</button> </li> <li class="nav-item"> <button class="nav-link" data-type="estado-resultados"><i class="bi bi-calculator me-2"></i>Estado de Resultados</button> </li> </ul> <!-- Tarjetas Dinámicas --> <div class="row mb-4" id="summary-cards-container"> <!-- Las tarjetas se generan por JS --> </div> <!-- Tabla de Datos --> <div class="table-container"> <div class="table-header"> <h4 class="table-title" id="table-dynamic-title"><i class="bi bi-table"></i> Datos del Reporte</h4> <div class="export-btns"> <!-- Selector de Bodega para filtros rápidos --> <button class="btn btn-outline-danger me-2" onclick="downloadExport('pdf')"><i class="bi bi-file-pdf-fill me-1"></i> PDF</button> <button class="btn btn-outline-success" onclick="downloadExport('excel')"><i class="bi bi-file-excel-fill me-1"></i> Excel</button> </div> </div> <!-- Nueva sección de botones rápidos por Bodega (Solo visible en Productos) --> <div id="quick-warehouse-reports" class="mb-4 p-3 bg-light rounded-3" style="display: none; border: 1px dashed #cbd5e1;"> <h6 class="fw-bold text-muted mb-3"><i class="bi bi-houses me-1"></i> Descargar Reportes Individuales por Bodega:</h6> <div class="d-flex flex-wrap gap-2"> <?php foreach ($warehouses as $w): ?> <div class="btn-group shadow-sm"> <button class="btn btn-sm btn-white border fw-bold"><?= esc($w['name']) ?></button> <a href="<?= base_url('admin/pdf-productos?warehouse_id=' . $w['id']) ?>" target="_blank" class="btn btn-sm btn-outline-danger" title="PDF"> <i class="bi bi-file-pdf"></i> </a> <a href="<?= base_url('admin/excel-productos?warehouse_id=' . $w['id']) ?>" target="_blank" class="btn btn-sm btn-outline-success" title="Excel"> <i class="bi bi-file-excel"></i> </a> </div> <?php endforeach; ?> </div> </div> <div class="table-responsive"> <table class="table table-hover w-100" id="reportTable"> <thead id="reportTableHead"> <!-- Dinámico --> </thead> <tbody id="reportTableBody"> <!-- Dinámico --> </tbody> </table> </div> </div> <?php $this->endSection(); ?> <?php $this->section('js'); ?> <script src="<?= base_url('assets/DataTables/datatables.min.js'); ?>"></script> <script> let currentType = 'caja'; // Pestaña por defecto: Cierre de Caja let dataTable = null; // Configuración de columnas para cada tipo de reporte const reportConfig = { 'caja': { title: 'Reporte de Cierre de Caja', columns: [ { data: 'id', title: '#' }, { data: 'dt_open', title: 'APERTURA' }, { data: 'dt_close', title: 'CIERRE' }, { data: 'dt_initial', title: 'INICIAL' }, { data: 'dt_sales', title: 'VENTAS' }, { data: 'dt_expenses', title: 'GASTOS' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-caja', excel: 'excel-caja' } }, 'cuentas-cobrar': { title: 'Cuentas por Cobrar', columns: [ { data: 'dt_id', title: 'FACTURA' }, { data: 'dt_origin', title: 'TIPO' }, { data: 'user_name', title: 'CLIENTE' }, { data: 'dt_date', title: 'FECHA' }, { data: 'dt_total', title: 'TOTAL' }, { data: 'dt_abono', title: 'PAGADO' }, { data: 'dt_balance', title: 'PENDIENTE' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-accounts-receivable', excel: 'excel-accounts-receivable' } }, 'cuentas-pagar': { title: 'Cuentas por Pagar', columns: [ { data: 'dt_id', title: 'COMPRA' }, { data: 'dt_supplier', title: 'PROVEEDOR' }, { data: 'dt_date', title: 'FECHA' }, { data: 'dt_total', title: 'TOTAL' }, { data: 'dt_abono', title: 'PAGADO' }, { data: 'dt_balance', title: 'PENDIENTE' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-accounts-payable', excel: 'excel-accounts-payable' } }, 'ventas': { title: 'Reporte de Ventas Generales', columns: [ { data: 'dt_date', title: 'FECHA' }, { data: 'dt_id', title: 'NO DOCUMENTO' }, { data: 'user_name', title: 'NOMBRE DEL CLIENTE' }, { data: 'dt_concept', title: 'CONCEPTO' }, { data: 'dt_total', title: 'VALOR' }, { data: 'dt_cost', title: 'COSTO' }, { data: 'dt_profit', title: 'UTILIDAD' } ], endpoints: { pdf: 'pdf-sales', excel: 'excel-sales' } }, 'compras': { title: 'Historial de Compras', columns: [ { data: 'dt_id', title: 'ID' }, { data: 'dt_supplier', title: 'PROVEEDOR' }, { data: 'dt_date', title: 'FECHA' }, { data: 'dt_total', title: 'TOTAL' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-shopping', excel: 'excel-shopping' } }, 'membresias': { title: 'Venta de Membresías', columns: [ { data: 'id', title: 'ID' }, { data: 'dt_client', title: 'CLIENTE' }, { data: 'dt_plan', title: 'PLAN' }, { data: 'dt_start', title: 'INICIO' }, { data: 'dt_end', title: 'FIN' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-membership', excel: 'excel-membership' } }, 'gastos': { title: 'Reporte Control de Gastos', columns: [ { data: 'dt_date', title: 'FECHA' }, { data: 'dt_id', title: 'NO DE DOCUMENTO' }, { data: 'dt_user', title: 'NOMBRE DEL CLIENTE' }, { data: 'dt_category', title: 'CATEGORIA' }, { data: 'dt_subcategory', title: 'SUB CATEGORIA' }, { data: 'dt_amount', title: 'VALOR' }, { data: 'dt_image', title: 'IMAGEN' } ], endpoints: { pdf: 'pdf-gasto', excel: 'excel-gasto' } }, 'asistencia': { title: 'Control de Asistencia', columns: [ { data: 'id', title: 'ID' }, { data: 'dt_client', title: 'CLIENTE' }, { data: 'dt_date', title: 'FECHA' }, { data: 'dt_time', title: 'HORA' }, { data: 'dt_status', title: 'ESTADO' } ], endpoints: { pdf: 'pdf-asistencia', excel: 'excel-asistencia' } }, 'productos': { title: 'Inventario General de Productos', columns: [ { data: 'id', title: '#' }, { data: 'name', title: 'PRODUCTO' }, { data: 'dt_category', title: 'CATEGORÍA' }, { data: 'dt_warehouse', title: 'BODEGA' }, { data: 'dt_purchase_price', title: 'COSTO' }, { data: 'dt_sale_price', title: 'VENTA' }, { data: 'dt_stock', title: 'STOCK' }, { data: 'dt_total_cost', title: 'TOTAL' } ], endpoints: { pdf: 'pdf-productos', excel: 'excel-productos' } }, 'estado-resultados': { title: 'Estado de Resultados (Pérdidas y Ganancias)', columns: [ { data: 'dt_concept', title: 'CONCEPTO / CUENTA' }, { data: 'dt_amount', title: 'MONTO' }, { data: 'dt_perc', title: '%' }, { data: 'dt_type', title: 'TIPO' } ], endpoints: { pdf: 'pdf-estado-resultados', excel: 'excel-estado-resultados' } }, 'traslados': { title: 'Reporte de Traslados entre Bodegas', columns: [ { data: 'dt_id', title: 'ID' }, { data: 'dt_date', title: 'FECHA Y HORA' }, { data: 'dt_product', title: 'PRODUCTO' }, { data: 'dt_route', title: 'RUTA (ORIGEN -> DESTINO)' }, { data: 'dt_qty', title: 'CANTIDAD' }, { data: 'dt_user', title: 'REALIZADO POR' } ], endpoints: { pdf: 'pdf-traslados', excel: 'excel-traslados' } }, 'ajustes': { title: 'Reporte de Ajustes de Inventario', columns: [ { data: 'dt_id', title: 'ID' }, { data: 'dt_date', title: 'FECHA Y HORA' }, { data: 'dt_product', title: 'PRODUCTO' }, { data: 'dt_warehouse', title: 'BODEGA' }, { data: 'dt_type', title: 'TIPO' }, { data: 'dt_qty', title: 'CANTIDAD' }, { data: 'dt_user', title: 'REALIZADO POR' } ], endpoints: { pdf: 'pdf-ajustes', excel: 'excel-ajustes' } } }; $(document).ready(function() { // Inicializar sin rango para cargar todos los registros disponibles. updateDateSubtitle(); loadReportData(); // Listeners de Pestañas $('.nav-tabs-line .nav-link').click(function() { $('.nav-tabs-line .nav-link').removeClass('active'); $(this).addClass('active'); currentType = $(this).data('type'); // Mostrar/Ocultar filtro de bodega y botones rápidos if (currentType === 'productos' || currentType === 'traslados') { $('#warehouse-filter-container').fadeIn(); if (currentType === 'productos') { $('#quick-warehouse-reports').fadeIn(); } else { $('#quick-warehouse-reports').fadeOut(); } } else { $('#warehouse-filter-container').fadeOut(); $('#quick-warehouse-reports').fadeOut(); $('#warehouse_id').val(''); } loadReportData(); }); // Listener de Filtros $('#filter-form').submit(function(e) { e.preventDefault(); $('.quick-filters .btn').removeClass('active'); // Quitar activos rápidos si se usa manual loadReportData(); }); }); function setQuickDate(range, btn) { $('.quick-filters .btn').removeClass('active'); if(btn) $(btn).addClass('active'); const today = new Date(); let start = new Date(); let end = new Date(); switch(range) { case 'todo': $('#fecha_desde').val(''); $('#fecha_hasta').val(''); updateDateSubtitle(); loadReportData(); return; case 'hoy': break; case 'semana': start.setDate(today.getDate() - today.getDay() + (today.getDay() === 0 ? -6 : 1)); // Lunes break; case 'mes': start = new Date(today.getFullYear(), today.getMonth(), 1); end = new Date(today.getFullYear(), today.getMonth() + 1, 0); break; case 'trimestre': const quarter = Math.floor(today.getMonth() / 3); start = new Date(today.getFullYear(), quarter * 3, 1); end = new Date(today.getFullYear(), start.getMonth() + 3, 0); break; case 'ano': start = new Date(today.getFullYear(), 0, 1); end = new Date(today.getFullYear(), 11, 31); break; } $('#fecha_desde').val(start.toISOString().split('T')[0]); $('#fecha_hasta').val(end.toISOString().split('T')[0]); updateDateSubtitle(); loadReportData(); } function resetFilters() { $('#fecha_desde').val(''); $('#fecha_hasta').val(''); $('.quick-filters .btn').removeClass('active'); $('.quick-filters .btn').first().addClass('active'); updateDateSubtitle(); loadReportData(); } function updateDateSubtitle() { const d = $('#fecha_desde').val(); const h = $('#fecha_hasta').val(); let text = 'Todos los registros históricos'; if(d && h) text = `${d.split('-').reverse().join('/')} - ${h.split('-').reverse().join('/')}`; else if(d) text = `Desde ${d.split('-').reverse().join('/')}`; else if(h) text = `Hasta ${h.split('-').reverse().join('/')}`; $('#current-date-range').text(text); } function loadReportData() { const desde = $('#fecha_desde').val(); const hasta = $('#fecha_hasta').val(); const warehouse_id = $('#warehouse_id').val(); // UI Feedback $('#table-dynamic-title').html(`<i class="bi bi-hourglass-split"></i> Cargando ${reportConfig[currentType].title}...`); $.ajax({ url: base_url + 'admin/ReporteController/getReportData', type: 'POST', data: { type: currentType, desde: desde, hasta: hasta, warehouse_id: warehouse_id }, dataType: 'json', success: function(res) { if(res.status === 'success') { renderSummaryCards(res.summary); renderTable(res.data); $('#table-dynamic-title').html(`<i class="bi bi-table"></i> ${reportConfig[currentType].title}`); } else { alertaPesonalizada('error', res.message || 'Error al obtener datos'); } }, error: function(xhr) { const message = xhr.responseJSON?.message || 'Error al obtener datos'; alertaPesonalizada('error', message); } }); } function renderSummaryCards(summaryArr) { let html = ''; summaryArr.forEach(card => { html += ` <div class="col-md-3 mb-3"> <div class="summary-card ${card.color}"> <div class="summary-title"><i class="bi ${card.icon}"></i> ${card.title}</div> <div class="summary-value">${card.value}</div> </div> </div>`; }); $('#summary-cards-container').html(html); } function renderTable(dataArray) { if(dataTable !== null) { dataTable.destroy(); $('#reportTable').empty(); } const config = reportConfig[currentType]; let dtOptions = { data: dataArray, columns: config.columns, columnDefs: [{ targets: '_all', defaultContent: '' }], language: { url: base_url + "assets/DataTables/es-ES.json" }, pageLength: 10, responsive: true, destroy: true, order: [[0, 'desc']] }; // Si es estado de resultados, mantenemos el orden fijo (según viene de la lógica contable) // y desactivamos la opción de ordenar por columnas para que no se desordene. if (currentType === 'estado-resultados') { dtOptions.ordering = false; dtOptions.order = []; // Mantiene el orden original que viene del servidor dtOptions.paging = false; // Mostrar todos los conceptos contables de una vez dtOptions.searching = false; // No es necesario buscar en un estado de resultados dtOptions.info = false; // Ocultar info de registros } dataTable = $('#reportTable').DataTable(dtOptions); } function downloadExport(format) { const desde = $('#fecha_desde').val(); const hasta = $('#fecha_hasta').val(); const warehouse_id = $('#warehouse_id').val(); const endpoint = reportConfig[currentType].endpoints[format]; let queryParams = []; if(desde) queryParams.push(`desde=${desde}`); if(hasta) queryParams.push(`hasta=${hasta}`); if(warehouse_id && (currentType === 'productos' || currentType === 'traslados')) queryParams.push(`warehouse_id=${warehouse_id}`); const queryString = queryParams.length > 0 ? '?' + queryParams.join('&') : ''; const url = `${base_url}admin/${endpoint}${queryString}`; window.open(url, '_blank'); } </script> <?php $this->endSection(); ?>
Coded With 💗 by
0x6ick