From 92e594ee328358ab4337e16a9f524e2c542853a1 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 14 Jun 2024 13:41:16 -0400 Subject: [PATCH] Updated Budget UI to include card header and made a view only option for budget --- budget.php | 110 ++++++++++++++++++++++++++---------------------- budget_edit.php | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ side_nav.php | 2 +- 3 files changed, 170 insertions(+), 52 deletions(-) create mode 100644 budget_edit.php diff --git a/budget.php b/budget.php index 8c4b4ae2..834ca0f5 100644 --- a/budget.php +++ b/budget.php @@ -10,16 +10,24 @@ while($row = mysqli_fetch_assoc($result)) { $categories[] = $row; } +// Fetch years with budget +$query = "SELECT DISTINCT budget_year FROM budget ORDER BY budget_year ASC"; +$result = mysqli_query($mysqli, $query); +$years = []; +while ($row = mysqli_fetch_assoc($result)) { + $years[] = $row['budget_year']; +} + // Fetch current year budgets $currentYear = date("Y"); -if(isset($_GET['year'])) { +if (isset($_GET['year'])) { $currentYear = intval($_GET['year']); } $query = "SELECT * FROM budget WHERE budget_year = $currentYear"; $result = mysqli_query($mysqli, $query); $budgets = []; -while($row = mysqli_fetch_assoc($result)) { +while ($row = mysqli_fetch_assoc($result)) { $budgets[] = $row; } @@ -28,64 +36,64 @@ $columnTotals = array_fill(0, 12, 0); $grandTotal = 0; ?> -
- -

Budget for

+
+
+

Budget for

+ +
+
-
- - - +
+ + + + + + + + + + + - - - + + $month): + $amount = getBudgetAmount($budgets, $category['category_id'], $index + 1); + $rowTotal += $amount; + $columnTotals[$index] += $amount; + ?> + - + - - - - - - $month): - $amount = getBudgetAmount($budgets, $category['category_id'], $index + 1); - $rowTotal += $amount; - $columnTotals[$index] += $amount; - ?> - - - - - - - - - - - - - - - -
ExpenseTotal
Expense Total
Total
- - -
-
- + + + + + Total + + + + + + +
+
+
+

Editing Budget for

+
+ + View Budget + + + +
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + $month): + $amount = getBudgetAmount($budgets, $category['category_id'], $index + 1); + $rowTotal += $amount; + $columnTotals[$index] += $amount; + ?> + + + + + + + + + + + + + + + +
ExpenseTotal
Total
+
+
+ +
+ + diff --git a/side_nav.php b/side_nav.php index ca7d5de7..e89feca8 100644 --- a/side_nav.php +++ b/side_nav.php @@ -163,7 +163,7 @@