@extends('layouts.main') @section('page-title') {{ __('Purchase Detail') }} @endsection @push('scripts') @endpush @section('page-breadcrumb') {{ __('Purchase') }}, {{ App\Models\Purchase::purchaseNumberFormat($purchase->purchase_id) }} @endsection @push('css') @if (module_is_active('Signature')) @endif @endpush @section('page-action')
@if (\Auth::user()->type != 'company') @endif
@endsection @section('content') @if (\Auth::user()->type == 'company') @permission('purchase send') @if ($purchase->status != 4)

{{ __('Create Purchase') }}

{{ __('Created on ') }}{{ company_date_formate($purchase->purchase_date) }}

@permission('purchase edit') {{ __('Edit') }} @endpermission
{{ __('Send Purchase') }}

@if ($purchase->status != 0) {{ __('Sent on') }} {{ company_date_formate($purchase->send_date) }} @else @permission('purchase send') {{ __('Status') }} : {{ __('Not Sent') }} @endpermission @endif

@if ($purchase->status == 0) @permission('purchase send') {{ __('Send') }} @endpermission @endif
{{ __('Get Paid') }}

{{ __('Status') }} : @if ($purchase->status == 0) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 1) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 2) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 3) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 4) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @endif

@if ($purchase->status != 0) @permission('purchase payment create') {{ __(' Add Payment') }}
@endpermission @endif
@endif @endpermission @endif @if (\Auth::user()->type == 'company')
@if ($purchase->status != 0) @endif
@endif

{{ __('Purchase') }}

{{ __('Purchase Date')}} : {{ company_date_formate($purchase->purchase_date) }}

{{ App\Models\Purchase::purchaseNumberFormat($purchase->purchase_id) }}

@if (empty($purchase->vender_name)) {{ __('Name ') }} : {{ !empty($vendor->name) ? $vendor->name : '' }} @else {{ __('Vendor Name ') }} : {{ !empty($purchase->vender_name) ? $purchase->vender_name : '' }} @endif

@if (!empty($vendor->billing_name) && !empty($vendor->billing_address) && !empty($vendor->billing_zip))

{{ __('Billed To') }} : {{ !empty($vendor->billing_name) ? $vendor->billing_name : '' }} {{ !empty($vendor->billing_address) ? $vendor->billing_address : '' }} {{ !empty($vendor->billing_city) ? $vendor->billing_city . ' ,' : '' }} {{ !empty($vendor->billing_state) ? $vendor->billing_state . ' ,' : '' }} {{ !empty($vendor->billing_zip) ? $vendor->billing_zip : '' }} {{ !empty($vendor->billing_country) ? $vendor->billing_country : '' }}

{{ !empty($vendor->billing_phone) ? $vendor->billing_phone : '' }}

{{ __('Tax Number ') }} : {{ !empty($vendor->tax_number) ? $vendor->tax_number : '' }}

@endif
@if (module_is_active('Signature'))

@if ($purchase->company_signature)

@else
{{ __('Not Signed') }}
@endif
{{ __('Company Signature') }}

@endif
@if(empty($purchase->vender_name))

{{ __('Email ') }} : {{ !empty($vendor->email) ? $vendor->email : '' }}

@endif
@if (!empty($company_settings['purchase_shipping_display']) && $company_settings['purchase_shipping_display'] == 'on') @if (!empty($vendor->shipping_name) && !empty($vendor->shipping_address) && !empty($vendor->shipping_zip))

{{ __('Shipped To') }} : {{ !empty($vendor->shipping_name) ? $vendor->shipping_name : '' }} {{ !empty($vendor->shipping_address) ? $vendor->shipping_address : '' }} {{ !empty($vendor->shipping_city) ? $vendor->shipping_city . ' ,' : '' }} {{ !empty($vendor->shipping_state) ? $vendor->shipping_state . ' ,' : '' }} {{ !empty($vendor->shipping_zip) ? $vendor->shipping_zip : '' }} {{ !empty($vendor->shipping_country) ? $vendor->shipping_country : '' }}

