@extends('layouts.layout-horizontal') @section('title', 'Invoice ' . $sale->bill_no) @section('css') @endsection @section('content') @php $showPdfScaleModal = $sale->mode === 'bill' && $sale->bill_type === 'bill' && $sale->items->count() > 10; @endphp
{{-- Top Bar --}}
{{ $sale->bill_no }} {{ $sale->invoice_date->format('d M, Y') }}
@if($sale->bill_type == 'cash') Cash @elseif($sale->bill_type == 'cash memo') Cash Memo @else Tax Invoice @endif @if($sale->mode == 'cash') Cash Mode @endif @if($sale->party && $sale->party->is_sez) SEZ @endif
@if($sale->party && $sale->party->mobile) @endif @if($showPdfScaleModal) @else Download @endif @if($sale->mode === 'cash' && $sale->items->count() > 0) @endif @if($sale->mode !== 'cash' && $sale->items->count() > 0) @endif Edit Back
{{-- Info Grid: Invoice Details + Party --}}
Invoice Details
Bill No
{{ $sale->bill_no }}
Invoice Date
{{ $sale->invoice_date->format('d M, Y') }}
Bill Type
@if($sale->bill_type == 'cash') Cash @elseif($sale->bill_type == 'cash memo') Cash Memo @else Tax Invoice @endif
Mode
{{ ucfirst($sale->mode) }}
Company
{{ $company->name }}
@if($sale->mode !== 'cash' && $sale->eway_bill_no)
E-Way Bill No
{{ $sale->eway_bill_no }}
@endif @if($sale->mode !== 'cash' && $sale->eway_bill_date)
E-Way Bill Date
{{ $sale->eway_bill_date->format('d M, Y') }}
@endif
Remarks
{{ $sale->remarks ?: '-' }}
Party
@if($sale->party)
Name
{{ $sale->party->name }}
@if($sale->party->mobile)
Mobile
{{ $sale->party->mobile }}
@endif @if($sale->party->gst_number)
GSTIN
{{ $sale->party->gst_number }}
@endif @if($sale->party->billing_address)
Billing Address
{{ $sale->party->billing_address }}
@endif @if($sale->party->state)
State / Pincode
{{ $sale->party->state }} {{ $sale->party->pincode ? '/ ' . $sale->party->pincode : '' }}
@endif @if($sale->party->contact_person)
Contact Person
{{ $sale->party->contact_person }}
@endif
Transportation
{{ $sale->party->transportation_name ?: '-' }}
@if($sale->party->is_sez)
SEZ
SEZ Customer
ARN No
@if($sale->arn_no) {{ $sale->arn_no }} @else Pending @endif
@endif @if($sale->party->msme_number)
MSME/Udyam
{{ $sale->party->msme_number }}
@endif
@else Party not found @endif
@if(isset($transferHistory) && $transferHistory->isNotEmpty())
Transfer Record
@foreach($transferHistory as $tr) @endforeach
From To Items Amount
{{ $tr->sourceCompany?->name }} / {{ $tr->sourceSale?->bill_no }} {{ $tr->targetCompany?->name }} / {{ $tr->targetSale?->bill_no }} @foreach(($tr->items ?? []) as $item) {{ $item['product_name'] ?? ('Product #' . ($item['product_id'] ?? '')) }} x {{ $item['qty'] ?? '' }} @endforeach {{ indian_number($tr->transferred_amount, 2) }}
Table End
@endif {{-- Delivery strip (bill mode only, if data exists) --}} @if($sale->mode !== 'cash') @php $deliveryItems = collect([ ['Delivery Note', $sale->delivery_note], ['Delivery Date', $sale->delivery_note_date ? $sale->delivery_note_date->format('d M, Y') : null], ['Buyer Order No', $sale->buyer_order_no], ['Buyer Order Date', $sale->buyer_order_date ? $sale->buyer_order_date->format('d M, Y') : null], ['Dispatched Through', $sale->dispatched_through ?? $sale->party->transportation_name ?? null], ['Destination', $sale->destination ?? $sale->party->state ?? null], ['Terms of Delivery', $sale->terms_of_delivery], ['Shipping Address', $sale->shippingAddress ? implode(' | ', array_filter([ $sale->shippingAddress->address, $sale->shippingAddress->pincode, $sale->shippingAddress->contact_person, $sale->shippingAddress->mobile, ])) : null], ])->filter(fn($i) => !empty($i[1])); @endphp @if($deliveryItems->isNotEmpty())
Dispatch @foreach($deliveryItems as $di)
{{ $di[0] }}: {{ $di[1] }}
@endforeach
@endif {{-- SEZ LUT --}} @if(isset($activeLut) && $activeLut)
LUT
Bond No:{{ $activeLut->lut_number }}
From:{{ $activeLut->valid_from->format('d M, Y') }}
To:{{ $activeLut->valid_to->format('d M, Y') }}
Status: @if(now()->between($activeLut->valid_from, $activeLut->valid_to)) Active @else Expired @endif
@endif @endif {{-- Items Table + Summary --}}
@if($sale->mode !== 'cash') @endif @foreach($sale->items as $item) @if($sale->mode !== 'cash') @endif @endforeach
# Product HSN Unit Qty Rate AmountTax% Tax AmtTotal
{{ $loop->iteration }} {{ $item->product->name ?? 'Item Removed' }} @if($item->product && $item->product->sku)
SKU: {{ $item->product->sku }} @endif
{{ $item->hsn ?: '-' }} {{ $item->unit ?: '-' }} {{ indian_number($item->qty, 3) }} {{ indian_number($item->rate, 2) }} {{ indian_number($item->line_amount, 2) }}{{ indian_number($item->tax_percent, 2) }}% {{ indian_number($item->line_tax_amount, 2) }}{{ indian_number($item->line_total, 2) }}
Summary
Sub Total {{ indian_number($sale->amount_total, 2) }}
@if($sale->mode !== 'cash')
Tax {{ indian_number($sale->tax_total, 2) }}
@endif @if($sale->pf_amount > 0)
P&F {{ indian_number($sale->pf_amount, 2) }}
@if($sale->mode !== 'cash' && $sale->pf_tax_amount > 0)
P&F Tax ({{ indian_number($sale->pf_tax_percent, 0) }}%) {{ indian_number($sale->pf_tax_amount, 2) }}
@endif @endif @if(($sale->discount ?? 0) != 0)
Discount {{ $sale->discount > 0 ? '(' : '' }}{{ indian_number(abs($sale->discount), 2) }}{{ $sale->discount > 0 ? ')' : '' }}
@endif @if($sale->roundoff != 0)
Roundoff {{ $sale->roundoff < 0 ? '(' : '' }}{{ indian_number(abs($sale->roundoff), 2) }}{{ $sale->roundoff < 0 ? ')' : '' }}
@endif
Grand Total ₹ {{ indian_number($sale->grand_total, 2) }}
@endsection @push('scripts') @if($showPdfScaleModal) @include('sales.partials.pdf_scale_modal') @endif @if($sale->mode === 'cash' && $sale->items->count() > 0) @endif @if($sale->mode !== 'cash' && $sale->items->count() > 0) @include('sales._ewb-modal') @endif @endpush