@php $settings = \App\Models\Utility::settings(); $creatorId = \Auth::user()->creatorId(); $company_state = strtolower(trim($settings['company_state'] ?? 'defaultstate')); $customer_state = strtolower(trim($customer->billing_state ?? '')); $isSameState = $company_state === $customer_state; @endphp @extends('layouts.admin') @section('page-title') {{ __('Invoice Detail') }} @endsection @section('breadcrumb') @endsection @push('css-page') @endpush @push('script-page') @endpush @section('content') @can('send invoice') @if ($invoice->status != 4)
{{ __('Create Invoice') }}

{{ __('Created on ') }}{{ \Auth::user()->dateFormat($invoice->issue_date) }}

@can('edit invoice') @if (!in_array($invoice->status, [3, 4])) {{-- 3: Partially Paid, 4: Paid --}} {{ __('Edit') }} @endif @endcan
{{ __('Send Invoice') }}

@if ($invoice->status != 0) {{ __('Sent on') }} {{ \Auth::user()->dateFormat($invoice->send_date) }} @else @can('send invoice') {{ __('Status') }} : {{ __('Not Sent') }} @endcan @endif

@if ($invoice->status == 0) @can('send invoice') {{ __('Send') }} @endcan @endif
{{ __('Get Paid') }}

{{ __('Status') }} : {{ __('Awaiting payment') }}

@if ($invoice->status != 0) @can('create payment invoice') {{ __('Add Payment') }} @endcan @endif
@endif @endcan @if (Gate::check('show invoice')) @if ($invoice->status != 0)
@if (!empty($creditnote)) @endif @if ($invoice->status != 4) @endif
@endif @endif

{{ __('Invoice') }}

{{ \Auth::user()->invoiceNumberFormat($invoice->invoice_id) }}


{{ __('Issue Date') }} :
{{ \Auth::user()->dateFormat($invoice->issue_date) }}

{{ __('Due Date') }} :
{{ \Auth::user()->dateFormat($invoice->due_date) }}

{{ __('Billed To') }} :
@if (!empty($customer->billing_name)) {{ $customer->billing_name }}
{{ $customer->billing_address ?? '' }}
{{ $customer->billing_city ?? '' . ', ' }}
{{ $customer->billing_state ?? '', ', ' }}{{ $customer->billing_zip ?? '' }}
{{ $customer->billing_country ?? '' }}
{{ $customer->billing_phone ?? '' }}
@if ($settings['vat_gst_number_switch'] == 'on') @if (!empty($settings['tax_type']) && !empty($settings['vat_number'])) {{ $settings['tax_type'] . ' ' . __('Number') }} : {{ $settings['vat_number'] }}
@endif {{ __('Tax Number') }} : {{ $customer->tax_number ?? '' }} @endif @else - @endif
@if (App\Models\Utility::getValByName('shipping_display') == 'on')
{{ __('Shipped To') }} :
@if (!empty($customer->shipping_name)) {{ $customer->shipping_name }}
{{ $customer->shipping_address ?? '' }}
{{ $customer->shipping_city ?? '' . ', ' }}
{{ $customer->shipping_state ?? '' . ', ' }}{{ $customer->shipping_zip ?? '' }}
{{ $customer->shipping_country ?? '' }}
{{ $customer->shipping_phone ?? '' }}
@else - @endif
@endif
@if ($settings['invoice_qr_display'] == 'on') {!! DNS2D::getBarcodeHTML(route('invoice.link.copy', \Illuminate\Support\Facades\Crypt::encrypt($invoice->id)), 'QRCODE', 2, 2) !!} @endif
{{ __('Status') }} :
@if ($invoice->status == 0) {{ __(\App\Models\Invoice::$statues[$invoice->status]) }} @elseif($invoice->status == 1) {{ __(\App\Models\Invoice::$statues[$invoice->status]) }} @elseif($invoice->status == 2) {{ __(\App\Models\Invoice::$statues[$invoice->status]) }} @elseif($invoice->status == 3) {{ __(\App\Models\Invoice::$statues[$invoice->status]) }} @elseif($invoice->status == 4) {{ __(\App\Models\Invoice::$statues[$invoice->status]) }} @endif
@if (!empty($customFields) && count($invoice->customField) > 0) @foreach ($customFields as $field)
{{ $field->name }} :
{{ !empty($invoice->customField) ? $invoice->customField[$field->id] : '-' }}

