@extends('index') @section('content') Edit General Voucher Back @csrf @method('POST') Payee Type Select Payee Type transaction_to == 'vendor') selected @endif>Vendor transaction_to == 'contractor') selected @endif>Contractor transaction_to == 'employee') selected @endif>Employee transaction_to == 'customer') selected @endif>Customer Good job! Select Payee Type Payee Name Select Vendor @if($vendor->count()) @foreach($vendor as $item) payee_id == $item->vendor_id && $transaction->transaction_to == 'vendor') selected @endif>{{$item->vendor_no}} - {{$item->fname}} @endforeach @endif Select Contractor @if($contractor->count()) @foreach($contractor as $item) payee_id == $item->vendor_id && $transaction->transaction_to == 'contractor') selected @endif>{{$item->vendor_no}} - {{$item->fname}} @endforeach @endif Select Employee @if($employee->count()) @foreach($employee as $item) payee_id == $item->employee_id && $transaction->transaction_to == 'employee') selected @endif>{{$item->employee_no}} - {{$item->name}} @endforeach @endif Select Customer @if($customer->count()) @foreach($customer as $item) payee_id == $item->customer_id && $transaction->transaction_to == 'customer') selected @endif>{{$item->customer_no}} - {{$item->fname}} @endforeach @endif Good job! Select Payee Voucher Date Good job! Voucher Type @php // Determine voucher type based on transaction_to and stored values if ($transaction->transaction_to == 'customer') { // For customer vouchers, cc_amount is used // If credit is 0/null, it's a debit voucher (charge to customer) // If debit is 0/null, it's a credit voucher (credit to customer) $voucherType = ($transaction->credit == 0 || $transaction->credit === null) ? 'debit' : 'credit'; } else { // For other payees (vendor, contractor, employee), use debit/credit $voucherType = !empty($transaction->credit) ? 'debit' : 'credit'; } @endphp Select Voucher Type Debit Voucher (Charge to Payee) Credit Voucher (Credit to Payee) Good job! Select Voucher Type Amount @php // For customer vouchers, amount is stored in cc_amount // For other payees, amount is stored in debit or credit if ($transaction->transaction_to == 'customer') { $displayAmount = $transaction->cc_amount ?? 0; } else { $displayAmount = abs($transaction->debit ?? $transaction->credit ?? 0); } @endphp Good job! Enter Amount Description / Reason {{$transaction->description}} Good job! Enter Description Update @endsection