<?php $__env->startSection('content'); ?>
    <div class="report-profit-and-loss">
        <div class="header">
            <h4><?php echo $data->business->name; ?></h4>
            <h3>Profit and loss (by month)</h3>
        </div>

        <table class="table">
            <thead>
            <tr>
                <th>#</th>
                <?php foreach($data->months as $key => $month): ?>
                    <th><?php echo $month->description; ?></th>
                <?php endforeach; ?>
                <th>Total</th>
            </tr>
            <tr>
                <th>Type</th>
                <?php foreach($data->months as $key => $month): ?>
                    <th class="text-center">&pound</th>
                <?php endforeach; ?>
                <th class="text-center">&pound</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td><?php echo $data->itemReport->incomes->description; ?></td>
                <?php foreach($data->months as $key => $month): ?>
                    <?php if(count($data->itemReport->incomes->months) > 0): ?>
                        <td class="text-right"><?php echo Helper::formatAmount($data->itemReport->incomes->months[$key]); ?></td>
                    <?php else: ?>
                        <td class="text-right"></td>
                    <?php endif; ?>
                <?php endforeach; ?>
                <th class="text-right"><?php echo Helper::formatAmount($data->itemReport->incomes->amount); ?></th>
            </tr>
            <tr>
                <td><?php echo $data->itemReport->expenses->description; ?></td>
                <?php foreach($data->months as $key => $month): ?>
                    <?php if(count($data->itemReport->expenses->months) > 0): ?>
                        <td class="text-right"><?php echo Helper::formatAmount(-$data->itemReport->expenses->months[$key]); ?></td>
                    <?php else: ?>
                        <td class="text-right"></td>
                    <?php endif; ?>
                <?php endforeach; ?>
                <th class="text-right"><?php echo Helper::formatAmount(-$data->itemReport->expenses->amount); ?></th>
            </tr>
            <?php foreach($data->itemReport->subExpenses as $subExpense): ?>
                <tr>
                    <td><?php echo ' - ' . $subExpense->description; ?></td>
                    <?php foreach($data->months as $key => $month): ?>
                        <td class="text-right"><?php echo Helper::formatAmount($subExpense->months[$key]); ?></td>
                    <?php endforeach; ?>
                    <th class="text-right"><?php echo Helper::formatAmount($subExpense->amount); ?></th>
                </tr>
            <?php endforeach; ?>
            <tr>
                <td><?php echo $data->itemReport->standardAllowance->description; ?></td>
                <?php foreach($data->months as $key => $month): ?>
                    <td class="text-right"><?php echo Helper::formatAmount(-$data->itemReport->standardAllowance->months[$key]); ?></td>
                <?php endforeach; ?>
                <th class="text-right"><?php echo Helper::formatAmount(-$data->itemReport->standardAllowance->amount); ?></th>
            </tr>
            <tr>
                <td><?php echo $data->itemReport->disallowable->description; ?></td>
                <?php foreach($data->months as $key => $month): ?>
                    <td class="text-right"><?php echo Helper::formatAmount($data->itemReport->disallowable->months[$key]); ?></td>
                <?php endforeach; ?>
                <th class="text-right"><?php echo Helper::formatAmount($data->itemReport->disallowable->amount); ?></th>
            </tr>
            </tbody>
            <tfoot>
            <th><?php echo $data->itemReport->netBusinessIncome->description; ?></th>
            <?php foreach($data->months as $key => $month): ?>
                <th class="text-right"><?php echo Helper::formatAmount($data->itemReport->netBusinessIncome->months[$key]); ?></th>
            <?php endforeach; ?>
            <th class="text-right"><?php echo Helper::formatAmount($data->itemReport->netBusinessIncome->amount); ?></th>
            </tfoot>
        </table>
    </div>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.report', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>