تاریخ: {{ $b_cheque->date->format('d/m/Y') }}
محترمی جناب: {{ $b_cheque->supplier->supplier_name_urdu }}
حوالہ نمبر: {{ $b_cheque->bilty_no }}
گاڑی نمبر: {{ $b_cheque->goodReceiptTruck->truck_no }}
@php
$details = $b_cheque->details;
$maal = $b_cheque->items;
$totalBori = $maal->sum('bori');
$rows = collect([
(object)['item'=>'کرایہ محصول','value'=>number_format($details->rent_recieve_amount,0) ?? '-'],
(object)['item'=>'مزوری','value'=>number_format($details->labour_amount * $totalBori,0) ?? '-'],
(object)['item'=>'مارکیٹ فیس','value'=>number_format($details->market_fees_amount,0) ?? '-'],
(object)['item'=>'ڈاک خرج','value'=>number_format($details->post_expense_amount,0) ?? '-'],
(object)['item'=>'خرجہ متفرقات','value'=>number_format($details->miscellaneous_expense_amount,0) ?? '-'],
(object)['item'=>'نقد','value'=>number_format($details->cash_amount,0) ?? '-'],
(object)['item'=>'کمیشن','value'=>number_format($details->commission_amount,0) ?? '-'],
]);
$prevChild = ['id'=>null,'name'=>null];
$prevRate = null;
$prevMarka = null;
$sumBori=0;
$sumWeight=0;
$sumAmount=0;
$bori=0;
$weight=0;
$total_amount=0;
$printedItems=[];
$countIndex=0;
@endphp
| تفصیل خرج |
رقم |
مال |
بورے |
وزن |
بهاؤدر |
قیمت |
@foreach ($maal as $m)
@php
$currentChild = [
'id'=>$m->child_cate,
'name'=>is_array($m->productChildCate) ? $m->productChildCate['name_urdu'] : $m->productChildCate->name_urdu
];
$currentRate = $m->rate;
$currentMarka = $m->marka;
$bori += $m->bori;
$weight += $m->weight;
$total_amount += $m->amount;
@endphp
@if ($prevChild['id'] === $currentChild['id'] && $prevRate === $currentRate && $prevMarka === $currentMarka)
@php
$sumBori += $m->bori;
$sumWeight += $m->weight;
$sumAmount += $m->amount;
@endphp
@else
@if ($prevChild['id'] !== null)
| {{ $rows[$countIndex]->item ?? '' }} |
{{ $rows[$countIndex]->value ?? '' }} |
{{ $prevChild['name'] }}({{($m->marka)}}) |
{{ $sumBori }} |
{{ $sumWeight }} |
{{ number_format($prevRate,0) }} |
{{ number_format($sumAmount,0) }} |
@php $printedItems[] = $rows[$countIndex]->item ?? ''; @endphp
@endif
@php
$prevChild = $currentChild;
$prevRate = $currentRate;
$prevMarka = $currentMarka;
$sumBori = $m->bori;
$sumWeight = $m->weight;
$sumAmount = $m->amount;
$countIndex++;
@endphp
@endif
@endforeach
{{-- Last group --}}
| {{ $rows[$countIndex]->item ?? '' }} |
{{ $rows[$countIndex]->value ?? '' }} |
{{ $prevChild['name']}} ({{($m->marka)}}) |
{{ $sumBori }} |
{{ $sumWeight }} |
{{ number_format($prevRate,0) }} |
{{ number_format($sumAmount,0) }} |
@php $printedItems[] = $rows[$countIndex]->item ?? ''; @endphp
{{-- Print remaining rows without duplicates --}}
@foreach ($rows as $item)
@if (!in_array($item->item, $printedItems))
| {{ $item->item }} |
{{ $item->value }} |
| | | | |
@endif
@endforeach
{{-- Totals --}}
| کل خرجہ |
{{ number_format($details->total_expanse_amount,0) }} |
|
|
|
|
|
|
|
|
{{ $bori }} |
{{ $weight }} |
|
|
| خام بکری |
{{ number_format($total_amount,0) }} |
| کل خرجہ |
{{ number_format($details->total_expanse_amount,0) }} |
| پختہ بکری |
{{ number_format($total_amount - $details->total_expanse_amount,0) }} |