@extends('layouts.app')
@section('title', __('medaccounting::lang.departmental_pl'))
@section('content')
<section class="content-header"><h1>@lang('medaccounting::lang.departmental_pl')</h1></section>
<section class="content">
    @include('medaccounting::reports.partials.filter', ['action' => route('medacc.reports.departmental')])
    @component('components.widget', ['class' => 'box-primary'])
        <table class="table table-bordered table-striped">
            <thead><tr>
                <th>@lang('medaccounting::lang.cost_center')</th>
                <th>@lang('medaccounting::lang.cost_center_type')</th>
                <th class="text-right">@lang('medaccounting::lang.revenue')</th>
                <th class="text-right">@lang('medaccounting::lang.expenses')</th>
                <th class="text-right">@lang('medaccounting::lang.net')</th>
            </tr></thead>
            <tbody>
            @forelse($rows as $r)
                <tr>
                    <td>{{ $r['name'] }}</td>
                    <td>@lang('medaccounting::lang.cc_type_' . $r['type'])</td>
                    <td class="text-right">{{ number_format($r['revenue'], 2) }}</td>
                    <td class="text-right">{{ number_format($r['expense'], 2) }}</td>
                    <td class="text-right"><strong class="{{ $r['net'] >= 0 ? 'text-green' : 'text-red' }}">{{ number_format($r['net'], 2) }}</strong></td>
                </tr>
            @empty
                <tr><td colspan="5" class="text-center text-muted">@lang('medaccounting::lang.no_data')</td></tr>
            @endforelse
            </tbody>
        </table>
    @endcomponent
</section>
@endsection
