@includeIf('invoices.pdf.invoice_pdf_css')

@lang('app.invoice')

@if ($invoice->project && $invoice->project->client && $invoice->project->client->clientDetails && ($invoice->project->client->name || $invoice->project->client->email || $invoice->project->client->mobile || $invoice->project->client->clientDetails->company_name || $invoice->project->client->clientDetails->address) && ($invoiceSetting->show_client_name == 'yes' || $invoiceSetting->show_client_email == 'yes' || $invoiceSetting->show_client_phone == 'yes' || $invoiceSetting->show_client_company_name == 'yes' || $invoiceSetting->show_client_company_address == 'yes')) @if($invoice->clientDetails->company_logo)
@endif @lang('modules.invoices.billedTo'):
@if ($invoice->project->client->name && $invoiceSetting->show_client_name == 'yes') {{ $invoice->project->client->name_salutation }}
@endif @if ($invoice->project->client->email && $invoiceSetting->show_client_email == 'yes') {{ $invoice->project->client->email }}
@endif @if ($invoice->project->client->mobile && $invoiceSetting->show_client_phone == 'yes') {{ $invoice->project->client->mobile_with_phonecode }}
@endif @if ($invoice->project->client->clientDetails->company_name && $invoiceSetting->show_client_company_name == 'yes') {{ $invoice->project->client->clientDetails->company_name }}
@endif @if ($invoice->project->client->clientDetails->address && $invoiceSetting->show_client_company_address == 'yes') {!! nl2br($invoice->project->client->clientDetails->address) !!} @endif @if ($invoice->show_shipping_address === 'yes')
@lang('app.shippingAddress') :
{!! nl2br($invoice->project->clientDetails->shipping_address) !!}
@endif @if ($invoiceSetting->show_gst == 'yes' && !is_null($invoice->project->client->clientDetails->gst_number))
@if ($invoice->project->client->clientDetails->tax_name) {{$invoice->project->client->clientDetails->tax_name}}: {{ $invoice->project->client->clientDetails->gst_number }} @else @lang('app.gstIn'): {{ $invoice->project->client->clientDetails->gst_number }} @endif
@endif @elseif($invoice->client && $invoice->clientDetails && ($invoice->client->name || $invoice->client->email || $invoice->client->mobile || $invoice->clientDetails->company_name || $invoice->clientDetails->address) && ($invoiceSetting->show_client_name == 'yes' || $invoiceSetting->show_client_email == 'yes' || $invoiceSetting->show_client_phone == 'yes' || $invoiceSetting->show_client_company_name == 'yes' || $invoiceSetting->show_client_company_address == 'yes')) @lang('modules.invoices.billedTo'):
@if ($invoice->client->name && $invoiceSetting->show_client_name == 'yes') {{ $invoice->client->name_salutation }}
@endif @if ($invoice->client->email && $invoiceSetting->show_client_email == 'yes') {{ $invoice->client->email }}
@endif @if ($invoice->client->mobile && $invoiceSetting->show_client_phone == 'yes') {{ $invoice->client->mobile_with_phonecode }}
@endif @if ($invoice->clientDetails->company_name && $invoiceSetting->show_client_company_name == 'yes') {{ $invoice->clientDetails->company_name }}
@endif @if ($invoice->clientDetails->address && $invoiceSetting->show_client_company_address == 'yes') {!! nl2br($invoice->clientDetails->address) !!} @endif @if ($invoice->show_shipping_address === 'yes')
@lang('app.shippingAddress') :
{!! nl2br($invoice->clientDetails->shipping_address) !!}
@endif @if ($invoiceSetting->show_gst == 'yes' && !is_null($invoice->clientDetails->gst_number))
@if ($invoice->clientDetails->tax_name) {{$invoice->clientDetails->tax_name}}: {{ $invoice->clientDetails->gst_number }} @else @lang('app.gstIn'): {{ $invoice->clientDetails->gst_number }} @endif
@endif @elseif(is_null($invoice->project) && $invoice->estimate && $invoice->estimate->client && $invoice->estimate->client->clientDetails && ($invoiceSetting->show_client_name == 'yes' || $invoiceSetting->show_client_email == 'yes' || $invoiceSetting->show_client_phone == 'yes' || $invoiceSetting->show_client_company_name == 'yes' || $invoiceSetting->show_client_company_address == 'yes')) @lang('modules.invoices.billedTo'):
@if ($invoice->estimate->client->name && $invoiceSetting->show_client_name == 'yes') {{ $invoice->estimate->client->name_salutation }}
@endif @if ($invoice->estimate->client->email && $invoiceSetting->show_client_email == 'yes') {{ $invoice->estimate->client->email }}
@endif @if ($invoice->estimate->client->mobile && $invoiceSetting->show_client_phone == 'yes') {{ $invoice->estimate->client->mobile_with_phonecode }}
@endif @if ($invoice->estimate->client->clientDetails->company_name && $invoiceSetting->show_client_company_name == 'yes') {{ $invoice->estimate->client->clientDetails->company_name }}
@endif @if ($invoice->estimate->client->clientDetails->address && $invoiceSetting->show_client_company_address == 'yes') {!! nl2br($invoice->estimate->client->clientDetails->address) !!} @endif @if ($invoice->show_shipping_address === 'yes')
@lang('app.shippingAddress') :
{!! nl2br($invoice->estimate->client->clientDetails->shipping_address) !!}
@endif @if ($invoiceSetting->show_gst == 'yes' && !is_null($invoice->estimate->client->clientDetails->gst_number))
@if ($invoice->estimate->client->clientDetails->tax_name) {{$invoice->estimate->client->clientDetails->tax_name}}: {{ $invoice->estimate->client->clientDetails->gst_number }} @else @lang('app.gstIn'): {{ $invoice->estimate->client->clientDetails->gst_number }} @endif
@endif @endif
@lang('modules.invoices.billedFrom'):
{{ $company->company_name }}
@if (!is_null($company) && $invoice->address) @if ($company->company_email)
{{ $company->company_email }}
@endif @if ($company->company_phone)
{{ $company->company_phone }}
@endif
{!! nl2br($invoice->address->address) !!}
@endif @if ($invoiceSetting->show_gst == 'yes' && $invoice->address->tax_number)
{{ $invoice->address->tax_name }}: {{ $invoice->address->tax_number }}
@endif

