Purchase Order

{{ app('company')['name'] }}

{{ app('company')['address'] }}

@if(app('company')['mobile'] || app('company')['email'])

{{ app('company')['mobile'] ? 'M: '. app('company')['mobile'] : ''}}{{ app('company')['email'] ? ', Mail: '.app('company')['email'] : '' }}

@endif

Bill #: {{ $order->order_code }}

{{ __('order.date') }}: {{ $order->formatted_order_date }}

{{ __('app.due_date') }}: {{ $formatDate->toUserDateFormat($order->due_date) }}

{{ __('app.order_to') }}
{{ $order->party->first_name.' '. $order->party->last_name }}
{{ $order->party->billing_address }}
{{ __('app.ship_from') }}
{{ $order->party->shipping_address }}
@php $isHasBatchItem = ($order->itemTransaction->where('tracking_type', 'batch')->count() > 0) ? true : false; //Return from Controller $totalBatchTrackingRowCount = ($isHasBatchItem) ? $batchTrackingRowCount : 0; @endphp @if($isHasBatchItem) @endif @php $i=1; @endphp @foreach($order->itemTransaction as $transaction) @if($isHasBatchItem) @endif @endforeach @php $subtotal = $order->itemTransaction->sum(function ($transaction) { if($transaction->tax_type == 'inclusive'){ $unitPrice = calculatePrice($transaction->unit_price, $transaction->tax->rate, needInclusive: true); }else{ $unitPrice = calculatePrice($transaction->unit_price, $transaction->tax->rate, needInclusive: false); } return $unitPrice * $transaction->quantity; }); $discount = $order->itemTransaction->sum(function ($transaction) { return $transaction->discount_amount; }); $taxAmount = $order->itemTransaction->sum(function ($transaction) { return $transaction->tax_amount; }); @endphp
# {{ __('item.item') }} {{ __('item.hsn') }}{{ __('item.batch_no') }} {{ __('item.mfg_date') }} {{ __('item.exp_date') }} {{ __('item.model_no') }} {{ __('item.mrp') }} {{ __('item.color') }} {{ __('item.size') }}{{ __('app.qty') }} {{ __('app.price_per_unit') }} {{ __('app.discount') }} {{ __('tax.tax') }} {{ __('app.total') }}
{{ $i++ }} {{ $transaction->item->name }} {{ $transaction->description }} {{ $transaction->item->hsn }} {{ $transaction->batch ? $transaction->batch->batch_no : '' }} {{ $transaction->batch ? $formatDate->toUserDateFormat($transaction->batch->mfg_date) : '' }} {{ $transaction->batch ? $formatDate->toUserDateFormat($transaction->batch->exp_date) : '' }} {{ $transaction->batch ? $transaction->batch->model_no : ''}} {{ $transaction->batch ? $formatNumber->formatWithPrecision($transaction->batch->mrp) : '0.00' }} {{ $transaction->batch ? $transaction->batch->color :'' }} {{ $transaction->batch ? $transaction->batch->size : '' }} {{ $formatNumber->formatQuantity($transaction->quantity) }} {{ $formatNumber->formatWithPrecision(calculatePrice($transaction->unit_price, $transaction->tax->rate, needInclusive: ($transaction->tax_type == 'inclusive' ? true : false) )) }} {{ $formatNumber->formatWithPrecision($transaction->discount_amount) }}
({{ $formatNumber->formatWithPrecision($transaction->discount_amount) }} {{ ($transaction->discount_type == 'fixed') ? '$' : '%' }})
{{ $formatNumber->formatWithPrecision($transaction->tax_amount) }}
({{ $transaction->tax->rate }}%)
{{ $formatNumber->formatWithPrecision($transaction->total) }}
Note:
{{ $order->note }}
{{ __('app.subtotal') }} {{ $formatNumber->formatWithPrecision($subtotal) }}
{{ __('app.discount') }} {{ $formatNumber->formatWithPrecision($discount) }}
{{ __('tax.tax') }} {{ $formatNumber->formatWithPrecision($taxAmount) }}
{{ __('app.round_off') }} {{ $formatNumber->formatWithPrecision($order->round_off) }}
{{ __('app.amount_in_words') }}:
{{ __('app.grand_total') }} {{ $formatNumber->formatWithPrecision($order->grand_total) }}
{{ __('payment.paid_amount') }} {{$formatNumber->formatWithPrecision($order->paid_amount)}}
{{ __('payment.balance') }} {{$formatNumber->formatWithPrecision($order->grand_total - $order->paid_amount)}}
@if(app('company')['show_tax_summary']) @if(app('company')['tax_type'] == 'tax') @else {{-- GST --}} @endif @php if(app('company')['tax_type'] == 'tax'){ $taxSummary = $order->itemTransaction ->groupBy('tax_id') ->map(function ($group) { $firstItem = $group->first(); $totalTaxableAmount = $group->sum(function ($item) use ($firstItem) { $totalOfEachItem = ($item->unit_price-$item->discount_amount) * $item->quantity; if ($item->tax_type == 'inclusive') { return calculatePrice($totalOfEachItem, $firstItem->tax->rate, needInclusive: true); } else { return calculatePrice($totalOfEachItem, $firstItem->tax->rate, needInclusive: false); } }); return [ 'tax_id' => $firstItem->tax_id, 'tax_name' => $firstItem->tax->name, 'tax_rate' => $firstItem->tax->rate, 'total_taxable_amount' => $totalTaxableAmount, 'total_tax' => $group->sum('tax_amount') ]; }) ->values(); } else{ //GST $taxSummary = $order->itemTransaction ->groupBy('item.hsn') // First group by HSN ->map(function ($hsnGroup) { return $hsnGroup->groupBy('tax_id') // Then group by tax_id within each HSN group ->map(function ($group) { $firstItem = $group->first(); $totalTaxableAmount = $group->sum(function ($item) { $totalOfEachItem = ($item->unit_price - $item->discount_amount) * $item->quantity; if ($item->tax_type == 'inclusive') { return calculatePrice($totalOfEachItem, $item->tax->rate, needInclusive: true); } else { return calculatePrice($totalOfEachItem, $item->tax->rate, needInclusive: false); } }); return [ 'hsn' => $firstItem->item->hsn, 'tax_id' => $firstItem->tax_id, 'tax_name' => $firstItem->tax->name, 'tax_rate' => $firstItem->tax->rate, 'total_taxable_amount' => $totalTaxableAmount, 'total_tax' => $group->sum('tax_amount') ]; }); }) ->flatMap(function ($hsnGroup) { return $hsnGroup; }) ->values(); } @endphp @foreach($taxSummary as $summary) @if(app('company')['tax_type'] == 'tax') @else @php $cs_gst = $i_gst = ''; $cs_gst_amt = $i_gst_amt = ''; if(app('company')['state_id'] == $order->state_id){ $cs_gst = ($summary['tax_rate']/2).'%'; $cs_gst_amt = $formatNumber->formatWithPrecision($summary['total_tax']/2); }else{ $i_gst = ($summary['tax_rate']).'%'; $i_gst_amt = $formatNumber->formatWithPrecision($summary['total_tax']); } @endphp @endif @endforeach
{{ __('tax.tax') }} {{ __('tax.taxable_amount') }} {{ __('tax.rate') }} {{ __('tax.tax_amount') }}
{{ __('item.hsn') }} {{ __('tax.taxable_amount') }} {{ __('tax.cgst') }} {{ __('tax.sgst') }} {{ __('tax.igst') }} {{ __('tax.tax_amount') }}
{{ __('tax.rate') }}% {{ __('app.amount') }} {{ __('tax.rate') }}% {{ __('app.amount') }} {{ __('tax.rate') }}% {{ __('app.amount') }}
{{ $summary['tax_name'] }} {{ $formatNumber->formatWithPrecision($summary['total_taxable_amount']) }} {{ $summary['tax_rate'] }}% {{ $formatNumber->formatWithPrecision($summary['total_tax']) }}
{{ $summary['hsn'] }} {{ $formatNumber->formatWithPrecision($summary['total_taxable_amount']) }} {{ $cs_gst }} {{ $cs_gst_amt }} {{ $cs_gst }} {{ $cs_gst_amt }} {{ $i_gst }} {{ $i_gst_amt }} {{ $formatNumber->formatWithPrecision($summary['total_tax']) }}
@endif @if(app('company')['show_terms_and_conditions_on_invoice'])
{{ __('app.terms_and_conditions') }}
{!! nl2br(app('company')['terms_and_conditions']) !!}
@endif
{{ __('app.bank_details') }}

{!! nl2br(app('company')['bank_details']) !!}

@if(app('company')['show_signature_on_invoice']) Signature @endif

{{ app('company')['name'] }}

{{ __('app.authorized_signatory') }}