@endforeach @endif
{{ __('Product Summary') }}
{{ __('All items here cannot be deleted.') }}
@php $totalQuantity = 0; $totalPrice = 0; $totalTaxPrice = 0; $totalDiscount = 0; $taxSummary = []; @endphp @foreach ($items as $key => $item) @php $productName = $item->product; $totalQuantity += $item->quantity; $totalPrice += $item->price; $totalDiscount += $item->discount; $taxableAmount = ($item->price ?? 0) * ($item->quantity ?? 0) - ($item->discount ?? 0); $itemTaxPrice = 0; @endphp @php $totalTaxPrice += $itemTaxPrice; @endphp @endforeach @if (!empty($taxSummary)) @foreach ($taxSummary as $taxName => $taxPrice) @endforeach @endif
# {{ __('Product') }} {{ __('Quantity') }} {{ __('Rate') }} {{ __('Discount') }} {{ __('Tax') }} {{ __('Description') }} {{ __('Price') }}
{{ __('after tax & discount') }}
{{ $key + 1 }} {{ $productName->name ?? '-' }} {{ $item->quantity . ' (' . ($productName->unit->name ?? '-') . ')' }} {{ \Auth::user()->priceFormat($item->price) }} {{ \Auth::user()->priceFormat($item->discount) }} @php $taxData = json_decode($item->tax, true); if (!is_array($taxData) && !empty($item->tax)) { $taxData = explode(',', $item->tax); } $itemTaxPrice = 0; $taxRates = []; $taxDetails = []; $taxableAmount = ($item->price ?? 0) * ($item->quantity ?? 0) - ($item->discount ?? 0); @endphp @if (!empty($taxData)) @foreach (array_unique($taxData) as $taxId) @php $tax = \App\Models\Tax::find((int) trim($taxId)); if ($tax) { $taxRates[] = floatval($tax->rate); $taxDetails[] = $tax; } @endphp @endforeach @php $totalRate = array_sum($taxRates); $totalTaxAmount = ($taxableAmount * $totalRate) / 100; $itemTaxPrice += $totalTaxAmount; @endphp @if (!empty($settings['tax_type']) && $settings['tax_type'] === 'VAT') {{-- Show as VAT --}}
VAT ({{ $totalRate }}%) - ₹{{ number_format($totalTaxAmount, 2) }}
@php $taxSummary['VAT'] = ($taxSummary['VAT'] ?? 0) + $totalTaxAmount; @endphp @else {{-- GST logic --}} @if ($isSameState) @php $halfRate = $totalRate / 2; $halfAmount = $totalTaxAmount / 2; $taxSummary['CGST'] = ($taxSummary['CGST'] ?? 0) + $halfAmount; $taxSummary['SGST'] = ($taxSummary['SGST'] ?? 0) + $halfAmount; @endphp
CGST ({{ $halfRate }}%) - ₹{{ number_format($halfAmount, 2) }}
SGST ({{ $halfRate }}%) - ₹{{ number_format($halfAmount, 2) }}
@else @php $taxSummary['IGST'] = ($taxSummary['IGST'] ?? 0) + $totalTaxAmount; @endphp
IGST ({{ $totalRate }}%) - ₹{{ number_format($totalTaxAmount, 2) }}
@endif @endif @else
@endif
{{ $item->description ?? '-' }} {{ \Auth::user()->priceFormat($taxableAmount + $itemTaxPrice) }}
{{ __('Total') }} {{ $totalQuantity }} {{ \Auth::user()->priceFormat($totalPrice) }} {{ \Auth::user()->priceFormat($totalDiscount) }} {{ \Auth::user()->priceFormat($totalTaxPrice) }}
{{ __('Sub Total') }} {{ \Auth::user()->priceFormat($invoice->getSubTotal()) }}
{{ __('Discount') }} {{ \Auth::user()->priceFormat($invoice->getTotalDiscount()) }}
{{ $taxName }} {{ \Auth::user()->priceFormat($taxPrice) }}
{{ __('Total') }} {{ \Auth::user()->priceFormat($invoice->getTotal()) }}
{{ __('Paid') }} {{ \Auth::user()->priceFormat($invoice->getTotal() - $invoice->getDue() - $invoice->invoiceTotalCreditNote()) }}
{{ __('Credit Note') }} {{ \Auth::user()->priceFormat($invoice->invoiceTotalCreditNote()) }}
{{ __('Due') }} {{ \Auth::user()->priceFormat($invoice->getDue()) }}
{{ __('Receipt Summary') }}

