<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>التقرير المالي</title>
    <style>
        * { font-family: 'xbriyaz', sans-serif; }
        body { margin: 20px; font-size: 12px; color: #333; direction: rtl; text-align: right; }
        .header { text-align: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid #10b981; }
        .logo { font-size: 22px; font-weight: bold; color: #10b981; }
        .title { font-size: 18px; margin-top: 8px; }
        .period { font-size: 12px; color: #666; margin-top: 5px; }
        .stats { margin: 20px 0; display: table; width: 100%; }
        .stat-row { display: table-row; }
        .stat-cell { display: table-cell; padding: 8px 12px; border: 1px solid #e2e8f0; }
        .stat-label { font-weight: bold; color: #64748b; }
        .stat-value { font-size: 14px; font-weight: bold; }
        table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 11px; }
        th, td { border: 1px solid #e2e8f0; padding: 8px 10px; text-align: right; }
        th { background: #f8fafc; font-weight: bold; }
        .footer { margin-top: 30px; text-align: center; font-size: 10px; color: #94a3b8; }
    </style>
</head>
<body dir="rtl">
    <div class="header">
        <div class="logo">تاجر بلس</div>
        <div class="title">التقرير المالي الشامل</div>
        <div class="period">الفترة: <?php echo e($startDate); ?> — <?php echo e($endDate); ?></div>
    </div>

    <div class="stats">
        <div class="stat-row">
            <div class="stat-cell stat-label">إجمالي الإيرادات</div>
            <div class="stat-cell stat-value"><?php echo e(number_format($totalRevenue, 2)); ?> EGP</div>
        </div>
        <div class="stat-row">
            <div class="stat-cell stat-label">الشحن ورسوم الدفع</div>
            <div class="stat-cell stat-value"><?php echo e(number_format($totalShippingFees, 2)); ?> EGP</div>
        </div>
        <div class="stat-row">
            <div class="stat-cell stat-label">مديونية الموردين</div>
            <div class="stat-cell stat-value"><?php echo e(number_format($totalSupplierDebt, 2)); ?> EGP</div>
        </div>
        <div class="stat-row">
            <div class="stat-cell stat-label">تقدير صافي الربح</div>
            <div class="stat-cell stat-value"><?php echo e(number_format($netProfit, 2)); ?> EGP</div>
        </div>
        <div class="stat-row">
            <div class="stat-cell stat-label">عدد الطلبات</div>
            <div class="stat-cell stat-value"><?php echo e($ordersCount); ?></div>
        </div>
    </div>

    <h3 style="margin-top: 25px; font-size: 14px;">أحدث المعاملات</h3>
    <table dir="rtl">
        <thead>
            <tr>
                <th>#</th>
                <th>التاريخ</th>
                <th>التاجر</th>
                <th>الحالة</th>
                <th>الإجمالي</th>
            </tr>
        </thead>
        <tbody>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $recentOrders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $o): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
            <tr>
                <td><?php echo e($i + 1); ?></td>
                <td><?php echo e($o->created_at->format('Y-m-d H:i')); ?></td>
                <td><?php echo e($o->user?->name ?? '-'); ?></td>
                <td><?php echo e($statusLabels[$o->status] ?? $o->status); ?></td>
                <td><?php echo e(number_format($o->total, 2)); ?> EGP</td>
            </tr>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
        </tbody>
    </table>

    <div class="footer">
        تم إنشاء التقرير في <?php echo e(now()->format('Y-m-d H:i')); ?>

    </div>
</body>
</html>
<?php /**PATH E:\Laravel-Project\tager_plus\resources\views/pdf/financial-report.blade.php ENDPATH**/ ?>