Seaco Tex Fabrics Limited

@php $prevLc = null; $groupTotal = 0; $grandTotal = 0; @endphp @foreach ($data as $item) {{-- যখন LC পরিবর্তন হবে, তখন আগের LC-এর subtotal দেখাও --}} @if ($prevLc !== null && $prevLc != $item->export_lc_id) {{-- space / break --}} @php $groupTotal = 0; // reset for next LC @endphp @endif @php $groupTotal += $item->pi_value; $grandTotal += $item->pi_value; $prevLc = $item->export_lc_id; @endphp {{-- Normal data row --}} @endforeach {{-- 🔥 Last LC subtotal (loop শেষে একবার দিতে হবে) --}} {{-- 🔥 Grand Total --}}
BACK TO BACK DETAILS
Sl Bank Master LC B2B LC B2B Date Amount Supplier Item Item Qty Country Maturity Date
Subtotal : {{ number_format($groupTotal, 2) }}

{{ $loop->iteration }} {{ $item->bank?->short_name }} {{ $item->exportLc?->lc_number }} {{ $item->pi_number }} {{ $item->pi_date }} {{ number_format($item->pi_value, 2) }} {{ $item->supplier?->supplier_name }} {{ $item->draft_purpose }} {{ $item->RMG_for }} {{ $item->Pi_country }} {{ $item->expiry_date }}
Subtotal : {{ number_format($groupTotal, 2) }}
Grand Total : {{ number_format($grandTotal, 2) }}


@if(count($invoice) > 0 == 0)

===No export yet===

@else @php $prevLc = null; $groupAmount = 0; $groupQty = 0; $grandAmount = 0; $grandQty = 0; @endphp @foreach($invoice as $item) {{-- 🔁 LC change হলে আগের LC এর subtotal --}} @if ($prevLc !== null && $prevLc != $item->export_lc_id) {{-- break --}} @php $groupAmount = 0; $groupQty = 0; @endphp @endif @php // group total $groupAmount += $item->amount; $groupQty += $item->invoice_qty; // grand total $grandAmount += $item->amount; $grandQty += $item->invoice_qty; $prevLc = $item->export_lc_id; @endphp {{-- Normal invoice row --}} @endforeach {{-- 🔥 Last LC subtotal --}} {{-- 🔥 Grand Total --}}
INVOICE DETAILS
Sl Master LC Invoice Date Amount Qty Unit N W EXP Date SB/C no Date PRC Date PRC value
Subtotal : {{ number_format($groupAmount, 2) }} {{ $groupQty }}

{{ $loop->iteration }} {{ $item->exportLc?->lc_number }} {{ $item->invoice_number }} {{ $item->invoice_date }} {{ number_format($item->amount, 2) }} {{ $item->invoice_qty }} {{ $item->unit }} {{ $item->net_weight }} {{ $item->exp_number }} {{ $item->exp_date }} {{ $item->shipping_bill_number }} {{ $item->shipping_bill_date }} {{ $item->PRC_number }} {{ $item->PRC_date }} {{ number_format($item->PRC_value, 2) }}
Subtotal : {{ number_format($groupAmount, 2) }} {{ $groupQty }}
Grand Total : {{ number_format($grandAmount, 2) }} {{ $grandQty }}
@endif