@php // Load user to get watermark image path $approvedByUser = \App\Models\User::find(28); $watermarkPath = public_path('upload/admin_images/' . ($approvedByUser->sign ?? 'default.png')); // Calculate sum of advances $transportAdvance = $voucher->transport_advance ?? 0; $moneyAdvance = $voucher->money_advance ?? 0; $tarpaulinAdvance = $voucher->tarpaulin_advance ?? 0; $sumAdvances = $transportAdvance + $moneyAdvance + $tarpaulinAdvance; @endphp Watermark

P.O Box 81 Kyotera Ssanje, Kabano

+256 706 058246

Farmer Payment Voucher

Name: {{ $grn->farmer->farmer_fname }} {{ $grn->farmer->farmer_lname }}

Phone: {{ $grn->farmer->farmer_contact }}

Group: {{ $grn->farmer->group->group_name ?? 'N/A' }}

Voucher No: {{ $grn->id }}

@foreach($grades as $dbField => $displayLabel) @php $quantity = (float) ($voucher->$dbField ?? 0); @endphp @if($quantity > 0) @php $unitPriceField = 'unit_price_' . $dbField; $unitPrice = (float) ($voucher->$unitPriceField ?? 0); $amount = $quantity * $unitPrice; @endphp @endif @endforeach {{-- Advance deduction showing sum only if > 0 --}} @if($sumAdvances > 0) @endif
Grade Qty Price Amount
{{ $displayLabel }} {{ number_format($quantity, 0) }} {{ number_format($unitPrice, 0) }} {{ number_format($amount, 0) }}
Total Qty {{ number_format($voucher->total_quantity, 0) }}
Sub-Total {{ number_format($voucher->subtotal_amount, 0) }}
Hulling Cost {{ number_format($voucher->hulling_cost ?? 0, 0) }}
Sacks {{ number_format($voucher->sacks_cost ?? 0, 0) }}
Advance Deduction {{ number_format($sumAdvances, 0) }}
Total Deductions {{ number_format($voucher->total_deductions ?? 0, 0) }}
MC / Deduction {{ number_format($voucher->moisture_content ?? 0, 1) }}% / {{ number_format($voucher->mc_ded ?? 0, 0) }}
Out Turn {{ number_format($grn->out_turn ?? 0, 0) }}%
Kibooko / FAQ {{ number_format($grn->kiboko ?? 0, 0) }} / {{ number_format($voucher->faq ?? 0, 0) }}
NET PAY: {{ number_format($voucher->net_pay, 0) }}

Season FAQ: {{ number_format($faqSum, 0) }}Kg

Prepared By: {{ strtoupper($savedByUser->name) }}

Date: {{ \Carbon\Carbon::parse($voucher->date_saved)->format('d/m/Y') }}

Account No: @if(!empty($grn->farmer->sacco_account)) {{ $grn->farmer->sacco_account }} @else Effect payment from Hope Coffee Uganda CH-SACCO Account @endif