@extends('layouts.app') @section('css') @endsection @section('content')
{{ __('Purchases') }} >> #{{ $purchaseData->reference }}
@if(Helpers::has_permission(Auth::user()->id, 'add_purchase'))  {{ __('Purchase Order') }} @endif
@if($purchaseData->total > 0) @if($purchaseData->paid == 0)
{{ __('Unpaid') }}
@elseif($purchaseData->paid > 0 && $purchaseData->total > $purchaseData->paid )
{{ __('Partially Paid')}}
@elseif($purchaseData->total <= $purchaseData->paid)
{{ __('Paid')}}
@endif @else
{{ __('Paid')}}
@endif
{{ __('Print') }} {{ __('PDF') }} @if(Helpers::has_permission(Auth::user()->id, 'edit_invoice')) {{ __('Edit') }} @endif {{ __('Copy Purchase') }} @if($purchaseData->total > $purchaseData->paid) @endif @if(Helpers::has_permission(Auth::user()->id, 'delete_purchase'))
{{csrf_field()}}
@endif
{{ $company_name }}
{{ $company_street }}
{{ $company_city }}, {{ $company_state }}
{{ $company_country_name }}, {{ $company_zipCode }}
{{ isset($purchaseData->supplier->name) ? $purchaseData->supplier->name : ''}}
{{ isset($purchaseData->supplier->street) ? $purchaseData->supplier->street : ''}}
{{ isset($purchaseData->supplier->city) ? $purchaseData->supplier->city : ''}}{{ isset($purchaseData->supplier->state) ? ', '.$purchaseData->supplier->state : ''}}
{{ isset($purchaseData->supplier->country->name) ? $purchaseData->supplier->country->name : '' }}{{ isset($purchaseData->supplier->zipcode) ? ', '.$purchaseData->supplier->zipcode : '' }}
{{ __('Purchase No') .' # '.$purchaseData->reference }}
{{ __('Location')}} : {{ isset($purchaseData->location->name) ? $purchaseData->location->name : '' }}
{{ __('Date')}} : {{ formatDate($purchaseData->order_date) }}
@if($purchaseData->invoice_type == 'hours') @else @endif @if($purchaseData->has_hsn) @endif @if($purchaseData->invoice_type == 'quantity') @elseif($purchaseData->invoice_type == 'hours') @endif @if($purchaseData->has_item_discount) @endif @if($purchaseData->has_tax) @endif @php $itemsInformation = ''; $row = 6; $currentTaxArray = []; if ($purchaseData->invoice_type == 'amount') { $row = $row - 2; } if ($purchaseData->has_item_discount == 0) { $row = $row - 1; } if ($purchaseData->has_hsn == 0) { $row = $row - 1; } if ($purchaseData->has_tax == 0) { $row = $row - 1; } @endphp @if( count( $purchaseData->purchaseOrderDetails ) > 0 ) @php $subTotal = $totalDiscount = 0; @endphp @foreach( $purchaseData->purchaseOrderDetails as $result ) @php $priceAmount = ($result->quantity_ordered * $result->unit_price); $subTotal += $priceAmount; @endphp @if($result->quantity_ordered > 0) @if($purchaseData->has_hsn) @endif @if($purchaseData->invoice_type!='amount') @endif @if($purchaseData->has_item_discount) @endif @if($purchaseData->has_tax) @endif @endif @endforeach @if($purchaseData->has_item_discount) @endif @forelse($taxes as $tax) @empty @endforelse @if($purchaseData->has_other_discount == 1 && $purchaseData->other_discount_amount > 0) @php if ($purchaseData->has_item_discount == 1) { if($purchaseData->other_discount_type=="$"){ $otherDiscount = $purchaseData->other_discount_amount; } else { $otherDiscount = ($subTotal - $purchaseData->purchaseOrderDetails->sum('discount_amount')) * $purchaseData->other_discount_amount / 100; } } else { if($purchaseData->other_discount_type=="$"){ $otherDiscount = $purchaseData->other_discount_amount; } else { $otherDiscount = $subTotal * $purchaseData->other_discount_amount / 100; } } @endphp @endif @if($purchaseData->has_shipping_charge && $purchaseData->shipping_charge > 0) @endif @if($purchaseData->has_custom_charge && $purchaseData->custom_charge_amount > 0) @endif @endif
{{ __('Service') }}{{ __('Items') }}{{ __('HSN') }} {{ __('Quantity') }} {{ __('Price') }}({{ isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '' }}) {{ __('Hours') }} {{ __('Rate') }}{{ __('Discount') }}{{ __('Tax') }} (%) {{ __('Total') }} ({{ isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '' }})
{{$result->item_name}}
@if($purchaseData->has_description && $result->description) {{$result->description}} @endif
{{$result->hsn}}{{ formatCurrencyAmount($result->quantity_ordered)}}{{formatCurrencyAmount($result->unit_price) }}{{formatCurrencyAmount($result->discount)}}{{$result->discount_type}} @foreach( json_decode( $result->taxList ) as $counter => $tax ) {{ formatCurrencyAmount($tax->rate) }}% @if( $counter < count( json_decode( $result->taxList ) ) - 1 ) , @endif @endforeach {{ formatCurrencyAmount($priceAmount) }}
{{ __('Subtotal') }} {{ formatCurrencyAmount($subTotal, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Discount') }} {{ formatCurrencyAmount($purchaseData->purchaseOrderDetails->sum('discount_amount'), isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ $tax['name'] }} : {{ formatCurrencyAmount($tax['rate']) }}% {{ formatCurrencyAmount($tax['amount'], isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Other Discount') }} : {{ formatCurrencyAmount($purchaseData->other_discount_amount, $purchaseData->other_discount_type != "%" && isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '%') }} {{ formatCurrencyAmount($otherDiscount, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Shipping') }} {{ formatCurrencyAmount($purchaseData->shipping_charge, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ $purchaseData->custom_charge_title }} {{ formatCurrencyAmount($purchaseData->custom_charge_amount, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Grand Total') }} {{ formatCurrencyAmount($purchaseData->total, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Paid') }} {{ formatCurrencyAmount($purchaseData->paid, isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }}
{{ __('Due') }} @if(($purchaseData->total - $purchaseData->paid) < 0) -{{ formatCurrencyAmount(abs($purchaseData->total - $purchaseData->paid), isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }} @else {{ formatCurrencyAmount(abs($purchaseData->total - $purchaseData->paid), isset($purchaseData->currency->symbol) ? $purchaseData->currency->symbol : '') }} @endif
{{ __('Payments') }}
@if(isset($purchasePaymentsList) && count($purchasePaymentsList) > 0) @php $sumInvoice = 0; @endphp @foreach($purchasePaymentsList as $payment) @php $sumInvoice += $payment->amount; @endphp @endforeach
{{ __('Payment No') }} {{ __('Payment Term') }} {{ __('Date') }} {{ __('Amount') }}
 {{sprintf("%04d", $payment->id)}} {{ isset($payment->paymentMethod) ? $payment->paymentMethod->name : __('N/A')}} {{formatDate($payment->created_at,'Y-m-d')}} {{ formatCurrencyAmount($payment->amount, isset($payment->currency->symbol) ? $payment->currency->symbol : '')}}
{{__('Total') }} {{ formatCurrencyAmount($sumInvoice, isset($payment->currency->symbol) ? $payment->currency->symbol : '')}}
@else
{{ __('No payment found.') }}
@endif
@if ( count ($purchaseData->receivedOrderDetails) > 0)
{{ __('Purchase Receive') }}
@foreach($purchaseData->receivedOrders as $receive) @endforeach
{{ __('Receive No') }} {{ __('Date') }} {{ __('Qty') }}
 {{sprintf("%04d", $receive->id)}} {{formatDate($receive->receive_date,'Y-m-d')}} {{ formatCurrencyAmount($receive->receivedOrderDetails->sum('quantity')) }}
@endif @if ($purchaseData->purchaseOrderDetails->sum('quantity_ordered') > $purchaseData->purchaseOrderDetails->sum('quantity_received') )
{{ __('Receive information') }}
@endif @if(isset($files) && count($files) > 0)
{{ __('Files') }}
@foreach ($files as $file) @php $url = url('public/dist/js/html5lightbox/no_preview.png?v'). $file->id; $extra = ''; $div = ''; $fileName = !empty($file->original_file_name) ? $file->original_file_name : $file->file_name; if (in_array($file->extension, array('jpg', 'png', 'jpeg', 'gif', 'pdf', 'flv', 'webm', 'mp4', 'ogv', 'swf', 'm4v', 'ogg'))) { $url = url($filePath) .'/'. $file->file_name; } elseif (in_array($file->extension, array('csv', 'xls', 'xlsx', 'doc', 'docx', 'ppt', 'pptx', 'txt'))) { $url = '#pdiv-'. $file->id; $extra = 'data-width=900 data-height=600'; $div = '
'; } @endphp
@if (in_array($file->extension, array('jpg', 'png', 'jpeg', 'gif'))) @else @endif
{{ strlen($fileName) > 15 ? substr_replace($fileName, "..", 15) : $file->original_file_name }}
@endforeach
@endif @if(isset($purchaseData->comments) && !empty($purchaseData->comments))
{{ __('Note') }}
@if($purchaseData->comments)
{{$purchaseData->comments}}
@else
{{ __('No comment for this invoice') }}
@endif
@endif