{{ !empty($vendor->shipping_phone) ? $vendor->shipping_phone : '' }}

{{ __('Tax Number ') }} : {{ !empty($vendor->tax_number) ? $vendor->tax_number : '' }}

@endif @endif
@if (module_is_active('Signature'))

@if ($purchase->vendor_signature != '')

@else
{{ __('Not Signed') }}
@endif
{{ __('Vendor Signature') }}

@endif
Status : @if ($purchase->status == 0) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 1) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 2) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 3) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 4) {{ __(App\Models\Purchase::$statues[$purchase->status]) }} @endif
@if (!empty($company_settings['purchase_qr_display']) && $company_settings['purchase_qr_display'] == 'on')
{!! DNS2D::getBarcodeHTML( route('purchases.link.copy', \Illuminate\Support\Facades\Crypt::encrypt($purchase->id)), 'QRCODE', 2, 2, ) !!}
@endif
@if (!empty($customFields) && count($purchase->customField) > 0)
@foreach ($customFields as $field)
{{ $field->name }} @if ($field->type == 'attachment') @else

{{ !empty($purchase->customField[$field->id]) ? $purchase->customField[$field->id] : '-' }}

@endif
@endforeach
@endif

{{ __('Item Summary') }}

{{ __('All items here cannot be deleted.') }}
@php $totalQuantity = 0; $totalRate = 0; $totalTaxPrice = 0; $totalDiscount = 0; $taxesData = []; $TaxPrice_array = []; @endphp @foreach ($iteams as $key => $iteam) @if (!empty($iteam->tax)) @php $taxes = App\Models\Purchase::taxs($iteam->tax); $totalQuantity += $iteam->quantity; $totalRate += $iteam->price; $totalDiscount += $iteam->discount; foreach ($taxes as $taxe) { $taxDataPrice = App\Models\Purchase::taxRate( $taxe->rate, $iteam->price, $iteam->quantity, $iteam->discount, ); if (array_key_exists($taxe->name, $taxesData)) { $taxesData[$taxe->name] = $taxesData[$taxe->name] + $taxDataPrice; } else { $taxesData[$taxe->name] = $taxDataPrice; } } @endphp @endif @endforeach @if (!empty($taxesData)) @foreach ($taxesData as $taxName => $taxPrice) @endforeach @endif @php $getdue = $purchase->getDue(); @endphp
# {{ __('Item Type') }} {{ __('Item') }} {{ __('Quantity') }} {{ __('Rate') }} {{ __('Discount') }} {{ __('Tax') }} {{ __('Description') }} {{ __('Price') }}
{{ __('After discount & tax') }}
{{ $key + 1 }} {{ !empty($iteam->product_type) ? Str::ucfirst($iteam->product_type) : '--' }} {{ !empty($iteam->product) ? $iteam->product->name : '' }} {{ $iteam->quantity }} {{ currency_format_with_sym($iteam->price) }} {{ currency_format_with_sym($iteam->discount) }} @if (!empty($iteam->tax)) @php $totalTaxRate = 0; $data = 0; @endphp @foreach ($taxes as $tax) @php $taxPrice = App\Models\Purchase::taxRate( $tax->rate, $iteam->price, $iteam->quantity, $iteam->discount, ); $totalTaxPrice += $taxPrice; $data += $taxPrice; @endphp @endforeach @php array_push($TaxPrice_array, $data); @endphp
{{ $tax->name . ' (' . $tax->rate . '%)' }} {{ currency_format_with_sym($taxPrice) }}
@else - @endif
{{ !empty($iteam->description) ? $iteam->description : '-' }} {{ currency_format_with_sym($iteam->price * $iteam->quantity - $iteam->discount + $totalTaxPrice) }}
{{ __('Total') }} {{ $totalQuantity }} {{ currency_format_with_sym($totalRate) }} {{ currency_format_with_sym($totalDiscount) }} {{ currency_format_with_sym($totalTaxPrice) }}
{{ __('Sub Total') }} {{ currency_format_with_sym($purchase->getSubTotal()) }}
{{ __('Discount') }} {{ currency_format_with_sym($purchase->getTotalDiscount()) }}
{{ $taxName }} {{ currency_format_with_sym($taxPrice) }}
{{ __('Total') }} {{ currency_format_with_sym($purchase->getTotal()) }}
{{ __('Paid') }} {{ currency_format_with_sym($purchase->getTotal() - $getdue) }}
{{ __('Debit Note') }} {{ currency_format_with_sym($purchase->purchaseTotalDebitNote()) }}
{{ __('Due') }} {{ currency_format_with_sym($getdue) }}
{{ __('Payment Summary') }}
@permission('purchase payment delete') @endpermission @forelse($purchase->payments as $key =>$payment) @empty @include('layouts.nodatafound') @endforelse
{{ __('Payment Receipt') }} {{ __('Date') }} {{ __('Amount') }} {{ __('Account') }} {{ __('Reference') }} {{ __('Description') }}{{ __('Action') }}
@if (!empty($payment->add_receipt)) @else - @endif {{ company_date_formate($payment->date) }} {{ currency_format_with_sym($payment->amount) }} {{ !empty($payment->bankAccount) ? $payment->bankAccount->bank_name . ' ' . $payment->bankAccount->holder_name : '' }} {{ $payment->reference }} {{ isset($payment->description) ? $payment->description : '-' }} @permission('purchase payment delete')
{{ Form::open(['route' => ['purchases.payment.destroy', $purchase->id, $payment->id], 'class' => 'm-0']) }} {{ Form::close() }}
@endpermission
{{ __('Debit Note Summary') }}
@if (Laratrust::hasPermission('purchase debitnote edit') || Laratrust::hasPermission('purchase debitnote delete')) @endif @forelse($purchase->debitNote as $key =>$debitNote) @empty @include('layouts.nodatafound') @endforelse
{{ __('Debit Note') }} {{ __('Date') }} {{ __('Amount') }} {{ __('Description') }}{{ __('Action') }}
{{ !empty($debitNote->debitNote) ? \Workdo\Account\Entities\CustomerDebitNotes::debitNumberFormat($debitNote->debitNote->debit_id) : '-' }} {{ company_date_formate($debitNote->date) }} {{ currency_format_with_sym($debitNote->amount) }} {{ isset($debitNote->description) ? $debitNote->description :'-' }} @permission('purchase debitnote edit') @endpermission @permission('purchase debitnote delete')
{{ Form::open(['route' => ['purchases.delete.debit.note', $debitNote->purchase, $debitNote->id], 'class' => 'm-0']) }} @method('DELETE') {{ Form::close() }}
@endpermission
{{ __('Attachments') }}
{{ __('Drop files here to upload') }}
@forelse($purchase_attachment as $key =>$attachment) @empty @include('layouts.nodatafound') @endforelse
{{ __('#') }} {{ __('File Name') }} {{ __('File Size') }} {{ __('Date Created') }} {{ __('Action') }}
{{ ++$key }} {{ $attachment->file_name }} {{ $attachment->file_size }} {{ company_date_formate($attachment->created_at) }}
{{ Form::open(['route' => ['purchases.attachment.destroy', $attachment->id], 'class' => 'm-0']) }} @method('DELETE') {{ Form::close() }}
@if(\Auth::user()->type != 'company')
{{ __('Receipt Summary') }}
@forelse($purchase->payments as $key =>$payment) @empty @include('layouts.nodatafound') @endforelse
{{ __('Payment Receipt') }} {{ __('Date') }} {{ __('Amount') }} {{ __('Account') }} {{ __('Reference') }} {{ __('Description') }}
@if (!empty($payment->add_receipt)) @else - @endif {{ company_date_formate($payment->date) }} {{ currency_format_with_sym($payment->amount) }} {{ !empty($payment->bankAccount) ? $payment->bankAccount->bank_name . ' ' . $payment->bankAccount->holder_name : '' }} {{ $payment->reference }} {{ isset($payment->description) ? $payment->description : '-' }}
@endif @endsection @push('scripts') @endpush