@php use Illuminate\Support\Facades\Log; $settings_data = \App\Models\Utility::settingsById($proposal->created_by); Log::info('Settings Data Retrieved:', ['settings_data' => $settings_data]); $addressParts = array_filter([ $settings_data['company_city'] ?? '', $settings_data['company_state'] ?? '', $settings_data['company_zipcode'] ?? '', ]); Log::info('Address Parts Generated:', ['addressParts' => $addressParts]); $logo = \App\Models\Utility::get_file('uploads/logo'); $company_logo = \App\Models\Utility::GetLogo(); $companyState = strtolower(trim($settings_data['company_state'] ?? '')); $billingState = strtolower(trim($customer->billing_state ?? '')); $isSameState = !empty($companyState) && !empty($billingState) && $companyState === $billingState; @endphp @php $proposal_logo = \App\Models\Utility::getValByName('proposal_logo'); $img = \App\Models\Utility::get_file('proposal_logo/') . $proposal_logo; @endphp @if ($settings_data['SITE_RTL'] == 'on') @endif
Proposal
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['qr_display'] == 'on')
{!! DNS2D::getBarcodeHTML(route('proposal.link.copy', Crypt::encrypt($proposal->id)), 'QRCODE', 2, 2) !!}
@endif
@php use Carbon\Carbon; $issueDate = Carbon::parse($proposal->issue_date); $validityDate = $issueDate->copy()->addDays(15); @endphp
{{ __('IRN') }}:{{ $proposal->irn ?? '' }}
{{ __('Ack No') }}:{{ \App\Models\Utility::proposalNumberFormat($settings,$proposal->proposal_id) }} {{ __('Ack Date') }}:{{ \App\Models\Utility::dateFormat($settings, $proposal->issue_date) }}{{ __('Valid To') }} : {{ \App\Models\Utility::dateFormat($settings, $validityDate) }}

{{ __('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
Proposal No:{{ \App\Models\Utility::proposalNumberFormat($settings,$proposal->proposal_id) }}
Date:{{ \App\Models\Utility::dateFormat($settings, $proposal->send_date ?? $proposal->issue_date) }}
E-way Bill No:{{ $proposal->eway_bill_no ?? '' }}
Delivery Distance:{{ $proposal->delivery_note_no ?? '' }}
Buyer Order No:{{ $proposal->buyer_order_no ?? '' }}
@php $totalAmount = 0; $grandTotal = 0; $totalCgst = 0; $totalSgst = 0; $totalIgst = 0; $totalVat = 0; @endphp @if (isset($proposal->itemData) && count($proposal->itemData) > 0) @foreach ($proposal->itemData as $item) @php // Subtotal before tax $itemTotal = ($item->price ?? 0) * ($item->quantity ?? 0) - ($item->discount ?? 0); $totalAmount += $itemTotal; $itemTaxPrice = 0; if (!empty($item->itemTax) && is_array($item->itemTax)) { foreach ($item->itemTax as $tax) { $taxPrice = floatval($tax['tax_price'] ?? 0); $itemTaxPrice += $taxPrice; if (strtolower($tax['name']) === 'cgst') { $totalCgst += $taxPrice; } elseif (strtolower($tax['name']) === 'sgst') { $totalSgst += $taxPrice; } elseif (strtolower($tax['name']) === 'igst') { $totalIgst += $taxPrice; } elseif (strtolower($tax['name']) === 'vat') { $totalVat += $taxPrice; } } } // Add item total (with tax) to grand total $grandTotal += $itemTotal + $itemTaxPrice; // 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'; $unitDisplay = optional(\App\Models\ProductServiceUnit::find($item->unit))->name ?? ''; Log::info('Item Data in Template:', [ 'item' => $item, 'unitDisplay' => $unitDisplay, 'itemTotal' => $itemTotal, 'itemTax' => $item->itemTax ]); @endphp @endforeach @else @endif
{{ __('S.No') }} {{ __('Description') }} {{ __('HSN/SAC Code') }} {{ __('Qty') }} {{ __('Unit') }} {{ __('(Incl)Rate') }} {{ __('Rate') }} {{ __('Disc') }} {{ __('Amount') }}
{{ $loop->iteration }} {{ $item->name ?? '' }} {{ $item->expense_chartaccount_code ??'-' }} {{ $item->quantity ?? 0 }} {{ $unitDisplay }} {{ number_format($item->price ?? 0, 2) }} {{ number_format($item->price ?? 0, 2) }} {{ $item->discount != 0 ? number_format($item->discount ?? 0, 2) : '-' }} {{ number_format($itemTotal, 2) }}
No items found
{{ __('TOTAL') }} {{ number_format($totalAmount, 2) }}
Amount In Words:
{{ $grandTotalWords }}
@if ($accounts->isNotEmpty()) @php $account = $accounts->first(); @endphp @else @endif
Bank Name:{{ $account->bank_name ?? '' }}
Ac/No:{{ $account->holder_name ?? '' }}
Branch & IFS Code:{{ $account->branch_name ?? '' }} {{ $account->ifs_code ?? '' }}
No bank details available.
Basic Amount{{ number_format($totalAmount, 2) }}
@php $cgstRate = 0; $sgstRate = 0; $igstRate = 0; $totalTax = 0; if (isset($proposal->itemData) && count($proposal->itemData) > 0) { foreach ($proposal->itemData as $item) { if (!empty($item->itemTax) && is_array($item->itemTax)) { foreach ($item->itemTax as $tax) { if (is_array($tax)) { $rate = floatval(str_replace('%', '', $tax['rate'] ?? '0')); $amount = floatval($tax['tax_price'] ?? 0); if ($isSameState && ($tax['name'] === 'CGST' || $tax['name'] === 'SGST')) { if ($tax['name'] === 'CGST') $cgstRate = $rate; if ($tax['name'] === 'SGST') $sgstRate = $rate; } elseif (!$isSameState && $tax['name'] === 'IGST') { $igstRate = $rate+$rate; } $totalTax += $amount; } } } } } @endphp

Terms & Condition:

  • 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 of the goods described 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('proposal.script'); @endif