@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
| {{ __('app.description') }} | {{ __('app.price_per_unit') }} | {{ __('app.total') }} | |
|---|---|---|---|
|
{{ $transaction->item->name }} {!! $transaction->description !!} |
{{ $formatNumber->formatWithPrecision($transaction->unit_price) }} {{ $transaction->unit->name }} |
{{--
Note:
Calculate Total = (Unit Price - Discount) + Tax
Here we are showing only Total, in below destriburted the discount and Tax
--}}
{{ $formatNumber->formatWithPrecision($transaction->total) }} | |
| {{ __('app.total') }} | {{ $formatNumber->formatWithPrecision($subtotal) }} درهم | ||
| {{ __('tax.tax') }} | {{ __('tax.taxable_amount') }} | {{ __('tax.rate') }} | {{ __('tax.tax_amount') }} | |||
|---|---|---|---|---|---|---|
| {{ __('item.hsn') }} | {{ __('tax.taxable_amount') }} | {{ __('tax.gst') }} | {{ __('tax.tax_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']) }} | @php $cs_gst = $i_gst = ''; $cs_gst_amt = $i_gst_amt = ''; if($isCSGST){ $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 @if($isCSGST){{ $cs_gst }} | {{ $cs_gst_amt }} | @else{{ $i_gst }} | {{ $i_gst_amt }} | @endif{{ $formatNumber->formatWithPrecision($summary['total_tax']) }} |