<?php $__env->startSection('title', __('Business Reports')); ?>
<?php $__env->startSection('content'); ?>
<?php ($period = __('Period').': '.$from.' - '.$to); ?>
<div class="card mb-3">
    <div class="card-body p-4">
        <?php echo $__env->make('reports.partials.header', ['title' => __('Business Reports'), 'period' => $period], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
        <form class="row g-2 align-items-end no-print">
            <div class="col-md-3"><label class="form-label"><?php echo e(__('From')); ?></label><input name="from" type="date" class="form-control" value="<?php echo e($from); ?>"></div>
            <div class="col-md-3"><label class="form-label"><?php echo e(__('To')); ?></label><input name="to" type="date" class="form-control" value="<?php echo e($to); ?>"></div>
            <div class="col-auto"><button class="btn btn-success"><i class="fa-solid fa-filter me-1"></i><?php echo e(__('Apply')); ?></button></div>
            <div class="col-auto"><button type="button" onclick="window.print()" class="btn btn-light"><i class="fa-solid fa-print me-1"></i><?php echo e(__('Print')); ?></button></div>
        </form>
    </div>
</div>

<div class="row g-3">
    <?php $__currentLoopData = [
        ['Sales', $salesTotal, 'fa-chart-column', 'text-success', __('Invoices').': '.$salesCount],
        ['Purchases', $purchaseTotal, 'fa-cart-arrow-down', 'text-warning', __('Purchases').': '.$purchaseCount],
        ['Expenses', $expenses, 'fa-money-bill-transfer', 'text-danger', __('Operating expenses')],
        ['Gross Profit', $grossProfit, 'fa-scale-balanced', $grossProfit >= 0 ? 'text-success' : 'text-danger', __('Sales minus cost of goods')],
        ['Net Profit', $netProfit, 'fa-file-invoice-dollar', $netProfit >= 0 ? 'text-success' : 'text-danger', __('After expenses')],
        ['Inventory Value', $inventoryValue, 'fa-warehouse', 'text-success', __('Low Stock Items').': '.$lowStockCount],
        ['Customer Due', $receivable, 'fa-user-clock', 'text-danger', __('Accounts Receivable')],
        ['Supplier Due', $payable, 'fa-truck-field', 'text-danger', __('Supplier Payables')],
    ]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$label, $value, $icon, $class, $caption]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="col-md-6 col-xl-3">
            <div class="card h-100">
                <div class="card-body d-flex gap-3 align-items-start">
                    <div class="stat-icon"><i class="fa-solid <?php echo e($icon); ?>"></i></div>
                    <div>
                        <small class="text-muted"><?php echo e(__($label)); ?></small>
                        <h5 class="mb-1 money <?php echo e($class); ?>"><?php echo e(number_format($value, 2)); ?> <?php echo e($moneyCode); ?></h5>
                        <small class="text-muted"><?php echo e($caption); ?></small>
                    </div>
                </div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>

<div class="card mt-3">
    <div class="card-body p-4">
        <h6 class="mb-3"><?php echo e(__('Report Center')); ?></h6>
        <div class="row g-2">
            <?php $__currentLoopData = [
                ['reports.sales', 'fa-chart-column', 'Sales Report'],
                ['reports.purchases', 'fa-cart-arrow-down', 'Purchase Report'],
                ['reports.stock', 'fa-boxes-stacked', 'Stock Report'],
                ['reports.payments', 'fa-arrow-up', 'Payments Report'],
                ['reports.receipts', 'fa-arrow-down', 'Receipts Report'],
                ['reports.customer-balances', 'fa-users', 'Customer Balances'],
                ['reports.supplier-balances', 'fa-truck-field', 'Supplier Balances'],
                ['reports.chart-of-accounts', 'fa-list-check', 'Chart of Accounts'],
                ['reports.balance-sheet', 'fa-scale-balanced', 'Balance Sheet'],
                ['reports.income-statement', 'fa-file-invoice-dollar', 'Income Statement'],
            ]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$route, $icon, $label]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="col-md-4">
                    <a class="btn btn-light w-100 text-start py-3" href="<?php echo e(route($route, in_array($route, ['reports.sales', 'reports.purchases', 'reports.payments', 'reports.receipts']) ? ['from' => $from, 'to' => $to] : [])); ?>"><i class="fa-solid <?php echo e($icon); ?> text-success me-2"></i><?php echo e(__($label)); ?></a>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
</div>

<?php if(!empty($appSettings['report_footer'])): ?>
    <p class="text-center text-muted small mt-3"><?php echo e($appSettings['report_footer']); ?></p>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\TradeERP\resources\views/reports/index.blade.php ENDPATH**/ ?>