@php $fromCompany = $quotation->company_name ?: ($seller->company_name ?: $seller->name); $fromAddress = $quotation->address ?: ''; $fromGstin = $quotation->gstin ?: ($seller->gst_number ?: ''); $toCompany = $quotation->bill_to_company ?: ''; $toAddress = $quotation->bill_to_address ?: ''; $toGstin = $quotation->bill_to_gstin ?: ''; $quotationNo = $quotation->quotation_no ?: ('AIM-QT-'.str_pad((string) $quotation->enquiry_id, 4, '0', STR_PAD_LEFT).'-V'.$quotation->version_number); $quotationDate = optional($quotation->quotation_date)->format('d M Y') ?: now()->format('d M Y'); $items = $quotation->items->map(fn ($i) => [ 'product_name' => (string) $i->product_name, 'description' => (string) ($i->description ?? ''), 'quantity' => (int) $i->quantity, 'price' => (float) $i->price, ]); $subtotal = (float) $items->sum(fn ($i) => ((int) $i['quantity']) * ((float) $i['price'])); $tax = (float) ($quotation->tax ?? 0); $total = $subtotal + $tax; $termsText = trim((string) ($quotation->terms ?? '')); $termsLines = $termsText ? collect(preg_split("/\\r?\\n/", $termsText))->map(fn ($l) => trim((string) $l))->filter()->values() : collect(); $terms = $termsLines->map(function ($line) { $idx = mb_strpos($line, ':'); if ($idx === false) { return ['title' => 'Term', 'body' => $line]; } return [ 'title' => trim(mb_substr($line, 0, $idx)), 'body' => trim(mb_substr($line, $idx + 1)), ]; })->take(3)->values(); @endphp
RESELLER TO CUSTOMER
Quotation
@if($quotation->logo) Logo @else
Reseller Logo
@endif
FROM
{{ $fromCompany ?: '—' }}
{!! nl2br(e($fromAddress ?: '—')) !!}
@if($fromGstin)
GST: {{ $fromGstin }}
@endif
TO
{{ $toCompany ?: '—' }}
{!! nl2br(e($toAddress ?: '—')) !!}
@if($toGstin)
GSTIN: {{ $toGstin }}
@endif
DATE
{{ $quotationDate }}
QUOTE NO.
{{ $quotationNo }}
PRODUCT SPECIFICATIONS
@foreach($items as $item) @endforeach
Description Qty Rate Price
{{ $item['product_name'] ?: '—' }}
@if($item['description'])
{{ $item['description'] }}
@endif
{{ $item['quantity'] ?: '—' }} ₹ {{ number_format($item['price'], 2) }} ₹ {{ number_format(((int) $item['quantity']) * ((float) $item['price']), 2) }}
PHOTO OF SS
PROVIDED BY US
@if($quotation->ss_photo) SS Photo @else
Attach photo here
@endif
DEFAULT REF.
IMAGE
@if($quotation->ref_image) Ref Image @else
Attach ref. image here
@endif
Pricing Summary
Total
₹ {{ number_format($subtotal, 2) }}
GST (18%)
₹ {{ number_format($tax, 2) }}
G. Total ₹ {{ number_format($total, 2) }}
TERMS & CONDITIONS
@foreach($terms as $idx => $t)
{{ $idx + 1 }}
{{ $t['title'] }}
{{ $t['body'] }}
@endforeach