@extends('companyuser::layouts.master') @section('title', __('sales::estimates.show_estimate')) @section('extra-styles') @endsection @section('breadcrumb') @endsection @section('content')
@can('sales.invoices.create') @endcan @if(auth()->user()->can('sales.proforma-invoices.create') && request()->get('tenant_current_subscription')->package_id != \Modules\Tenant\Enums\PackagesEnum::STANDARD) @endif @can('sales.estimates.export') @endcan
@can('sales.estimates.view') @if(LaravelLocalization::getCurrentLocale() === 'en') @else @endif @endcan @can('sales.estimates.export') @endcan
@if( $output['estimate']->customer->deleted_at || !$output['estimate']->customer->status)
@lang('sales::estimates.customer_deleted_or_deactivated')
@endif @include('companyuser::errors.lists') @include('companyuser::errors.all')
{{__('sales::estimates.reference_id')}}

{{$output['estimate']->code}}

{{__('sales::estimates.description')}}

{{$output['estimate']->description}}

{{__('sales::estimates.customer')}}
{{$output['estimate']->customer->name}}
{{__('sales::estimates.issue_date')}}

{{$output['estimate']->formatDate($output['estimate']->issue_date)}}

{{__('sales::estimates.due_date')}}

{{$output['estimate']->formatDate($output['estimate']->due_date)}}

{{__('sales::customers.created_by')}}

@if($output['estimate']->created_by == null) @lang('accounting::assets.System') @elseif($output['estimate']->created_by == auth()->user()->id) @lang('accounting::assets.You') @else {{$output['estimate']->addedBy->uname}} @endif

@lang('sales::estimates.customer_details'):

@php $mobile = $output['estimate']->customer->mobile ? str_replace("+", "00", App\Enums\PhoneCode::get($output['estimate']->customer->country_code)) . '-' . $output['estimate']->customer->mobile : '' @endphp
@lang('sales::estimates.phone'): {{$mobile}}
@lang('sales::estimates.email'): {{$output['estimate']->customer->email}}
@php $productTypeTitle = ''; if (array_key_exists(\Modules\Products\Enums\ProductTypeEnum::PRODUCT, $output['productsTypes'])) { $productTypeTitle .= __('products::product.' . \Modules\Products\Enums\ProductTypeEnum::PRODUCT); } if (array_key_exists(\Modules\Products\Enums\ProductTypeEnum::SERVICE, $output['productsTypes'])) { $productTypeTitle .= $productTypeTitle ? ' / ' : ''; $productTypeTitle .= __('products::product.' . \Modules\Products\Enums\ProductTypeEnum::SERVICE); } @endphp

{{$productTypeTitle}}

