{{-- resources/views/quotes/quote_layout.blade.php --}} @php use Modules\Item\Models\Service; $bankAccount = $quote->franchise->province->bankAccount; $business = $quote->business; $user = $quote->user; $client = $business->primaryClient; $address = $business->primaryAddress; $province = $quote->franchise->province; $currency = config('globalSettings.currency.ZAR'); //dd($user->contact->contactMethods, $client->contact->contactMethods); // Excel-derived greens $green1 = '#297983'; $green2 = '#298C9C'; $green3 = '#4AC4D6'; $stampColour = $quote->status->getColor(); $quoteItems = $quote->quoteItems; $quoteServiceQty = []; //loop through each service and increment the quantity foreach ($quoteItems as $item) { $serviceId = $item->item->service_id; if (isset($quoteServiceQty[$serviceId])) { $quoteServiceQty[$serviceId] = [ 'service_id' => $quoteServiceQty[$serviceId]['service_id'], 'quantity' => $quoteServiceQty[$serviceId]['quantity'] + 1, 'subtotal' => $quoteServiceQty[$serviceId]['subtotal'] + $item->item_subtotal, 'vat' => $quoteServiceQty[$serviceId]['vat'] + $item->item_tax_total, 'total' => $quoteServiceQty[$serviceId]['total'] + $item->item_total ]; } else { $quoteServiceQty[$serviceId] = [ 'service_id' => $serviceId, 'quantity' => 1, 'subtotal' => $item->item_subtotal, 'vat' => $item->item_tax_total, 'total' => $item->item_total ]; } } $services = Service::where(Service::PROVINCE_ID, $province->province_id) ->orWhere(Service::PROVINCE_ID, null) ->orderBy(Service::ORDER) ->get(); $serviceItems = []; //Build the services based on the services used inside the quote->items foreach ($services as $service) { $quantity = $quoteServiceQty[$service->service_id]['quantity'] ?? 0; $serviceItems[] = [ 'name' => $service->service_name, 'quantity' => $quantity, 'subtotal' => $quantity ? $quoteServiceQty[$service->service_id]['subtotal'] : 0, 'vat' => $quantity ? $quoteServiceQty[$service->service_id]['vat'] : 0, 'total' => $quantity ? $quoteServiceQty[$service->service_id]['total'] : 0, ]; } //dd($serviceItems); @endphp
Description | Quantity | Sub | VAT {{ config('globalSettings.tax_rate') }}% | Total |
---|---|---|---|---|
{{ $line['name'] ?? '' }}
@if(!empty($line['note']))
{{ $line['note'] }}
@endif
|
{{ number_format($qty, 2) }} | {{ $currency . number_format($sub, 2, '.', ' ') }} | {{ $currency . number_format($vat, 2, '.', ' ') }} | {{ $currency . number_format($total, 2, '.', ' ') }} |
No items added. |