@php $customer = $creditNote->customer; $docOpts = $docSettings['options'] ?? []; $docLbl = $docSettings['labels'] ?? []; $statusKey = $creditNote->status; $primarySig = $settings['primary_signature_label'] ?? 'Provider Signature'; $secondarySig = $settings['secondary_signature_label'] ?? 'Receiver Signature'; $showTaxable = $settings['show_total_taxable_value'] ?? true; $roundOff = $settings['round_off_amount'] ?? false; $fmtTotal = function ($n) use ($roundOff) { return $roundOff ? number_format(round($n), 0) : number_format($n, 2); }; $billLines = $customer->billingAddressLines(); $shipLines = $customer->has_shipping_address ? $customer->shippingAddressLines() : $billLines; $totalAmount = (float) $creditNote->grand_total; $creditNoteTitle = $creditNoteTitle ?? \App\Helpers\CreditNoteDocumentSettings::title($company->id ?? null); $documentCopyLabel = $documentCopyLabel ?? ($documentCopies['original'] ?? 'Original Copy'); $docId = $docId ?? 'credit-note-doc'; $hasDiscountCol = $creditNote->items->contains(fn ($li) => (float) $li->discount_percent > 0); $forPdf = $forPdf ?? false; if ($forPdf) { $logoImage = $logoPath ?? \App\Helpers\CompanyMedia::pdfImagePath($company->logo_path ?? null); $signatureImage = $signaturePath ?? \App\Helpers\CompanyMedia::pdfImagePath($company->signature_image_path ?? null); } else { $logoImage = $logoPath ?? $logoSrc ?? \App\Helpers\CompanyMedia::imageSource($company->logo_path ?? null); $signatureImage = $signaturePath ?? $signatureSrc ?? \App\Helpers\CompanyMedia::imageSource($company->signature_image_path ?? null); } @endphp
@if(! $forPdf && ! ($forPublic ?? false)) @if($statusKey === 'open')
Open
@elseif($statusKey === 'closed')
Closed
@elseif($statusKey === 'void')
Void
@endif @endif
@if($logoImage) @endif

{{ $company->name ?? 'Company' }}

@php $companyLines = $company->fullAddressLines(); @endphp @if(! empty($companyLines)) @foreach($companyLines as $line)

{{ $line }}

@endforeach @elseif($company->address ?? $company->city)

{{ collect([$company->address, $company->city, $company->state, $company->pincode, $company->country])->filter()->implode(', ') }}

@endif @if($company->phone)

Phone: {{ $company->phone }}

@endif @if($company->email)

Email: {{ $company->email }}

@endif @if($company->gstin ?? null)

GSTIN: {{ $company->gstin }}

@endif

{{ $creditNoteTitle }}

#{{ $creditNote->credit_note_number }}

{{ $documentCopyLabel }}

@if($docOpts['show_credits_available'] ?? true)
Credits Available: ₹ {{ number_format((float) $creditNote->credits_available, 2) }}
@endif @if($creditNote->displayInvoiceNumber()) @endif @if($creditNote->displayInvoiceDate()) @endif @if(($gstMode ?? false) && ($placeOfSupplyLabel ?? null)) @endif
Date {{ $creditNote->credit_note_date->format('d - M - Y') }}
{{ $docLbl['invoice_number'] ?? 'Invoice no' }} {{ $creditNote->displayInvoiceNumber() }}
{{ $docLbl['invoice_date'] ?? 'Invoice date' }} {{ $creditNote->displayInvoiceDate()->format('d - M - Y') }}
Place of Supply {{ $placeOfSupplyLabel }}
@if($docOpts['show_shipping_address'] ?? false) @endif

{{ $customer->name }}

@if(($docOpts['show_contact_person'] ?? true) && $customer->contact_person)

{{ $customer->contact_person }}

@endif @foreach($billLines as $line)

{{ $line }}

@endforeach @if($customer->gstin)

GSTIN: {{ $customer->gstin }}

@endif
@foreach($shipLines as $line)

{{ $line }}

@endforeach @if(empty(array_filter($shipLines)))

Same as billing address

@endif
@if($gstMode ?? false) @include('partials.admin.document-gst-items', [ 'documentItems' => $creditNote->items, 'gstIsIgst' => $gstIsIgst ?? false, 'docLbl' => $docLbl, ]) @else @if($hasDiscountCol) @endif @foreach($creditNote->items as $i => $line) @php $qtyDisplay = number_format($line->quantity, 0) == $line->quantity ? (string) (int) $line->quantity : number_format($line->quantity, 3); $qtyUom = trim($qtyDisplay . ($line->unit ? ' ' . $line->unit : '')); @endphp @if($hasDiscountCol) @endif @endforeach
# {{ $docLbl['col_item'] ?? 'Item' }} & {{ $docLbl['col_description'] ?? 'Description' }} Qty / UoM Price (₹){{ $docLbl['col_discount'] ?? 'Discount' }}{{ $docLbl['col_tax'] ?? 'Tax' }} {{ $docLbl['col_total'] ?? 'Amount' }}
{{ $i + 1 }} {{ $line->item_name }} @if($line->description) {{ $line->description }} @endif {{ $qtyUom ?: '—' }} {{ number_format($line->rate, 2) }} @if((float) $line->discount_percent > 0) {{ rtrim(rtrim(number_format($line->discount_percent, 2), '0'), '.') }}% @else — @endif @if($line->tax_amount > 0) ₹ {{ number_format($line->tax_amount, 2) }} @if($line->tax_rate > 0) {{ rtrim(rtrim(number_format($line->tax_rate, 2), '0'), '.') }}% @endif @else — @endif ₹ {{ number_format($line->amount, 2) }}
@endif
@include('partials.admin.document-bank-details', [ 'company' => $company, 'settings' => $settings, 'showBank' => false, ]) @if($creditNote->has_total_quantity && $creditNote->total_quantity)

Total quantity: {{ $creditNote->total_quantity }} {{ $creditNote->total_quantity_unit }}

@endif @if($creditNote->terms)

{{ $docLbl['terms'] ?? 'Terms & Conditions' }}

{{ $creditNote->terms }}

@endif
@include('partials.admin.document-totals', [ 'document' => $creditNote, 'gstMode' => $gstMode ?? false, 'gstSummaryRows' => $gstSummaryRows ?? [], 'taxBreakdown' => $taxBreakdown ?? [], 'showTaxable' => $showTaxable, 'fmtTotal' => $fmtTotal, 'docOpts' => $docOpts, 'docLbl' => $docLbl, ]) @if((float) $creditNote->discount_amount > 0)
Discount (-) ₹ {{ number_format($creditNote->discount_amount, 2) }}
@endif @if(abs((float) $creditNote->round_off) >= 0.01)
Rounded Off ₹ {{ number_format($creditNote->round_off, 2) }}
@endif @if($docOpts['show_total_in_words'] ?? true)

Amount in Words: {{ $amountInWords }}

@endif @if($docOpts['show_primary_signature'] ?? true) @endif @if($docOpts['show_secondary_signature'] ?? false) @endif
@if($signatureImage) @else
@endif

{{ $primarySig }}

{{ $secondarySig }}