@extends('layouts.admin') @section('page-title') {{ __('Bill Detail') }} @endsection @php use App\Models\Utility; $settings = App\Models\Utility::settings(); @endphp @push('script-page') @endpush @section('breadcrumb') @if (\Auth::guard('vender')->check()) @else @endif @if (\Auth::user()->type == 'company') @else @endif @endsection @section('action-btn')
@endsection @section('content') @can('send bill') @if ($bill->status != 4)
{{ __('Create Bill') }}

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

@can('edit bill') {{ __('Edit') }} @endcan
{{ __('Send Bill') }}

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

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

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

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

{{ __('Bill') }}

{{ Auth::user()->billNumberFormat($bill->bill_id) }}


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

{{ __('Due Date') }} :
{{ \Auth::user()->dateFormat($bill->due_date) }}

@if (!empty($vendor->billing_name))
{{ __('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 : '' }}
@if (App\Models\Utility::getValByName('tax_number') == 'on') {{ __('Tax Number ') }} : {{ !empty($vendor->tax_number) ? $vendor->tax_number : '' }}
@endif @if(!empty($settings['tax_type']) && !empty($settings['vat_number'])){{$settings['tax_type'].' '. __('Number')}} : {{$settings['vat_number']}}
@endif
@endif @if (App\Models\Utility::getValByName('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 : '' }}
@if (App\Models\Utility::getValByName('tax_number') == 'on') {{ __('Tax Number ') }} : {{ !empty($vendor->tax_number) ? $vendor->tax_number : '' }} @endif
@endif
@if ($settings['bill_qr_display'] == 'on') {!! DNS2D::getBarcodeHTML( route('pay.billpay', \Illuminate\Support\Facades\Crypt::encrypt($bill->id)), 'QRCODE', 2, 2, ) !!} @endif
{{ __('Status') }} :
@if ($bill->status == 0) {{ __(\App\Models\Bill::$statues[$bill->status]) }} @elseif($bill->status == 1) {{ __(\App\Models\Bill::$statues[$bill->status]) }} @elseif($bill->status == 2) {{ __(\App\Models\Bill::$statues[$bill->status]) }} @elseif($bill->status == 3) {{ __(\App\Models\Bill::$statues[$bill->status]) }} @elseif($bill->status == 4) {{ __(\App\Models\Bill::$statues[$bill->status]) }} @endif
@if (!empty($customFields) && count($bill->customField) > 0) @foreach ($customFields as $field)
{{ $field->name }} :
{{ !empty($bill->customField) ? $bill->customField[$field->id] : '-' }}

@endforeach @endif
{{__('Product Summary')}}
{{__('All items here cannot be deleted.')}}
@php $totalQuantity=0; $totalRate=0; $totalTaxPrice=0; $totalDiscount=0; $taxesData=[]; @endphp @foreach($items as $key =>$item) @if(!empty($item->product_id)) @php $productName = $item->product; $totalQuantity += $item->quantity; $totalRate += $item->price; $totalDiscount += $item->discount; @endphp @php $chartAccount = \App\Models\ChartOfAccount::find($item->chart_account_id); @endphp @else @php $chartAccount = \App\Models\ChartOfAccount::find($item['chart_account_id']); @endphp @endif @endforeach @if(!empty($taxesData)) @foreach($taxesData as $taxName => $taxPrice) @endforeach @endif
# {{__('Product')}} {{__('Quantity')}} {{__('Rate')}} {{__('Discount')}} {{__('Tax')}} {{__('Chart Of Account')}} {{__('Account Amount')}} {{__('Description')}} {{__('Price')}}
{{__('after tax & discount')}}
{{$key+1}}{{!empty($productName)?$productName->name:'-'}} {{ $item->quantity . ' (' . $productName->unit->name . ')' }} {{\Auth::user()->priceFormat($item->price)}} {{\Auth::user()->priceFormat($item->discount)}} @if (!empty($item->tax)) @php $itemTaxes = []; $getTaxData = Utility::getTaxData(); if (!empty($item->tax)) { foreach (explode(',', $item->tax) as $tax) { $taxPrice = Utility::taxRate($getTaxData[$tax]['rate'], $item->price, $item->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; } } $item->itemTax = $itemTaxes; } else { $item->itemTax = []; } @endphp @foreach ($item->itemTax as $tax) @endforeach
{{$tax['name'] .' ('.$tax['rate'] .'%)'}} {{ $tax['price']}}
@else - @endif
{{!empty($chartAccount) ? $chartAccount->name : '-'}} {{\Auth::user()->priceFormat($item->amount)}} {{!empty($item->description)?$item->description:'-'}} {{\Auth::user()->priceFormat(($item->price * $item->quantity - $item->discount) + $totalTaxPrice)}}
{{$key+1}} - - - - -{{!empty($chartAccount) ? $chartAccount->name : '-'}} {{\Auth::user()->priceFormat($item['amount'])}} - {{\Auth::user()->priceFormat($item['amount'])}}
{{__('Total')}} {{$totalQuantity}} {{\Auth::user()->priceFormat($totalRate)}} {{\Auth::user()->priceFormat($totalDiscount)}} {{\Auth::user()->priceFormat($totalTaxPrice)}} {{\Auth::user()->priceFormat($bill->getAccountTotal())}}
{{__('Sub Total')}} {{\Auth::user()->priceFormat($bill->getSubTotal())}}
{{__('Discount')}} {{\Auth::user()->priceFormat($bill->getTotalDiscount())}}
{{$taxName}} {{ \Auth::user()->priceFormat($taxPrice) }}
{{__('Total')}} {{\Auth::user()->priceFormat($bill->getTotal())}}
{{__('Paid')}} {{\Auth::user()->priceFormat(($bill->getTotal()-$bill->getDue())-($bill->billTotalDebitNote()))}}
{{__('Debit Note')}} {{\Auth::user()->priceFormat(($bill->billTotalDebitNote()))}}
{{__('Due')}} {{\Auth::user()->priceFormat($bill->getDue())}}
{{ __('Payment Summary') }}
@can('delete payment bill') @endcan @forelse($bill->payments as $key =>$payment) @php $paymentpath = \App\Models\Utility::get_file('uploads/payment'); @endphp @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 }} @can('delete bill product')
{!! Form::open([ 'method' => 'post', 'route' => ['bill.payment.destroy', $bill->id, $payment->id], 'id' => 'delete-form-' . $payment->id, ]) !!} {!! Form::close() !!}
@endcan

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

{{ __('Debit Note Summary') }}
@if (Gate::check('edit debit note') || Gate::check('delete debit note')) @endif @forelse($bill->debitNote as $key =>$debitNote) @empty @endforelse
{{ __('Date') }} {{ __('Amount') }} {{ __('Description') }}{{ __('Action') }}
{{ \Auth::user()->dateFormat($debitNote->date) }} {{ \Auth::user()->priceFormat($debitNote->amount) }} {{ $debitNote->description }} @can('edit debit note') @endcan @can('delete debit note')
{!! Form::open([ 'method' => 'DELETE', 'route' => ['bill.delete.debit.note', $debitNote->bill, $debitNote->id], 'id' => 'delete-form-' . $debitNote->id, ]) !!} {!! Form::close() !!}
@endcan

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

@endsection