@php // Retrieve settings data $settings_data = \App\Models\Utility::settingsById($ewaybill->created_by); // Generate address parts $addressParts = array_filter([ $settings_data['company_city'] ?? '', $settings_data['company_state'] ?? '', $settings_data['company_zipcode'] ?? '', ]); $logo = \App\Models\Utility::get_file('uploads/logo'); $company_logo = \App\Models\Utility::GetLogo(); // State comparison for tax calculation $companyState = strtolower(trim($settings_data['company_state'] ?? '')); $billingState = strtolower(trim($customer->billing_state ?? '')); $isSameState = !empty($companyState) && !empty($billingState) && $companyState === $billingState; @endphp @php $ewaybill_logo = Utility::getValByName('ewaybill_logo'); $img = !empty($ewaybill_logo) ? asset('storage/ewaybill_logo/' . $ewaybill_logo) : asset('storage/uploads/logo/' . (!empty($company_logo) ? $company_logo : 'logo-dark.png')); @endphp
Tax Invoice
logo

{{ $settings['company_name'] ?? '' }}

{{ $settings_data['company_address'] ?? '' }}

{{ implode(' , ', $addressParts) ?: '' }}

{{ __('Tel:') }} {{ $settings['company_telephone'] ?? '' }}, {{ __('E-Mail:') }} {{ $settings['mail_from_address'] ?? '' }}

@if($settings['vat_gst_number_switch'] == 'on') @if(!empty($settings['tax_type']) && !empty($settings['vat_number']))

{{$settings['tax_type'].' '. __('Number')}} : {{$settings['vat_number']}}

@endif @endif
@if ($settings['ewaybill_qr_display'] == 'on')
{!! DNS2D::getBarcodeHTML(route('ewaybill.link.copy', \Crypt::encrypt($ewaybill->id)), 'QRCODE', 2, 2) !!}
@endif
{{ __('IRN') }}:{{ $ewaybill->irn ?? '' }}
{{ __('Ack No') }}:{{ \App\Models\Utility::ebillNumberFormat($settings, $ewaybill->ewaybill_id) }} {{ __('Ack Date') }}:{{ \App\Models\Utility::dateFormat($settings, $ewaybill->issue_date) }}

{{ __('GSTIN/UIN:') }} {{ $customer->tax_number ?? '' }}

{{ __('PAN NO:') }} {{ $settings_data['pan_number'] ?? '' }}

{{ __('Buyer (Bill To)') }} @if (!empty($customer->billing_name))

{{ $customer->billing_name }}
{{ $customer->billing_address ?? '' }}
{{ $customer->billing_city ?? '' }},
{{ __('State Name :') }} {{ $customer->billing_state ?? '' }}- {{ $customer->billing_zip ?? '' }}
{{ __('GSTIN NO:') }} {{ $customer->tax_number ?? '' }}

@else

-

@endif
@if ($settings['shipping_display'] == 'on')
{{ __('Consignee (Ship To)') }} @if (!empty($customer->shipping_name))

{{ $customer->shipping_name }}
{{ $customer->shipping_address ?? '' }}
{{ $customer->shipping_city ?? '' }},
{{ __('State Name :') }} {{ $customer->shipping_state ?? '' }} - {{ $customer->billing_zip ?? '' }}
{{ __('GSTIN NO:') }} {{ $customer->tax_number ?? '' }}

@else

-

