<?php $__env->startSection('title', 'Profit & Loss'); ?>
<?php $__env->startSection('page_title', 'Profit & Loss Statement'); ?>
<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li><li class="breadcrumb-item active">Profit & Loss</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="card mb-3"><div class="card-body py-2">
        <form method="GET" class="row g-2 align-items-end">
            <div class="col-md-3"><label class="form-label small">From</label><input type="date" name="from" value="<?php echo e($from); ?>" class="form-control form-control-sm"></div>
            <div class="col-md-3"><label class="form-label small">To</label><input type="date" name="to" value="<?php echo e($to); ?>" class="form-control form-control-sm"></div>
            <div class="col-md-3"><button class="btn btn-sm btn-primary"><i class="bi bi-search me-1"></i>Generate</button></div>
        </form>
    </div></div>

    <div class="row g-3">
        <div class="col-lg-6">
            <div class="card h-100"><div class="card-header text-success"><i class="bi bi-arrow-down-circle me-1"></i>Income</div><div class="card-body">
                <table class="table table-sm mb-0">
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $income; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($r['account']->name); ?></td><td class="text-end"><?php echo e(number_format($r['amount'], 2)); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td class="text-muted text-center">No income.</td></tr><?php endif; ?>
                    </tbody>
                    <tfoot class="table-light"><tr class="fw-bold"><td>Total Income</td><td class="text-end"><?php echo e(number_format($totalIncome, 2)); ?></td></tr></tfoot>
                </table>
            </div></div>
        </div>
        <div class="col-lg-6">
            <div class="card h-100"><div class="card-header text-danger"><i class="bi bi-arrow-up-circle me-1"></i>Expenses</div><div class="card-body">
                <table class="table table-sm mb-0">
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $expense; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($r['account']->name); ?></td><td class="text-end"><?php echo e(number_format($r['amount'], 2)); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td class="text-muted text-center">No expenses.</td></tr><?php endif; ?>
                    </tbody>
                    <tfoot class="table-light"><tr class="fw-bold"><td>Total Expenses</td><td class="text-end"><?php echo e(number_format($totalExpense, 2)); ?></td></tr></tfoot>
                </table>
            </div></div>
        </div>
        <div class="col-12">
            <?php $net = $totalIncome - $totalExpense; ?>
            <div class="card"><div class="card-body d-flex justify-content-between align-items-center">
                <h5 class="mb-0">Net <?php echo e($net >= 0 ? 'Profit' : 'Loss'); ?></h5>
                <h4 class="mb-0 text-<?php echo e($net >= 0 ? 'success' : 'danger'); ?>">Rs <?php echo e(number_format(abs($net), 2)); ?></h4>
            </div></div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/u385418287/domains/itartificer.com/public_html/sms-erp/resources/views/accounting/reports/profit-loss.blade.php ENDPATH**/ ?>