<!DOCTYPE html>
<html lang="ur" dir="rtl">
<head>
    <meta charset="UTF-8">
    <title>Aging Payables — Print</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: Arial, sans-serif; font-size: 12px; background: #fff; color: #000; }
        .container { width: 96%; margin: 18px auto; }

        /* Header */
        .rpt-header { text-align: center; margin-bottom: 10px; }
        .rpt-header .co-name  { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
        .rpt-header .co-sub   { font-size: 14px; font-weight: 600; margin-top: 2px; }
        .rpt-header .co-range { font-size: 12px; margin-top: 4px; color: #222; }

        /* Table */
        table { width: 100%; border-collapse: collapse; margin-top: 10px; direction: rtl; }

        thead th {
            border: 1px solid #000;
            padding: 8px 10px;
            text-align: center;
            font-size: 13px;
            font-weight: 700;
            background: #fff;
            white-space: nowrap;
        }

        /* Solid side borders, dashed bottom — exact image match */
        tbody td {
            border-left:   1px solid #000;
            border-right:  1px solid #000;
            border-top:    none;
            border-bottom: 1px dashed #555;
            padding: 7px 10px;
            vertical-align: middle;
            font-size: 12px;
        }

        td.col-party  { text-align: right;  font-size: 13px; font-weight: 600; }
        td.col-num    { text-align: center; white-space: nowrap; width: 115px; }
        td.col-haliah { text-align: center; font-weight: 700;   white-space: nowrap; width: 125px; }

        tr.total-row td {
            border-top:    2px solid #000 !important;
            border-bottom: 2px solid #000 !important;
            background: #f0f0f0;
            font-weight: 700;
            text-align: center;
            font-size: 12px;
            padding: 8px 10px;
        }

        .no-print {
            margin-top: 20px;
            display: inline-block;
            padding: 9px 22px;
            background: #007bff;
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 13px;
            border-radius: 3px;
        }

        @media  print {
            .no-print { display: none; }
            thead { display: table-header-group; }
            tfoot { display: table-footer-group; }
            tr    { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
<div class="container">

    
    <div class="rpt-header">
        <div class="co-name">M.D.S</div>
        <div class="co-sub">ادائیگی ادھاری &nbsp;&nbsp;&nbsp; Aging Payables</div>
        <div class="co-range">
            مورخہ:
            <?php echo e($fromDate ? \Carbon\Carbon::parse($fromDate)->format('d/m/Y') : '—'); ?>

            تا
            <?php echo e($toDate   ? \Carbon\Carbon::parse($toDate)->format('d/m/Y')   : '—'); ?>

        </div>
    </div>

    <?php if(empty($reportData['rows'])): ?>
        <p style="text-align:center;padding:30px;color:#888;">کوئی اندراج نہیں ملا۔</p>
    <?php else: ?>

        <?php
            // negative → (1,234,567)  |  zero → $z  |  positive → 1,234,567
            $fmt = fn($v, $z = '-') => $v == 0
                ? $z
                : ($v < 0
                    ? '(' . number_format(abs($v), 0) . ')'
                    : number_format($v, 0));
        ?>

        <table>
            <thead>
                <tr>
                    <th>پارٹی</th>
                    <th>سابقہ بیلنس</th>
                    <th>خرید وغیرہ</th>
                    <th>ادائیگی</th>
                    <th>حالیہ بیلنس</th>
                </tr>
            </thead>
            <tbody>

                <?php $__currentLoopData = $reportData['rows']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        
                        <td class="col-party"><?php echo e($row['supplier_name']); ?></td>

                        
                        <td class="col-num"><?php echo e($fmt($row['sabiqah'])); ?></td>

                        
                        <td class="col-num">
                            <?php echo e($row['kharid'] == 0 ? '-' : number_format($row['kharid'], 0)); ?>

                        </td>

                        
                        <td class="col-num">
                            <?php echo e($row['adaegi'] == 0 ? '0' : number_format($row['adaegi'], 0)); ?>

                        </td>

                        
                        <td class="col-haliah"><?php echo e($fmt($row['haliah'], '0')); ?></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                
                <tr class="total-row">
                    <td>کُل مجموعہ</td>
                    <td><?php echo e($fmt($reportData['grandSabiqah'], '0')); ?></td>
                    <td><?php echo e(number_format($reportData['grandKharid'], 0)); ?></td>
                    <td><?php echo e(number_format($reportData['grandAdaegi'], 0)); ?></td>
                    <td><?php echo e($fmt($reportData['grandHaliah'], '0')); ?></td>
                </tr>

            </tbody>
        </table>
    <?php endif; ?>

    <button class="no-print" onclick="window.print()">Print Report</button>

</div>
</body>
</html><?php /**PATH /home/mdskssye/crm.mdskarachi.com/resources/views/reports/aging_payables_print_view.blade.php ENDPATH**/ ?>