<table>
    <thead>
        <tr></tr>
    </thead>
    <tbody>
        <td></td>
    </tbody>
</table>
<table class="table table-striped mt-2" style="width:100%">
    <thead>
        <tr>
            <th display="none"></th>
            <th display="none"></th>
            <th style="text-align: center">Invoice</th>
            <th style="text-align: center">Tanggal</th>
            <th style="text-align: center">Jam</th>
            <th style="text-align: center">User</th>
            <th style="text-align: center">Staff</th>
            <th style="text-align: center">Member</th>
            <th style="text-align: center">Item Code</th>
            <th style="text-align: center">Item Barcode</th>
            <th style="text-align: center">Item Name</th>
            <?php if($udf): ?>
                <?php $__currentLoopData = $field; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fld): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <th style="text-align: center">
                        Item <?php echo e(Str::after($fld, 'U_IDU_')); ?>

                    </th>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
            <th style="text-align: center">Qty</th>
            <th style="text-align: center">Price</th>
            <th style="text-align: center">Disc</th>
            <th style="text-align: center">Sub Total</th>
            <th style="text-align: center">Grand Total</th>

        </tr>
    </thead>
    <tbody>
        <?php
            $totalDiscount = 0;
            $totalSumsubtotal = 0;
        ?>
        <?php $__currentLoopData = $invoicesdetail; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $discount = $invoice->nprice - $invoice->price;
                $totalDiscount += $discount;
                $subtotal = $invoice->nprice * $invoice->qty;
                $totalSumsubtotal += $subtotal;
            ?>
            <tr>
                <td display="none"></td>
                <td display="none"></td>
                <td><?php echo e($invoice->invoice); ?></td>
                <td><?php echo e($invoice->created_at->format('d/m/y')); ?></td>
                <td><?php echo e($invoice->created_at->format('H:i')); ?></td>
                <td><?php echo e($invoice->kasir->name); ?></td>
                <td><?php echo e($invoice->sales->name); ?></td>
                <?php if($invoice->id_member): ?>
                    <td><?php echo e($invoice->member->name); ?></td>
                <?php else: ?>
                    <td> - </td>
                <?php endif; ?>
                <td><?php echo e($invoice->item->code); ?></td>
                <td><?php echo e($invoice->item->barcode); ?></td>
                <td><?php echo e($invoice->item->name); ?></td>
                <?php if($udf): ?>
                    <?php $__currentLoopData = $field; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fld): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <td><?php echo e($invoice->item->$fld ?? '-'); ?></td>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
                <td><?php echo e($invoice->qty); ?></td>
                <td><?php echo e($invoice->nprice); ?></td>
                <td><?php echo e($discount); ?></td>
                <td><?php echo e($subtotal); ?></td>
                <td><?php echo e($invoice->total_price); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <td display="none"></td>
            <td display="none"></td>
            <td colspan="9">Grand Total</td>
            <?php if($udf): ?>
                <?php $__currentLoopData = $field; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fld): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <td display="none"></td>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
            <?php
                $totalQty = $invoicesdetail
                    ->filter(function ($detail) {
                        return $detail->qty > 0;
                    })
                    ->sum('qty');
            ?>

            <td><?php echo e($totalQty); ?></td>
            <td></td>
            <td><?php echo e($totalDiscount); ?></td>
            <td><?php echo e($totalSumsubtotal); ?></td>
            <td><?php echo e($invoicesdetail->sum('total_price')); ?></td>
        </tr>
    </tbody>
</table>
<?php /**PATH C:\laragon\www\rybc\resources\views/export/tabledetail.blade.php ENDPATH**/ ?>