<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>استمارة 6 - الاشتراكات الشهرية<?php $__template->endSection(); ?>
<?php $__template->section('page_actions'); ?>
<button onclick="window.print();" class="btn btn-primary">طباعة</button>
<a href="/hr/insurance" class="btn btn-secondary">رجوع</a>
<?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<div class="card">
    <div style="padding:16px;border-bottom:1px solid #E5E7EB;"><h3 style="margin:0;font-size:16px;">استمارة 6 - <?= e($month . '/' . $year) ?></h3></div>
    <div class="table-responsive">
        <table class="data-table">
            <thead><tr><th>#</th><th>الاسم</th><th>رقم التأمين</th><th>الأساسي</th><th>المتغير</th><th>حصة الموظف</th><th>حصة صاحب العمل</th></tr></thead>
            <tbody>
                <?php if (empty($records)): ?>
                <tr><td colspan="7" style="text-align:center;padding:40px;color:#9CA3AF;">لا توجد بيانات</td></tr>
                <?php else: ?>
                <?php $i = 1; foreach ($records as $r): ?>
                <tr>
                    <td><?= $i++ ?></td>
                    <td><?= e($r['first_name_ar'] . ' ' . $r['last_name_ar']) ?></td>
                    <td><?= e($r['insurance_number'] ?? '-') ?></td>
                    <td><?= number_format((float) $r['basic_insurable_salary'], 2) ?></td>
                    <td><?= number_format((float) $r['variable_insurable_salary'], 2) ?></td>
                    <td><?= number_format((float) $r['total_employee_share'], 2) ?></td>
                    <td><?= number_format((float) $r['total_employer_share'], 2) ?></td>
                </tr>
                <?php endforeach; ?>
                <?php if ($totals): ?>
                <tr style="font-weight:700;border-top:2px solid #333;">
                    <td colspan="3">الإجمالي</td>
                    <td></td><td></td>
                    <td><?= number_format((float) ($totals['total_employee_share'] ?? 0), 2) ?></td>
                    <td><?= number_format((float) ($totals['total_employer_share'] ?? 0), 2) ?></td>
                </tr>
                <?php endif; ?>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__template->endSection(); ?>
