@foreach($invoice->sell_lines ?? [] as $line) @php $return_line = 0; if($line->is_deliver == 1) { $return_line = App\Models\DeliveryNoteLine::where('sale_line', $line->id)->where('status', 1)->sum('issue_quantity'); } $quantity = $line->quantity - $return_line; @endphp @if($quantity > 0) {{ $line->product->code ?? ''}} {{ $line->product->name ?? ''}} {{$line->store->name ?? ''}} {{$line->quantity ?? 0}} {{$quantity ?? 0}} @endif @endforeach