@php /* * fmt(): formats numbers exactly as in the screenshot * 0 → empty (or '-' for totals) * positive → number_format no decimals * negative → (number) */ $fmt = fn($v, bool $dashZero = false) => $v == 0 ? ($dashZero ? '' : '') : ($v < 0 ? '(' . number_format(abs($v), 0) . ')' : number_format($v, 0)); $fmtT = fn($v) => $v == 0 // for totals: show nothing if zero ? '' : ($v < 0 ? '(' . number_format(abs($v), 0) . ')' : number_format($v, 0)); $vehicles = $reportData['vehicles']; $grandTotal = $reportData['grandTotal']; $fromFmt = \Carbon\Carbon::parse($dateFrom)->format('d/m/y'); $toFmt = \Carbon\Carbon::parse($dateTo)->format('d/m/y'); $clientStr = $supplierName ? strtoupper($supplierName) : 'ALL SUPPLIERS'; @endphp {{-- ─── Report Header ─────────────────────────────── --}}
M.D.S
Purchase Billing Vehicle Register   گاڑی بیچک رجسٹر
From : {{ $fromFmt }}, To : {{ $toFmt }}, Client: {{ $clientStr }}{{ $vehicleNo ? ', Vehicle: ' . $vehicleNo : '' }}
{{-- ─── Table ──────────────────────────────────────── --}} {{-- Columns exactly as screenshot (right→left visual order, but table is LTR so leftmost column is تاریخ on far right visually): Screenshot header (RTL reading order, left on page = last column): بختہ بکری | کل خرچہ | کمیشن | نقد | ڈاک خرچ متفرقات | مارکیٹ فیس | مزدوری محصول | کرایہ محصول | قیمت | وزن | بوری | مال | سپلار | گاڑی نمبر | بلٹی نمبر | تاریخ In LTR table: col 1 = تاریخ (rightmost visible), col 16 = بختہ بکری (leftmost visible) We set dir=rtl on the whole outer div so that the table appears RTL. --}} @foreach($vehicles as $vehicle) {{-- ── Vehicle heading ── --}} @foreach($vehicle['bilties'] as $bilty) @php $itemCount = max(count($bilty['items']), 1); @endphp @if(count($bilty['items']) > 0) @foreach($bilty['items'] as $idx => $item) {{-- Date — rowspan all items in this bilty --}} @if($idx === 0) @endif {{-- Bilty No --}} @if($idx === 0) @endif {{-- Vehicle No --}} @if($idx === 0) @endif {{-- Supplier --}} @if($idx === 0) @endif {{-- Mal (item name) --}} {{-- Bori --}} {{-- Weight --}} {{-- Qeemat (amount per item row) --}} {{-- Expense columns — rowspan the whole bilty --}} @if($idx === 0) @endif @endforeach @else {{-- No items — single blank row --}} @endif @endforeach {{-- ── Vehicle subtotal row ── --}} {{-- In screenshot the subtotal row shows: col1(تاریخ) empty | col2(بلٹی) empty | col3(گاڑی نمبر) empty | col4(سپلار) empty | col5(مال) empty | col6(بوری)=301 | col7(وزن)=32,978 | col8(قیمت)=1,484,010 | col9(کرایہ)=513,500 | col10(مزدوری)=3,913 | col11(مارکیٹ)=400 | col12(ڈاک)=200 | col13(نقد)=empty | col14(کمیشن)=74,201 | col15(کل خرچہ)=592,214 | col16(بختہ بکری)=891,796 --}} @endforeach {{-- ── Grand Total ── --}} @if(count($vehicles) > 1) @endif
تاریخ بلٹی نمبر گاڑی نمبر سپلار مال بوری وزن قیمت کرایہ
محصول
مزدوری
محصول
مارکیٹ
فیس
ڈاک خرچ
متفرقات
نقد کمیشن کل خرچہ بختہ بکری
گاڑی نمبر : {{ $vehicle['pb_no'] }}
{{ \Carbon\Carbon::parse($bilty['date'])->format('d/m/y') }} {{ $bilty['bilty_no'] }} {{ $vehicle['pb_no'] }} {{ $bilty['supplier_name'] }} {{ $item->child_cate_name ?? '' }}{{ $item->bori ? number_format($item->bori) : '' }}{{ $item->weight ? number_format($item->weight) : '' }}{{ $item->amount ? number_format($item->amount, 0) : '' }} {{ $fmtT($bilty['detail']['rent_recieve_amount']) }} {{ $fmtT($bilty['detail']['labour_amount']) }} {{ $fmtT($bilty['detail']['market_fees_amount']) }} {{ $fmtT($bilty['detail']['post_expense_amount']) }} {{ $fmtT($bilty['detail']['cash_amount']) }} {{ $fmtT($bilty['detail']['commission_amount']) }} {{ $fmtT($bilty['detail']['total_expanse_amount']) }} {{ $fmtT($bilty['detail']['save_amount']) }}
{{ \Carbon\Carbon::parse($bilty['date'])->format('d/m/y') }} {{ $bilty['bilty_no'] }} {{ $vehicle['pb_no'] }} {{ $bilty['supplier_name'] }} {{ $fmtT($bilty['detail']['rent_recieve_amount']) }} {{ $fmtT($bilty['detail']['labour_amount']) }} {{ $fmtT($bilty['detail']['market_fees_amount']) }} {{ $fmtT($bilty['detail']['post_expense_amount']) }} {{ $fmtT($bilty['detail']['cash_amount']) }} {{ $fmtT($bilty['detail']['commission_amount']) }} {{ $fmtT($bilty['detail']['total_expanse_amount']) }} {{ $fmtT($bilty['detail']['save_amount']) }}
{{ $vehicle['vehicleTotals']['total_bori'] > 0 ? number_format($vehicle['vehicleTotals']['total_bori']) : '' }} {{ $vehicle['vehicleTotals']['total_weight'] > 0 ? number_format($vehicle['vehicleTotals']['total_weight']) : '' }} {{ $fmtT($vehicle['vehicleTotals']['total_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['rent_recieve_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['labour_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['market_fees_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['post_expense_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['cash_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['commission_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['total_expanse_amount']) }} {{ $fmtT($vehicle['vehicleTotals']['save_amount']) }}
گل {{ $vehicle['pb_no'] }} گاڑی @if(count($vehicle['bilties'])) {{ $vehicle['pb_no'] }} @endif بوری {{ number_format($vehicle['vehicleTotals']['total_bori']) }} وزن {{ number_format($vehicle['vehicleTotals']['total_weight']) }} قیمت {{ number_format($vehicle['vehicleTotals']['total_amount']) }} بختہ بکری {{ number_format($vehicle['vehicleTotals']['save_amount']) }}
کرایہ محصول {{ number_format($vehicle['vehicleTotals']['rent_recieve_amount']) }} مزدوری {{ number_format($vehicle['vehicleTotals']['labour_amount']) }} مارکیٹ فیس {{ number_format($vehicle['vehicleTotals']['market_fees_amount']) }} ڈاک خرچہ {{ number_format($vehicle['vehicleTotals']['post_expense_amount']) }} نقد {{ number_format($vehicle['vehicleTotals']['cash_amount']) }} کمیشن {{ number_format($vehicle['vehicleTotals']['commission_amount']) }}
کل خرچہ {{ number_format($vehicle['vehicleTotals']['total_expanse_amount']) }}
کل مجموعہ {{ $grandTotal['total_bori'] > 0 ? number_format($grandTotal['total_bori']) : '' }} {{ $grandTotal['total_weight'] > 0 ? number_format($grandTotal['total_weight']) : '' }} {{ $fmtT($grandTotal['total_amount']) }} {{ $fmtT($grandTotal['rent_recieve_amount']) }} {{ $fmtT($grandTotal['labour_amount']) }} {{ $fmtT($grandTotal['market_fees_amount']) }} {{ $fmtT($grandTotal['post_expense_amount']) }} {{ $fmtT($grandTotal['cash_amount']) }} {{ $fmtT($grandTotal['commission_amount']) }} {{ $fmtT($grandTotal['total_expanse_amount']) }} {{ $fmtT($grandTotal['save_amount']) }}
{{-- RTL trick: wrap the entire page in RTL so the table reads right-to-left visually (تاریخ on the far right, بختہ بکری on the far left) while the table itself remains LTR internally for correct column ordering. --}}