prepare(" SELECT a.*, ex.entry_date, s.name as supplier_name, p.name as project_name FROM attachments a JOIN expenses ex ON a.entity_id = ex.id JOIN suppliers s ON ex.supplier_id = s.id JOIN projects p ON ex.project_id = p.id WHERE a.tenant_id = ? AND a.entity_type = 'expense' ORDER BY a.created_at DESC "); $stmt->execute([$tenant_id]); $files = $stmt->fetchAll(); function formatBytes($bytes, $precision = 2) { $units = ['B', 'KB', 'MB', 'GB', 'TB']; $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } $pageTitle = "SR&ED Manager - Expense Files"; include __DIR__ . '/includes/header.php'; ?>
| Filename | Size | Uploaded By | Created At | Linked Entry | Actions |
|---|---|---|---|---|---|
| No expense files found. | |||||
| = htmlspecialchars($f['file_name']) ?> | = formatBytes((int)$f['file_size']) ?> |
|
= date('M j, Y H:i', strtotime($f['created_at'])) ?> |
= $f['entry_date'] ?>
= htmlspecialchars($f['supplier_name']) ?> - = htmlspecialchars($f['project_name']) ?> |
View |