function getPaymentReport(array $filters = [], int $limit = 100, int $offset = 0): array { $hasCustomerId = $this->hasColumn('billing_payments', 'customer_id'); $hasRouterId = $this->hasColumn('billing_payments', 'router_id'); $hasRouterSession = $this->hasColumn('billing_payments', 'router_session'); $hasPaymentRef = $this->hasColumn('billing_payments', 'reference_number'); $hasVoid = $this->hasColumn('billing_payments', 'is_voided'); $sql = "SELECT bp.*, bi.period, bi.reference_number AS invoice_reference, bi.amount AS invoice_amount, bc.name AS customer_name, bc.phone, bc.service_number, bp_prof.profile_name FROM billing_payments bp INNER JOIN billing_invoices bi ON bp.invoice_id = bi.id LEFT JOIN billing_customers bc ON bi.customer_id = bc.id LEFT JOIN billing_profiles bp_prof ON bc.profile_id = bp_prof.id WHERE 1=1"; $