<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">Item Barcode</th>
            <th style="text-align: center">Item Name</th>
            @if ($udf)
                @foreach ($field as $fld)
                    <th style="text-align: center">
                        Item {{ Str::after($fld, 'U_IDU_') }}
                    </th>
                @endforeach
            @endif
            <th style="text-align: center">Jenis</th>
            <th style="text-align: center">User</th>
            <th style="text-align: center">Staff</th>
            <th style="text-align: center">Qty</th>
            <th style="text-align: center">Sub Total</th>
            <th style="text-align: center">Discount</th>
            <th style="text-align: center">Grand Total</th>
            
        </tr>
    </thead>
    <tbody>
        @foreach ($arinvoices as $inv)
            @foreach ($inv->detailInvoices as $invoice)
                <tr>
                    <td display="none"></td>
                    <td display="none"></td>
                    <td>{{ $invoice->invoice }}</td>
                    <td>{{ $invoice->created_at->format('d/m/y') }}</td>
                    <td>{{ $invoice->created_at->format('H:i') }}</td>
                    <td>{{ $invoice->code }}</td>
                    <td>{{ $invoice->name }}</td>
                    @if ($udf)
                        @foreach ($field as $fld)
                            <td>{{ $invoice->item->$fld ?? '-' }}</td>
                        @endforeach
                    @endif
                    {{-- mz --}}
                    @if ($inv->payment == '')
                        <td> - </td>
                    @else
                        <td>{{ $inv->payment }}</td>
                    @endif
                    <td>{{ $invoice->kasir->name }}</td>
                    <td>{{ $invoice->sales->name }}</td>
                    <td>{{ $invoice->qty }}</td>
                    <td>{{ $invoice->qty * $invoice->nprice }}</td>
                    <td>{{ ($invoice->nprice - $invoice->price) * $invoice->qty }}</td>
                    <td>{{ $invoice->qty * $invoice->nprice - ($invoice->nprice - $invoice->price) * $invoice->qty }}
                    </td>
                    
                </tr>
            @endforeach
        @endforeach
    </tbody>
</table>
