<?php
if (!auth_can('invoices.view')) return;
$db = Database::getInstance();
$outstanding = (float)$db->fetchColumn("SELECT COALESCE(SUM(balance_due),0) FROM invoices WHERE status IN ('issued','partially_paid','overdue') AND is_deleted=0");
?>
<div class="card border-warning h-100">
    <div class="card-body">
        <div class="d-flex justify-content-between">
            <div>
                <h6 class="text-muted mb-1"><?= lang('finance.total_outstanding') ?></h6>
                <h3 class="mb-0"><?= money($outstanding) ?></h3>
            </div>
            <div class="align-self-center"><i class="fas fa-file-invoice-dollar fa-2x text-warning opacity-50"></i></div>
        </div>
    </div>
</div>