| {{ $product->id }} |
{{ $product->customer->name }} |
{{ $product->created_at->format('Y-m-d') }} |
{{ $product->branch->name }} |
@php
// حساب الإجماليات والخصومات
$items = App\Models\offer_price_to_customer_items::where('order_id', $product->id)->get();
$subTotal = $items->sum(fn($i) => $i->PriceWithoudTax * $i->quantity);
$itemsDiscount = $items->sum('discount');
// خصم إضافي على مستوى الفاتورة
$invoice = App\Models\offer_price_to_customer::find($product->id);
$extraDiscount = $invoice ? $invoice->discount : 0;
$totalNet = round($subTotal, 2) - round($itemsDiscount + $extraDiscount, 2);
$totalWithTax = round($totalNet * $avtRate, 2) + $totalNet;
@endphp
{{ number_format($totalWithTax, 2) }}
|
|
@endforeach