@extends('pdf.layouts.interior') @section('title','Invoice') @section('content') {{-- HEADER --}}
Cusella
Veenalukkal Parappur, po, Kottakkal, Kerala 676503
Contact:094955 92491, 9876543210
INVOICE
{{-- CLIENT INFO --}}
Name: {{ $project->client_name }} Date: {{ now()->format('d-M-Y') }}
Contact: {{ $project->client_phone }} Invoice No: {{ $project->invoice_no }}
{{-- ITEM TABLE --}} @php $i = 1; @endphp @foreach($project->areas as $area) @foreach($area->items as $item) @php $unit = 'Nos'; $qty = 0; $price = 0; $amount = 0; // ============================== // NON CUSTOM PRODUCTS // ============================== if($item->is_custom == 0){ $price = (float) ($item->variant->offer_price ?? 0); $qty = (float) ($item->quantity ?? 1); $amount = $price * $qty; if($item->category == 'curtain'){ $unit = 'Pcs'; } elseif($item->category == 'wallpaper'){ $unit = 'Rolls'; } } // ============================== // CUSTOM CURTAIN // ============================== elseif($item->category == 'curtain' && $item->curtain && $item->measurement){ $fw = (float) $item->curtain->fabric_width; $ww = (float) $item->measurement->width; $wh = (float) $item->measurement->height; $price = (float) $item->curtain->price_per_meter; if($fw > 0){ $panels = ceil($ww / $fw); $qty = $panels * $wh; // fabric in meters } $unit = 'Meter'; $amount = $qty * $price; } // ============================== // CUSTOM WALLPAPER // ============================== elseif($item->category == 'wallpaper' && $item->wallpaper){ $rw = (float) $item->wallpaper->roll_width; $rl = (float) $item->wallpaper->roll_length; $ww = (float) $item->wallpaper->wall_width; $wh = (float) $item->wallpaper->wall_height; $rep = (float) ($item->wallpaper->design_repeat ?? 0); $price = (float) $item->wallpaper->price_per_roll; if($rw > 0 && $rl > 0){ $cuttings = ceil($ww / $rw); $totalLength = $cuttings * ($wh + $rep); $qty = ceil($totalLength / $rl); } $unit = 'Rolls'; $amount = $qty * $price; } @endphp @if($item->is_custom == 0) @if($item->category == 'curtain') @elseif($item->category == 'wallpaper') @else @endif @elseif($item->category == 'curtain' && $item->curtain && $item->measurement) @php $fw = (float) $item->curtain->fabric_width; $ww = (float) $item->measurement->width; $wh = (float) $item->measurement->height; $qty = ($fw > 0) ? ceil($ww / $fw) * $wh : 0; @endphp @elseif($item->category == 'wallpaper' && $item->wallpaper) @php $rw = (float) $item->wallpaper->roll_width; $rl = (float) $item->wallpaper->roll_length; $ww = (float) $item->wallpaper->wall_width; $wh = (float) $item->wallpaper->wall_height; $rep = (float) ($item->wallpaper->design_repeat ?? 0); $cuttings = ($rw > 0) ? ceil($ww / $rw) : 0; $qty = ($rl > 0) ? ceil(($cuttings * ($wh + $rep)) / $rl) : 0; @endphp @else @endif @endforeach @endforeach
No Item Unit Qty Price Amount
{{ $i++ }} {{ ucfirst($item->category) }} {{ $unit }} {{ $item->quantity }} pcs{{ $item->quantity }} rolls{{ $item->quantity }}{{ $qty > 0 ? number_format($qty,2).' m' : '-' }}{{ $qty > 0 ? $qty.' rolls' : '-' }}-{{ $price > 0 ? number_format($price,2) : '-' }} {{ $amount > 0 ? number_format($amount,2) : '-' }}
{{-- TOTAL SECTION --}}
Subtotal : ₹ {{ number_format($project->subtotal, 2) }}
GST : ₹ {{ number_format($project->tax, 2) }}
Grand Total : ₹ {{ number_format($project->grand_total, 2) }}
{{ number_format($project->grand_total, 2) }} RUPEES ONLY
₹ {{ number_format($project->grand_total,2) }}
{{-- TERMS --}}
Terms & Conditions

{!! $project->terms !!}
{{-- FOOTER --}}
Authorized Signature
@endsection