@extends('layouts.app')
@section('title','Balance Sheet')
@section('page_title','Balance Sheet')
@section('content')
<div class="page-head"><div><h1>Balance Sheet</h1><p>As at {{ $to }}</p></div></div><div class="card"><div class="card-body"><form class="actions"><div class="field"><label>As At</label><input class="control" type="date" name="to" value="{{ $to }}"></div><button class="btn btn-primary" style="align-self:end">Run Report</button></form></div></div>
<div class="grid grid-3" style="margin-top:18px"><div class="card metric"><div class="metric-label">Assets</div><div class="metric-value">AED {{ number_format($assets,2) }}</div></div><div class="card metric"><div class="metric-label">Liabilities</div><div class="metric-value">AED {{ number_format($liabilities,2) }}</div></div><div class="card metric"><div class="metric-label">Equity</div><div class="metric-value">AED {{ number_format($equity,2) }}</div></div></div>
<div class="card" style="margin-top:18px"><div class="table-wrap"><table class="table"><thead><tr><th>Section</th><th>Code</th><th>Account</th><th>Balance</th></tr></thead><tbody>@foreach(['asset'=>'Assets','liability'=>'Liabilities','equity'=>'Equity'] as $type=>$label)@foreach($rows->get($type,collect()) as $a)@if(abs($a->amount)>0.0001)<tr><td>{{ $label }}</td><td>{{ $a->code }}</td><td>{{ $a->name }}</td><td>{{ number_format($a->amount,2) }}</td></tr>@endif @endforeach @endforeach<tr><th colspan="3">Accounting Check (Assets - Liabilities - Equity)</th><th>{{ number_format($assets-$liabilities-$equity,2) }}</th></tr></tbody></table></div></div>
@endsection