@endif
@endif
Date:{{ \App\Models\Utility::dateFormat($settings, $ewaybill->due_date) }}
E-way Bill No:{{ $ewaybill->converted_ewaybill_id ?? \App\Models\Utility::ebillNumberFormat($settings, $ewaybill->ewaybill_id) }}
Delivery Distance:{{ $ewaybill->delivery_distance ?? '' }}
Buyer Order No:{{ $ewaybill->buyer_order_no ?? '' }}
@php // Initialize totals $totalAmount = $totalCgst = $totalSgst = $totalIgst = $totalVat = $totalTax = 0; if (!empty($ewaybill->itemData)) { foreach ($ewaybill->itemData as $item) { // Calculate item total $itemTotal = ($item->price ?? 0) * ($item->quantity ?? 0) - ($item->discount ?? 0); $totalAmount += $itemTotal; if (!empty($item->itemTax) && is_array($item->itemTax)) { foreach ($item->itemTax as $tax) { $taxPrice = floatval($tax['tax_price'] ?? 0); if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') { // Handle VAT if (strtolower($tax['name']) === 'vat') { $totalVat += $taxPrice; $totalTax += $taxPrice; } } else { // Handle GST (CGST, SGST, IGST) switch (strtoupper($tax['name'])) { case 'CGST': if ($isSameState) { $totalCgst += $taxPrice; $totalTax += $taxPrice; } break; case 'SGST': if ($isSameState) { $totalSgst += $taxPrice; $totalTax += $taxPrice; } break; case 'IGST': if (!$isSameState) { $totalIgst += $taxPrice; $totalTax += $taxPrice; } break; } } } } } } // Final rounding of totals $totalAmount = round($totalAmount, 2); $totalTax = round($totalTax, 2); $roundOff = round($totalAmount + $totalTax) - ($totalAmount + $totalTax); $grandTotal = $totalAmount + $totalTax + $roundOff; // Convert grand total to words $formatter = new \NumberFormatter('en_IN', \NumberFormatter::SPELLOUT); $grandTotalWords = ucfirst($formatter->format(floor($grandTotal))) . ' rupees'; $decimalPart = round(($grandTotal - floor($grandTotal)) * 100); if ($decimalPart > 0) { $grandTotalWords .= ' and ' . $formatter->format($decimalPart) . ' paise'; } $grandTotalWords .= ' only'; @endphp @forelse ($ewaybill->itemData as $index => $item) @php $itemTotal = ($item->price ?? 0) * ($item->quantity ?? 0) - ($item->discount ?? 0); $unitDisplay = optional(\App\Models\ProductServiceUnit::find($item->unit))->name ?? ''; @endphp @php $groupedTaxes = []; foreach($item->itemTax as $tax) { $key = $tax['name'] . '|' . $tax['rate']; if (!isset($groupedTaxes[$key])) { $groupedTaxes[$key] = $tax; $groupedTaxes[$key]['price'] = floatval(str_replace(',', '', $tax['price'])); } else { $groupedTaxes[$key]['price'] += floatval(str_replace(',', '', $tax['price'])); } } @endphp @empty @endforelse
{{ __('S.No') }} {{ __('Description') }} {{ __('HSN/SAC Code') }} {{ __('GST Rate') }} {{ __('Qty') }} {{ __('Unit') }} {{ __('(Incl)Rate') }} {{ __('Rate') }} {{ __('Disc') }} {{ __('Amount') }}
{{ $loop->iteration }} {{ $item->name ?? '' }} {{ $item->expense_chartaccount_code ?? '' }} @foreach($groupedTaxes as $tax) {{ $tax['name'] }} ({{ $tax['rate'] }}) @endforeach {{ $item->quantity ?? 0 }} {{ $unitDisplay }} {{ number_format($item->price ?? 0, 2) }} {{ number_format($item->price ?? 0, 2) }} {{ $item->discount ? number_format($item->discount, 2) : '0' }} {{ number_format($itemTotal, 2) }}
No items found
{{ __('TOTAL') }} {{ number_format($totalAmount, 2) }}
@php $cgstRate = $sgstRate = $igstRate = $vatRate = 0; foreach ($ewaybill->itemData ?? [] as $item) { foreach ($item->itemTax ?? [] as $tax) { $rate = floatval(str_replace('%', '', $tax['rate'] ?? '0')); if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') { // Handle VAT rate if (strtolower($tax['name']) === 'vat') { $vatRate = $rate; } } else { // Handle GST rates (CGST, SGST, IGST) switch (strtoupper($tax['name'])) { case 'CGST': if ($isSameState) $cgstRate = $rate; break; case 'SGST': if ($isSameState) $sgstRate = $rate; break; case 'IGST': if (!$isSameState) $igstRate = $rate; break; } } } } @endphp
Amount In Words:
{{ $grandTotalWords }}
@if ($invoicePayment && $invoicePayment->bankAccount) @else @endif
Bank Name:{{ $invoicePayment->bankAccount->bank_name ?? '' }}
Ac/No:{{ $invoicePayment->bankAccount->holder_name ?? '' }}
Branch & IFS Code:{{ $invoicePayment->bankAccount->branch_name ?? '' }} {{ $invoicePayment->bankAccount->ifs_code ?? '' }}
No bank details available.
@if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') @if ($totalVat > 0) @endif @else @if ($isSameState) @elseif ($totalIgst > 0) @endif @endif
Basic Amount{{ number_format($totalAmount, 2) }}
VAT {{ number_format($totalVat, 2) }}
CGST {{ number_format($totalCgst, 2) }}
SGST {{ number_format($totalSgst, 2) }}
IGST {{ number_format($totalIgst, 2) }}
Round Off{{ number_format($roundOff, 2) }}
Grand Total{{ number_format($grandTotal, 2) }}
{{ __('Paid') }} {{ number_format($ewaybill->getTotal() - $ewaybill->getDue() - $ewaybill->ewaybillTotalCreditNote(), 2) }}
{{ __('Credit Note') }} {{ number_format($ewaybill->ewaybillTotalCreditNote(), 2) }}
{{ __('Due') }} {{ number_format($ewaybill->getDue(), 2) }}
@if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') @elseif ($isSameState) @elseif ($totalIgst > 0) @endif @if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') @elseif ($isSameState) @elseif ($totalIgst > 0) @endif @if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') @elseif ($isSameState) @elseif ($totalIgst > 0) @endif @if (!empty($settings['tax_type']) && strtolower($settings['tax_type']) === 'vat') @elseif ($isSameState) @elseif ($totalIgst > 0) @endif
Taxable ValueVATCGST SGSTIGSTTotal Tax Amount
RateAmountRateAmount RateAmountRateAmount
{{ number_format($totalAmount, 2) }}{{ number_format($vatRate, 2) }}% {{ number_format($totalVat, 2) }}{{ number_format($cgstRate, 2) }}% {{ number_format($totalCgst, 2) }} {{ number_format($sgstRate, 2) }}% {{ number_format($totalSgst, 2) }}{{ number_format($igstRate, 2) }}% {{ number_format($totalIgst, 2) }}{{ number_format($totalTax, 2) }}
Total: {{ number_format($totalAmount, 2) }} {{ number_format($totalVat, 2) }} {{ number_format($totalCgst, 2) }} {{ number_format($totalSgst, 2) }} {{ number_format($totalIgst, 2) }}{{ number_format($totalTax, 2) }}

Terms & Conditions:

  • Goods once sold will not be taken back.
  • Interest @10% p.a. will be charged if the payment is not made within the stipulated time.
  • We declare that this invoice shows the actual price and that all particulars are true and correct.

For {{ $settings['company_name'] ?? '' }}

Authorized Signatory

SUBJECT TO {{ strtoupper($settings['company_state'] ?? 'YOUR STATE') }} JURISDICTION

This is a Computer Generated Invoice

@if (!isset($preview)) @include('ewaybill.script') @endif