@if ($user_plan->storage_limit <= $invoice_user->storage_limit) {{ __('Your plan storage limit is over, so you cannot see customer-uploaded payment receipts.') }}
@endif
@can('delete payment invoice') @endcan @if (!empty($invoice->payments) || !empty($invoice->bankPayments)) @php $path = \App\Models\Utility::get_file('uploads/order'); @endphp @foreach ($invoice->payments as $key => $payment) @if ($user_plan->storage_limit <= $invoice_user->storage_limit) @else @endif @can('delete payment invoice') @endcan @endforeach @foreach ($invoice->bankPayments as $key => $bankPayment) @if ($user_plan->storage_limit <= $invoice_user->storage_limit) @else @endif @can('delete payment invoice') @endcan @endforeach @else @endif
{{ __('Payment Receipt') }} {{ __('Date') }} {{ __('Amount') }} {{ __('Payment Type') }} {{ __('Account') }} {{ __('Reference') }} {{ __('Description') }} {{ __('Receipt') }} {{ __('OrderId') }}{{ __('Action') }}
@if (!empty($payment->add_receipt)) @else - @endif {{ \Auth::user()->dateFormat($payment->date) }} {{ \Auth::user()->priceFormat($payment->amount) }} {{ $payment->payment_type }} {{ !empty($payment->bankAccount) ? $payment->bankAccount->bank_name . ' ' . $payment->bankAccount->holder_name : '--' }} {{ !empty($payment->reference) ? $payment->reference : '--' }} {{ !empty($payment->description) ? $payment->description : '--' }}-- @if (!empty($payment->receipt)) @if ($payment->payment_type == "STRIPE") {{ __('Receipt') }} @else {{ __('Receipt') }} @endif @elseif (!empty($payment->add_receipt)) {{ __('Receipt') }} @else -- @endif {{ !empty($payment->order_id) ? $payment->order_id : '--' }}
{!! Form::open([ 'method' => 'post', 'route' => ['invoice.payment.destroy', $invoice->id, $payment->id], 'id' => 'delete-form-' . $payment->id, ]) !!} {!! Form::close() !!}
- {{ \Auth::user()->dateFormat($bankPayment->date) }} {{ \Auth::user()->priceFormat($bankPayment->amount) }} {{ __('Bank Transfer') }} - - --- @if (!empty($bankPayment->receipt)) {{ __('Receipt') }} @endif {{ !empty($bankPayment->order_id) ? $bankPayment->order_id : '--' }} @if ($bankPayment->status == 'Pending') @endif
{!! Form::open([ 'method' => 'post', 'route' => ['invoice.payment.destroy', $invoice->id, $bankPayment->id], 'id' => 'delete-form-' . $bankPayment->id, ]) !!} {!! Form::close() !!}

{{ __('No Data Found') }}

{{ __('Credit Note Summary') }}
@if (Gate::check('edit credit note') || Gate::check('delete credit note')) @endif @forelse ($invoice->creditNote as $key => $creditNote) @empty @endforelse
{{ __('Date') }} {{ __('Amount') }} {{ __('Description') }}{{ __('Action') }}
{{ \Auth::user()->dateFormat($creditNote->date) }} {{ \Auth::user()->priceFormat($creditNote->amount) }} {{ $creditNote->description ?? '-' }} @can('edit credit note') @endcan @can('delete credit note')
{!! Form::open([ 'method' => 'DELETE', 'route' => ['invoice.delete.credit.note', $creditNote->invoice, $creditNote->id], 'id' => 'delete-form-' . $creditNote->id, ]) !!} {!! Form::close() !!}
@endcan

{{ __('No Data Found') }}

@endsection