dbfdg @extends('layouts.admin') @section('page-title') {{__('Purchase Detail')}} @endsection @php $settings = Utility::settings(); @endphp @push('script-page') @endpush @section('breadcrumb') @endsection @section('content') @can('send purchase') @if($purchase->status!=4)
{{__('Create Purchase')}}

{{__('Created on ')}}{{\Auth::user()->dateFormat($purchase->purchase_date)}}

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

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

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

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

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

{{__('Purchase')}}

{{ Auth::user()->purchaseNumberFormat($purchase->purchase_id) }}


{{__('Issue Date')}} :
{{\Auth::user()->dateFormat($purchase->purchase_date)}}

{{__('Billed To')}} :
@if(!empty($vendor->billing_name)) {{!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:''}}
@if($settings['vat_gst_number_switch'] == 'on') {{__('Tax Number ')}} : {{!empty($vendor->tax_number)?$vendor->tax_number:'-'}} @endif @else - @endif
@if(App\Models\Utility::getValByName('shipping_display')=='on')
{{__('Shipped To')}} :
@if(!empty($vendor->shipping_name)) {{!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:''}}
@else - @endif
@endif
{!! DNS2D::getBarcodeHTML(route('purchase.link.copy',\Illuminate\Support\Facades\Crypt::encrypt($purchase->id)), "QRCODE",2,2) !!}
{{__('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
{{__('Product Summary')}}
{{__('All items here cannot be deleted.')}}
@php $totalQuantity=0; $totalRate=0; $totalTaxPrice=0; $totalDiscount=0; $taxesData=[]; @endphp @foreach($iteams as $key =>$iteam) {{-- @if(!empty($iteam->tax)) @php $taxes=App\Models\Utility::tax($iteam->tax); $totalQuantity+=$iteam->quantity; $totalRate+=$iteam->price; $totalDiscount+=$iteam->discount; foreach($taxes as $taxe){ $taxDataPrice=App\Models\Utility::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 --}} @php $totalQuantity += $iteam->quantity; $totalRate += $iteam->price; $totalDiscount += $iteam->discount; @endphp {{-- --}} @endforeach @if(!empty($taxesData)) @foreach($taxesData as $taxName => $taxPrice) @endforeach @endif
# {{__('Product')}} {{__('Quantity')}} {{__('Rate')}} {{__('Discount')}} {{__('Tax')}} {{__('Description')}} {{__('Price')}}
{{__('after tax & discount')}}
{{$key+1}} {{!empty($iteam->product)?$iteam->product->name:''}} {{$iteam->quantity}} {{\Auth::user()->priceFormat($iteam->price)}} {{\Auth::user()->priceFormat($iteam->discount)}} @if(!empty($iteam->tax)) @php $totalTaxRate = 0; $totalTaxPrice=0; @endphp @foreach($taxes as $tax) @php $taxPrice=App\Models\Utility::taxRate($tax->rate,$iteam->price,$iteam->quantity,$iteam->discount) ; $totalTaxPrice+=$taxPrice; @endphp @endforeach
{{$tax->name .' ('.$tax->rate .'%)'}} {{\Auth::user()->priceFormat($taxPrice)}}
@else - @endif
@if (!empty($iteam->tax)) @php $itemTaxes = []; $getTaxData = Utility::getTaxData(); if (!empty($iteam->tax)) { foreach (explode(',', $iteam->tax) as $tax) { $taxPrice = \Utility::taxRate($getTaxData[$tax]['rate'], $iteam->price, $iteam->quantity); $totalTaxPrice += $taxPrice; $itemTax['name'] = $getTaxData[$tax]['name']; $itemTax['rate'] = $getTaxData[$tax]['rate'] . '%'; $itemTax['price'] = \Auth::user()->priceFormat($taxPrice); $itemTaxes[] = $itemTax; if (array_key_exists($getTaxData[$tax]['name'], $taxesData)) { $taxesData[$getTaxData[$tax]['name']] = $taxesData[$getTaxData[$tax]['name']] + $taxPrice; } else { $taxesData[$getTaxData[$tax]['name']] = $taxPrice; } } $iteam->itemTax = $itemTaxes; } else { $iteam->itemTax = []; } @endphp @foreach ($iteam->itemTax as $tax) @endforeach
{{$tax['name'] .' ('.$tax['rate'] .'%)'}} {{ $tax['price']}}
@else - @endif
{{!empty($iteam->description)?$iteam->description:'-'}} {{\Auth::user()->priceFormat(($iteam->price * $iteam->quantity - $iteam->discount) + $totalTaxPrice)}}
{{__('Total')}} {{$totalQuantity}} {{\Auth::user()->priceFormat($totalRate)}} {{\Auth::user()->priceFormat($totalDiscount)}} {{\Auth::user()->priceFormat($totalTaxPrice)}}
{{__('Sub Total')}} {{\Auth::user()->priceFormat($purchase->getSubTotal())}}
{{__('Discount')}} {{\Auth::user()->priceFormat($purchase->getTotalDiscount())}}
{{$taxName}} {{ \Auth::user()->priceFormat($taxPrice) }}
{{__('Total')}} {{\Auth::user()->priceFormat($purchase->getTotal())}}
{{__('Paid')}} {{\Auth::user()->priceFormat(($purchase->getTotal()-$purchase->getDue()))}}
{{__('Due')}} {{\Auth::user()->priceFormat($purchase->getDue())}}
{{__('Payment Summary')}}
@can('delete payment purchase') @endcan @forelse($purchase->payments as $key =>$payment) @can('delete payment purchase') @endcan @empty @endforelse
{{__('Payment Receipt')}} {{__('Date')}} {{__('Amount')}} {{__('Account')}} {{__('Reference')}} {{__('Description')}}{{__('Action')}}
@if(!empty($payment->add_receipt)) @else - @endif {{\Auth::user()->dateFormat($payment->date)}} {{\Auth::user()->priceFormat($payment->amount)}} {{!empty($payment->bankAccount)?$payment->bankAccount->bank_name.' '.$payment->bankAccount->holder_name:''}} {{$payment->reference}} {{$payment->description}}
{!! Form::open(['method' => 'post', 'route' => ['purchase.payment.destroy',$purchase->id,$payment->id],'id'=>'delete-form-'.$payment->id]) !!} {!! Form::close() !!}

{{__('No Data Found')}}

@endsection