@extends('layouts.main') @section('page-title') {{__('Purchase Detail')}} @endsection @push('scripts') @endpush @section('page-breadcrumb') {{__('Purchase')}}, {{\Modules\Pos\Entities\Purchase::purchaseNumberFormat($purchase->purchase_id) }} @endsection @push('css') @endpush @section('content') @can('purchase send') @if($purchase->status!=4)
{{__('Create Purchase')}}

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

@can('purchase edit') {{__('Edit')}} @endcan
{{__('purchase send')}}

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

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

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

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

{{__('Purchase')}}

{{ \Modules\Pos\Entities\Purchase::purchaseNumberFormat($purchase->purchase_id) }}


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

{{__('Billed To')}} :
@if(!empty($purchase->vender_name)) {{ (!empty( $purchase->vender_name)?$purchase->vender_name:'') }} @else {{ !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( company_setting('shipping_display')=='on')
{{__('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
{!! DNS2D::getBarcodeHTML(route('purchase.link.copy',\Illuminate\Support\Facades\Crypt::encrypt($purchase->id)), "QRCODE",2,2) !!}
{{__('Status')}} :
@if($purchase->status == 0) {{ __(\Modules\Pos\Entities\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 1) {{ __(\Modules\Pos\Entities\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 2) {{ __(\Modules\Pos\Entities\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 3) {{ __(\Modules\Pos\Entities\Purchase::$statues[$purchase->status]) }} @elseif($purchase->status == 4) {{ __(\Modules\Pos\Entities\Purchase::$statues[$purchase->status]) }} @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=Modules\Pos\Entities\Purchase::taxs($iteam->tax); $totalQuantity+=$iteam->quantity; $totalRate+=$iteam->price; $totalDiscount+=$iteam->discount; foreach($taxes as $taxe){ $taxDataPrice=Modules\Pos\Entities\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 {{--text-right--}} @endforeach @if(!empty($taxesData)) @foreach($taxesData as $taxName => $taxPrice) @endforeach @endif
# {{__('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=Modules\Pos\Entities\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()-$purchase->getDue()))}}
{{__('Debit Note')}} {{ currency_format_with_sym(($purchase->purchaseTotalDebitNote()))}}
{{__('Due')}} {{currency_format_with_sym($purchase->getDue())}}
{{__('Payment Summary')}}
@can('purchase payment delete') @endcan @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}} {{$payment->description}} @can('purchase payment delete')
{{Form::open(array('route'=>array('purchase.payment.destroy',$purchase->id,$payment->id),'class' => 'm-0'))}} {{Form::close()}}
@endcan
{{__('Debit Note Summary')}}
@if(Gate::check('purchase debitnote edit') || Gate::check('purchase debitnote delete')) @endif @forelse($purchase->debitNote as $key =>$debitNote) @empty @include('layouts.nodatafound') @endforelse
{{__('Date')}} {{__('Amount')}} {{__('Description')}}{{__('Action')}}
{{ company_date_formate($debitNote->date)}} {{ currency_format_with_sym($debitNote->amount)}} {{$debitNote->description}} @can('purchase debitnote edit') @endcan @can('purchase debitnote delete')
{{Form::open(array('route'=>array('purchase.delete.debit.note', $debitNote->purchase,$debitNote->id),'class' => 'm-0'))}} @method('DELETE') {{Form::close()}}
@endcan
{{ __('Attachments') }}
{{--
--}}
{{ __('Drop files here to upload') }}
{{--
{{__('Attachment Details')}}
--}}
{{-- @if(Gate::check('purchase debitnote edit') || Gate::check('purchase debitnote delete')) --}} {{-- @endif --}} @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) }} {{-- @can('purchase attachment edit') --}} {{-- @endcan @can('purchase attachment delete') --}}
{{Form::open(array('route'=>array('purchase.attachment.destroy',$attachment->id),'class' => 'm-0'))}} @method('DELETE') {{Form::close()}}
{{-- @endcan --}}
@endsection @push('scripts') @endpush