{{ $invoice->invoice_number }}

@if ($creditNote)
@lang('app.credit-note'): {{ $creditNote->cn_number }}
@endif
@lang('modules.invoices.invoiceDate'): {{ $invoice->issue_date->translatedFormat($company->date_format) }}
@if (empty($invoice->order_id) && $invoice->status === 'unpaid' && $invoice->due_date->year > 1)
@lang('app.dueDate'): {{ $invoice->due_date->translatedFormat($company->date_format) }}
@endif @if ($invoiceSetting->show_status)
@lang('app.status'): @lang('modules.invoices.' . $invoice->status)
@endif

@if ($invoiceSetting->show_project == 1 && isset($invoice->project->project_name)) @lang('modules.invoices.projectName')
{{ $invoice->project->project_name }} @endif

@if ($invoiceSetting->hsn_sac_code_show) @endif @foreach ($invoice->items as $item) @if ($item->type == 'item') @if ($invoiceSetting->hsn_sac_code_show) @endif @endif @endforeach @if ($invoiceSetting->hsn_sac_code_show) @endif @if ($discount != 0 && $discount != '') @if ($invoiceSetting->hsn_sac_code_show) @endif @endif @foreach ($taxes as $key => $tax) @if ($invoiceSetting->hsn_sac_code_show) @endif @endforeach @if ($invoice->creditNotes()->count() > 0) @endif @if ($invoice->amountDue()) @endif @if ($invoiceSetting->authorised_signatory && $invoiceSetting->authorised_signatory_signature && $invoice->status == 'paid') @endif
# @lang('modules.invoices.item')@lang('app.hsnSac')@lang('modules.invoices.qty') @lang('modules.invoices.unitPrice') @lang('modules.invoices.tax') @lang('modules.invoices.price') ({!! htmlentities($invoice->currency->currency_code) !!})
{{ ++$count }}

