@extends('layouts.app')
@section('title', __('Income Statement'))
@section('content')
@php($gross = $revenue - $costOfSales)
@php($net = $gross + $otherIncome - $expenses)
<div class="card" style="max-width:820px">
    <div class="card-body p-4">
        @include('reports.partials.header', ['title' => __('Income Statement'), 'period' => __('All time')])
        <div class="text-end mb-3 no-print"><button onclick="window.print()" class="btn btn-light btn-sm"><i class="fa-solid fa-print me-1"></i>{{ __('Print') }}</button></div>
        <div class="d-flex justify-content-between py-2"><span>{{ __('Sales Revenue') }}</span><strong class="money">{{ number_format($revenue, 2) }} {{ $moneyCode }}</strong></div>
        <div class="d-flex justify-content-between py-2 text-danger"><span>{{ __('Cost of Goods Sold') }}</span><strong class="money">({{ number_format($costOfSales, 2) }} {{ $moneyCode }})</strong></div>
        <hr>
        <div class="d-flex justify-content-between py-2"><strong>{{ __('Gross Profit') }}</strong><strong class="money">{{ number_format($gross, 2) }} {{ $moneyCode }}</strong></div>
        <div class="d-flex justify-content-between py-2 text-success"><span>{{ __('Other Income / General Receipts') }}</span><strong class="money">{{ number_format($otherIncome, 2) }} {{ $moneyCode }}</strong></div>
        <div class="d-flex justify-content-between py-2 text-danger"><span>{{ __('Operating & General Expenses') }}</span><strong class="money">({{ number_format($expenses, 2) }} {{ $moneyCode }})</strong></div>
        <hr>
        <div class="d-flex justify-content-between pt-2 fs-4 {{ $net >= 0 ? 'text-success' : 'text-danger' }}"><strong>{{ __('Net Profit') }}</strong><strong class="money">{{ number_format($net, 2) }} {{ $moneyCode }}</strong></div>
    </div>
</div>
@if(!empty($appSettings['report_footer']))<p class="text-muted small mt-3" style="max-width:820px">{{ $appSettings['report_footer'] }}</p>@endif
@endsection
