<table>
    <thead>
        <tr>
            <th>Référence</th>
            <th>Client</th>
            <th>Produit</th>
            <th>Magasin</th>
            <th>Montant total</th>
            <th>Montant payé</th>
            <th>Montant restant</th>
            <th>Date</th>
        </tr>
    </thead>
    <tbody>
        <?php $__currentLoopData = $creances; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $vente = $c->vente;
                $client = $c->client;
                $produit = $vente?->produit;
                $magasin = $vente?->magasin;

                $montant = (float) ($vente?->montant ?? 0);
                $reste = (float) ($c->montant_restant ?? 0);
                $paye = max(0, $montant - $reste);
            ?>
            <tr>
                <td><?php echo e($vente?->reference ?? ('CR-' . $c->id)); ?></td>
                <td><?php echo e($client?->nom ?? '—'); ?></td>
                <td><?php echo e($produit?->designation ?? '—'); ?></td>
                <td><?php echo e($magasin?->nom ?? '—'); ?></td>
                <td><?php echo e($montant); ?></td>
                <td><?php echo e($paye); ?></td>
                <td><?php echo e($reste); ?></td>
                <td><?php echo e(optional($vente?->date_vente)->format('Y-m-d')); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody>
</table>

<?php /**PATH C:\Softsys\stock_transfert\resources\views\exports\factures.blade.php ENDPATH**/ ?>