@php use Illuminate\Support\Str; $totalItems = collect(); foreach ($sales as $sale) { foreach ($sale->itemTransaction as $transaction) { $totalItems->push([ 'sale' => $sale, 'transaction' => $transaction, ]); } } $subtotal = $sales->sum(fn($sale) => $sale->itemTransaction->sum('total')); $discount = $sales->sum(fn($sale) => $sale->itemTransaction->sum('discount_amount')); $taxAmount = $sales->sum(fn($sale) => $sale->itemTransaction->sum('tax_amount')); $grandTotal = $sales->sum('grand_total'); $paidAmount = $sales->sum('paid_amount'); $roundOff = $sales->sum('round_off'); $balance = $grandTotal - $paidAmount; @endphp {{ $invoiceData['name'] }} @include('print.common.css')
{{ $invoiceData['name'] }}
@include('print.common.header')
{{ __('app.bill') }} #: {{ $sale->sale_code }}
{{ __('app.date') }}: {{ $sale->formatted_sale_date }}
{{ __('app.time') }}: {{ $sale->format_created_time }}
@if($sale->reference_no) {{ __('supplier.supplier_invoice_number') }}: {{ $sale->reference_no }}
@endif @if($sale->sale_order_id) {{ __('sale.order.order') }}: {{ $sale->saleOrder->order_code }}
@endif
{{ __('app.bill_to') }}
{{ $sale->party->first_name.' '. $sale->party->last_name }}
{{ $sale->party->billing_address }}
@php $isHasBatchItem = ($sale->itemTransaction->where('tracking_type', 'batch')->count() > 0) ? true : false; //Return from Controller $totalBatchTrackingRowCount = ($isHasBatchItem) ? $batchTrackingRowCount : 0; @endphp @if($isHasBatchItem) @if(app('company')['enable_batch_tracking']) @endif @if(app('company')['enable_mfg_date']) @endif @if(app('company')['enable_exp_date']) @endif @if(app('company')['enable_model']) @endif @if(app('company')['enable_color']) @endif @if(app('company')['enable_size']) @endif @endif @if(app('company')['show_mrp']) @endif @if(app('company')['show_discount']) @endif @if(app('company')['tax_type'] != 'no-tax') @endif @php $i = 1; @endphp @foreach($totalItems as $row) @php $sale = $row['sale']; $transaction = $row['transaction']; $item = $transaction->item; @endphp @if($isHasBatchItem) @if(app('company')['enable_batch_tracking']) @endif @if(app('company')['enable_mfg_date']) @endif @if(app('company')['enable_exp_date']) @endif @if(app('company')['enable_model']) @endif @if(app('company')['enable_color']) @endif @if(app('company')['enable_size']) @endif @endif @if(app('company')['show_mrp']) @endif @if(app('company')['show_discount']) @endif @if(app('company')['tax_type'] != 'no-tax') @endif @endforeach @php $noteColumns = 5+ $totalBatchTrackingRowCount + app('company')['show_mrp'] - ((app('company')['tax_type'] =='no-tax') ? 1 : 0) - (app('company')['show_discount'] ? 0 : 1); $noteRosSpan = 4 - ((app('company')['tax_type'] =='no-tax') ? 1 : 0); $amountInWordsRowSpan = 3 + app('company')['show_mrp'] + app('company')['show_party_due_payment']; @endphp @if(app('company')['tax_type'] != 'no-tax') @endif @if(app('company')['show_mrp']) @php $savedAmount = $sale->itemTransaction->sum(function ($transaction) { if($transaction->mrp > 0){ return ($transaction->mrp * $transaction->quantity) - $transaction->total; }else{ return 0; } }); @endphp @endif @if(app('company')['show_party_due_payment']) @php $partyTotalDue = $sale->party->getPartyTotalDueBalance(); $partyTotalDueBalance = $partyTotalDue['status']=='you_pay' ? (-1 * $partyTotalDue['balance']) : $partyTotalDue['balance']; @endphp @endif
# {{ __('item.item') }}{{ __('item.batch_no') }}{{ __('item.mfg_date') }}{{ __('item.exp_date') }}{{ __('item.model_no') }}{{ __('item.color') }}{{ __('item.size') }}{{ __('item.mrp') }}{{ __('app.price_per_unit') }}{{ __('app.discount') }}{{ __('tax.tax') }}{{ __('app.total') }}
{{ $i++ }} {{ $transaction->item->name }}
{!! $transaction->description !!} @if ($transaction->itemSerialTransaction->count() > 0)
{{ $transaction->itemSerialTransaction->pluck('itemSerialMaster.serial_code')->implode(',') }}
@endif
{{ $transaction->batch ? $transaction->batch->itemBatchMaster->batch_no : '' }} {{ $transaction->batch ? $formatDate->toUserDateFormat($transaction->batch->itemBatchMaster->mfg_date) : '' }} {{ $transaction->batch ? $formatDate->toUserDateFormat($transaction->batch->itemBatchMaster->exp_date) : '' }} {{ $transaction->batch ? $transaction->batch->itemBatchMaster->model_no : ''}} {{ $transaction->batch ? $transaction->batch->itemBatchMaster->color :'' }} {{ $transaction->batch ? $transaction->batch->itemBatchMaster->size : '' }} {{ $formatNumber->formatWithPrecision($transaction->batch ? $transaction->batch->itemBatchMaster->mrp : $transaction->mrp)}} {{ $formatNumber->formatWithPrecision($transaction->unit_price) }}
{{ $transaction->unit->name }}
{{ $formatNumber->formatWithPrecision($transaction->discount_amount) }}
({{ $formatNumber->formatWithPrecision($transaction->discount) }} {{ ($transaction->discount_type == 'fixed') ? '$' : '%' }})
{{ $formatNumber->formatWithPrecision($transaction->tax_amount) }}
({{ $transaction->tax->rate }}%)
{{ $formatNumber->formatWithPrecision($transaction->total) }}
{{ $sale->note }} {{ __('app.subtotal') }} {{ $formatNumber->formatWithPrecision($subtotal) }}
{{ __('app.discount') }} {{ $formatNumber->formatWithPrecision($discount) }}
{{ __('tax.tax') }} {{ $formatNumber->formatWithPrecision($taxAmount) }}
{{ __('app.round_off') }} {{ $formatNumber->formatWithPrecision($roundOff) }}
{{ __('app.grand_total') }} {{ $formatNumber->formatWithPrecision($grandTotal) }}
{{ __('payment.paid_amount') }} {{$formatNumber->formatWithPrecision($paidAmount)}}
{{ __('payment.balance') }} {{$formatNumber->formatWithPrecision($grandTotal - $paidAmount)}}
{{ __('app.you_saved') }} {{$formatNumber->formatWithPrecision($savedAmount)}}
{{ __('app.total_due_balance') }} {{$formatNumber->formatWithPrecision($partyTotalDueBalance)}}