試算表

重設
@if($isBalanced)

借貸平衡

借方總計等於貸方總計,試算表正確

@else

借貸不平衡

差額: NT$ {{ number_format(abs($difference), 2) }} ({{ $difference > 0 ? '借方多' : '貸方多' }})

@endif
借方總計
NT$ {{ number_format($grandDebitTotal, 2) }}
貸方總計
NT$ {{ number_format($grandCreditTotal, 2) }}
差額
NT$ {{ number_format(abs($difference), 2) }}
@php $typeLabels = [ 'asset' => '資產 (Assets)', 'liability' => '負債 (Liabilities)', 'net_asset' => '淨資產/基金 (Net Assets)', 'income' => '收入 (Income)', 'expense' => '支出 (Expenses)', ]; $typeOrder = ['asset', 'liability', 'net_asset', 'income', 'expense']; @endphp @if($accounts->count() > 0) @foreach($typeOrder as $type) @if(isset($accountsByType[$type]) && $accountsByType[$type]->count() > 0)

@switch($type) @case('asset') @break @case('liability') @break @case('net_asset') @break @case('income') @break @case('expense') @break @endswitch {{ $typeLabels[$type] ?? ucfirst($type) }}

@php $typeDebitTotal = 0; $typeCreditTotal = 0; @endphp @foreach($accountsByType[$type] as $item) @php $typeDebitTotal += $item['debit_total']; $typeCreditTotal += $item['credit_total']; @endphp @endforeach
科目代碼 科目名稱 借方 貸方
{{ $item['account']->account_code }} {{ $item['account']->account_name_zh }} {{ $item['account']->account_name_en }} {{ $item['debit_total'] > 0 ? number_format($item['debit_total'], 2) : '' }} {{ $item['credit_total'] > 0 ? number_format($item['credit_total'], 2) : '' }}
小計 {{ $typeDebitTotal > 0 ? number_format($typeDebitTotal, 2) : '' }} {{ $typeCreditTotal > 0 ? number_format($typeCreditTotal, 2) : '' }}
@endif @endforeach
總計 借方
NT$ {{ number_format($grandDebitTotal, 2) }}
貸方
NT$ {{ number_format($grandCreditTotal, 2) }}
差額
NT$ {{ number_format(abs($difference), 2) }}
@else

無會計分錄

所選期間內沒有會計分錄

@endif