| {{ $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();
$totalpricePurchases = $items->sum(function($item) {
return $item->PriceWithoudTax * $item->quantity;
});
$totaldiscount = $items->sum('discount');
// خصم إضافي من جدول عرض السعر نفسه
$offerQuote = App\Models\offer_price_to_customer::find($product->id);
$extraDiscount = $offerQuote ? $offerQuote->discount : 0;
$netPrice = round($totalpricePurchases, 2) - round($totaldiscount + $extraDiscount, 2);
$total_value_quote = round($netPrice * $avtSaleRate, 2) + $netPrice;
@endphp
{{ number_format($total_value_quote, 2) }}
|
|
@endforeach