<?php

require __DIR__.'/vendor/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();

echo "====================================\n";
echo "Check Marketing Officer Payments\n";
echo "====================================\n\n";

$payments = DB::table('marketing_officer_payments')
    ->where('marketing_officer_id', 28)
    ->orderBy('created_at', 'desc')
    ->get();

echo "Found " . $payments->count() . " payments\n\n";

foreach ($payments as $payment) {
    echo "Payment ID: {$payment->id}\n";
    echo "Period: {$payment->period_start} to {$payment->period_end}\n";
    echo "Status: {$payment->status}\n";
    echo "Commission: \${$payment->commission_amount}\n";
    echo "Invoice File: " . ($payment->invoice_file ?? 'NULL') . "\n";
    echo "Payment Description: " . ($payment->payment_description ?? 'NULL') . "\n";
    echo "Notes: " . ($payment->notes ?? 'NULL') . "\n";
    echo "Paid At: " . ($payment->paid_at ?? 'NULL') . "\n";
    echo "\n";
}
