diff --git a/expense_files.php b/expense_files.php new file mode 100644 index 0000000..4c61839 --- /dev/null +++ b/expense_files.php @@ -0,0 +1,88 @@ +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']) ?> | +
+
+
+
+
+
+ = htmlspecialchars($f['uploaded_by'] ?? 'System') ?>
+ |
+ = date('M j, Y H:i', strtotime($f['created_at'])) ?> | +
+
+ = $f['entry_date'] ?>
+ + = htmlspecialchars($f['supplier_name']) ?> - = htmlspecialchars($f['project_name']) ?> + |
+ + View + | +
| Type | +Filename | +Size | +Uploaded By | +Created At | +Linked Entry | +Actions | +
|---|---|---|---|---|---|---|
| No files found in the system. | ||||||
| + + Labour + + Expense + + = ucfirst($f['entity_type']) ?> + + | ++ = htmlspecialchars($f['file_name']) ?> + | += formatBytes((int)$f['file_size']) ?> | += htmlspecialchars($f['uploaded_by'] ?? 'System') ?> | += date('M j, Y', strtotime($f['created_at'])) ?> | ++ + = htmlspecialchars($f['linked_entry_info'] ?? 'N/A') ?> + + | ++ View + | +
| Filename | +Size | +Uploaded By | +Created At | +Linked Entry | +Actions | +
|---|---|---|---|---|---|
| No labour files found. | |||||
| + + = htmlspecialchars($f['file_name']) ?> + | += formatBytes((int)$f['file_size']) ?> | +
+
+
+
+
+
+ = htmlspecialchars($f['uploaded_by'] ?? 'System') ?>
+ |
+ = date('M j, Y H:i', strtotime($f['created_at'])) ?> | +
+
+ = $f['entry_date'] ?>
+ + = htmlspecialchars($f['employee_name']) ?> - = htmlspecialchars($f['project_name']) ?> + |
+ + View + | +
| Name | |
|---|---|
| Name | Actions |
| = htmlspecialchars($item['name']) ?> | |
| = htmlspecialchars($item['name']) ?> | ++ + + | +
| Name | |
|---|---|
| Name | Actions |
| = htmlspecialchars($item['name']) ?> | |
| = htmlspecialchars($item['name']) ?> | ++ + + | +
| Name | |
|---|---|
| Name | Actions |
| = htmlspecialchars($item['name']) ?> | |
| = htmlspecialchars($item['name']) ?> | ++ + + | +
| Name | |
|---|---|
| Name | Actions |
| = htmlspecialchars($item['name']) ?> |
| Name | -Type | -Contact Info | -||
|---|---|---|---|---|
| = htmlspecialchars($item['name']) ?> | -= ucfirst($item['type']) ?> | -= htmlspecialchars($item['contact_info'] ?? '') ?> | += htmlspecialchars($item['name']) ?> | ++ + + |