@php $counterOfColumn=8; $totalDiscountAmount = 0; $totalAmount = 0; $totalAmountWithServices = 0; if(!$output['estimate']->formDesign->product_description) { $counterOfColumn--; } if(!$output['estimate']->formDesign->discount) { $counterOfColumn--; } if(!$output['estimate']->formDesign->tax_amount) { $counterOfColumn--; } if(!$output['estimate']->formDesign->product_image) { $counterOfColumn--; } @endphp @if($output['estimate']->formDesign->product_image) @if($output['estimate']->formDesign->product_description) @endif @if($output['estimate']->formDesign->discount) @endif @if($output['estimate']->formDesign->tax_amount) @endif @foreach($output['estimate']->products as $record) @if($output['estimate']->formDesign->product_image) @endif @if($output['estimate']->formDesign->product_description) @endif @if($output['estimate']->formDesign->discount) @php $totalBeforeDiscount = $record->quantity * $record->unit_price; if ($output['estimate']->taxes_status == \Modules\Sales\Enums\InvoiceTaxesStatusEnum::INCLUSIVE) { $discountWithoutTax = ($totalBeforeDiscount - $record->vat) * $record->discount / 100.0; $totalDiscountAmount += $discountWithoutTax; $totalAmount += $totalBeforeDiscount - $record->vat; } else { $totalDiscountAmount += $totalBeforeDiscount * $record->discount / 100; $totalAmount += $totalBeforeDiscount; } @endphp @endif @if($output['estimate']->formDesign->tax_amount) @endif @if($output['estimate']->formDesign->tax_status == \Modules\Settings\Enums\TaxStatusesEnum::INCLUDE_VAT) @if($output['estimate']->taxes_status == \Modules\Settings\Enums\TaxStatusesEnum::INCLUDE_VAT) @else @endif @else @if($output['estimate']->taxes_status == \Modules\Settings\Enums\TaxStatusesEnum::EXCLUDE_VAT) @else @endif @endif @endforeach @if($output['estimate']->formDesign->discount && $totalAmount) @endif
@lang('products::product.Image') @endif @lang('sales::estimates.product')@lang('sales::estimates.description')@lang('sales::estimates.qty') @lang('sales::estimates.unit_price')@lang('sales::estimates.discount')@lang('sales::estimates.vat') @lang('sales::estimates.vat_value')@lang('sales::estimates.amount')
@if($record->product->deleted_at || $record->warehouseProduct?->deleted_at) @lang('Deleted') {{ $record->product->name }} @else {{ $record->product->name }} @endif {{ $record->description }}{{ number_format($record->quantity,2,".",",") }} {{ number_format($record->unit_price,2,".",",") }}{{ $record->discount }}{{ ($record->tax)?$record->tax->percentage:0 }} {{ number_format($record->vat,2,".",",") }}{{ number_format($record->gross ,2,".",",") }}{{ number_format($record->total,2,".",",") }}{{ number_format($record->gross ,2,".",",") }}{{ number_format($record->gross - $record->vat,2,".",",") }}
@lang('sales::estimates.discount') {{ number_format(($totalDiscountAmount / $totalAmount * 100),2,".",",") . " %" }}
@lang('sales::estimates.discount amount') {{ number_format($totalDiscountAmount,2,".",",") }} {!! __('settings::currencies.' . $output['estimate']->currency_code) !!}
@lang('sales::estimates.gross') {{ number_format($output['estimate']->total_amount,2,".",",") }} {!! __('settings::currencies.' . $output['estimate']->currency_code) !!}
@lang('sales::estimates.vat') {{ number_format($output['estimate']->total_vat,2,".",",") }} {!! __('settings::currencies.' . $output['estimate']->currency_code) !!}
@lang('sales::estimates.total_amount') {{ number_format($output['estimate']->total,2,".",",") }} {!! __('settings::currencies.' . $output['estimate']->currency_code) !!}
@include('sales::partials.other-fees-show', [ 'activities' => $output['feeServiceActivities'], 'baseTotal' => $output['estimate']->total, 'currencyCode' => $output['estimate']->currency_code, ])
@if($output['estimate']->custom_fields) @php $customFields = json_decode($output['estimate']->custom_fields, true) @endphp
@foreach($customFields as $key=>$field)
@if($field['type']=='checkbox') @else @endif
@endforeach
@endif
{!! $output['estimate']->terms ?? $output['estimate']->formDesign->terms !!}
{!! $output['estimate']->notes ?? $output['estimate']->formDesign->notes !!}
@forelse ($output['estimate']->attachments as $attachment) @empty
@lang('purchases::purchase_bills.there_is_no_attachments')
@endforelse
{{---------------- popup for sending the item to email as pdf -------------------------------}} {{---------------- popup for sending the item to whatsapp as pdf -------------------------------}}
@endsection @php $WhatsappText = __('general.whatsapp_message', [ 'receiver' => $output['estimate']->customer->name, 'sender' => $companyInfo->name, 'resource' => $output['estimate']->code, 'model' => __('sales::estimates.estimate'), 'resource_url' => $output['estimate']->publicUrl ]); @endphp @section('extra_scripts') @endsection