@php $party = $party ?? $debitNote->party(); $docOpts = $docSettings['options'] ?? []; $docLbl = $docSettings['labels'] ?? []; $statusKey = $debitNote->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 = $party ? $party->billingAddressLines() : []; $shipLines = ($party && method_exists($party, 'has_shipping_address') && $party->has_shipping_address) ? $party->shippingAddressLines() : $billLines; $totalAmount = (float) $debitNote->grand_total; $debitNoteTitle = $debitNoteTitle ?? \App\Helpers\DebitNoteDocumentSettings::title($company->id ?? null); $documentCopyLabel = $documentCopyLabel ?? ($documentCopies['original'] ?? 'Original Copy'); $docId = $docId ?? 'debit-note-doc'; $hasDiscountCol = $debitNote->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 === 'unpaid')
Unpaid
@elseif($statusKey === 'paid')
Paid
@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

{{ $debitNoteTitle }}

#{{ $debitNote->debit_note_number }}

{{ $documentCopyLabel }}

@if($docOpts['show_amount_due'] ?? true)
Amount Due: ₹ {{ number_format((float) $debitNote->amount_due, 2) }}
@endif @if($debitNote->displayDocumentNumber()) @endif @if($debitNote->displayDocumentDate()) @endif @if(($gstMode ?? false) && ($placeOfSupplyLabel ?? null)) @endif
Date {{ $debitNote->debit_note_date->format('d - M - Y') }}
{{ $docLbl['document_number'] ?? 'Document no' }} {{ $debitNote->displayDocumentNumber() }}
{{ $docLbl['document_date'] ?? 'Document date' }} {{ $debitNote->displayDocumentDate()->format('d - M - Y') }}
Place of Supply {{ $placeOfSupplyLabel }}
@if($docOpts['show_shipping_address'] ?? false) @endif
@if($party)

{{ $party->name }}

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

{{ $party->contact_person }}

@endif @if($party->phone ?? null)

Phone: {{ $party->phone }}

@endif @if($party->email ?? null)

Email: {{ $party->email }}

@endif @foreach($billLines as $line)

{{ $line }}

@endforeach @if($party->gstin ?? null)

GSTIN: {{ $party->gstin }}

@endif @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' => $debitNote->items, 'gstIsIgst' => $gstIsIgst ?? false, 'docLbl' => $docLbl, ]) @else @if($hasDiscountCol) @endif @foreach($debitNote->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($debitNote->has_total_quantity && $debitNote->total_quantity)

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

@endif @if($debitNote->terms)

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

{{ $debitNote->terms }}

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