{{ $item->item_name }}

@if (!is_null($item->item_summary))
{!! nl2br(pdfStripTags($item->item_summary)) !!}
@endif @if ($item->invoiceItemImage)

@endif

{{ $item->hsn_sac_code ? $item->hsn_sac_code : '--' }}

{{ $item->quantity }}
{{ $item->unit->unit_type }}

{{ currency_format($item->unit_price, $invoice->currency_id, false) }}

{{ $item->tax_list }} {{ currency_format($item->amount, $invoice->currency_id, false) }}
        @lang('modules.invoices.subTotal') {{ currency_format($invoice->sub_total, $invoice->currency_id, false) }}
        @lang('modules.invoices.discount') {{ currency_format($discount, $invoice->currency_id, false) }}
        {{ $key }} {{ currency_format($tax, $invoice->currency_id, false) }}
@lang('modules.invoices.total') {{ currency_format($invoice->total, $invoice->currency_id, false) }}
@lang('modules.invoices.appliedCredits') {{ currency_format($invoice->appliedCredits(), $invoice->currency_id, false) }}
@lang('app.totalPaid') {{ currency_format($invoice->getPaidAmount(), $invoice->currency_id, false) }}
@lang('app.totalDue') {{ currency_format($invoice->amountDue(), $invoice->currency_id, false) }} {{ $invoice->currency->currency_code }}
{{ $company->company_name }}

@lang('modules.invoiceSettings.authorisedSignatory')

@if ($invoice->note) @lang('app.note')
{!! nl2br($invoice->note) !!}
@endif
@lang('modules.invoiceSettings.invoiceTerms')
{!! nl2br($invoiceSetting->invoice_terms) !!}

@if (isset($invoiceSetting->other_info))

{!! nl2br($invoiceSetting->other_info) !!}

@endif @if (isset($taxes) && $invoiceSetting->tax_calculation_msg == 1)

@if ($invoice->calculate_tax == 'after_discount') @lang('messages.calculateTaxAfterDiscount') @else @lang('messages.calculateTaxBeforeDiscount') @endif

@endif {{--Custom fields data--}} @if(isset($fields) && count($fields) > 0)

@lang('modules.projects.otherInfo')

@foreach($fields as $field) @endforeach
{{ $field->label }}

@if( $field->type == 'text' || $field->type == 'password' || $field->type == 'number' || $field->type == 'textarea') {{$invoice->custom_fields_data['field_'.$field->id] ?? '-'}} @elseif($field->type == 'radio') {{ !is_null($invoice->custom_fields_data['field_'.$field->id]) ? $invoice->custom_fields_data['field_'.$field->id] : '-' }} @elseif($field->type == 'select') {{ (!is_null($invoice->custom_fields_data['field_'.$field->id]) && $invoice->custom_fields_data['field_'.$field->id] != '') ? $field->values[$invoice->custom_fields_data['field_'.$field->id]] : '-' }} @elseif($field->type == 'checkbox') {{ !is_null($invoice->custom_fields_data['field_'.$field->id]) ? $invoice->custom_fields_data['field_'.$field->id] : '-' }} @elseif($field->type == 'date') {{ !is_null($invoice->custom_fields_data['field_'.$field->id]) ? \Carbon\Carbon::parse($invoice->custom_fields_data['field_'.$field->id])->translatedFormat($invoice->company->date_format) : '--'}} @endif

@endif @if (count($payments) > 0)

@lang('app.menu.payments')

@forelse($payments as $key => $payment) @empty @endforelse
# @lang('modules.invoices.price') @lang('modules.invoices.paymentMethod') @lang('modules.invoices.paidOn')
{{ $key + 1 }} {{ currency_format($payment->amount, $invoice->currency_id, false) }} {!! $invoice->currency->currency_code !!} @php $method = '--'; if (!is_null($payment->offline_method_id)) { $method = $payment->offlineMethod->name; } elseif (isset($payment->gateway)) { $method = $payment->gateway; } @endphp {{ $method }} {{ $payment->paid_on->translatedFormat($company->date_format) }}
@endif