$selectedMonth = intval($_GET["month"]); $selectedYear = intval($_GET["year"]); } else { $invalidDate = true; require_once ROOT_PATH . "includes/layouts/output.html.php"; exit; } } else { $selectedMonth = date("n", time()); $selectedYear = date("Y", time()); } $selectedDate = mktime(0, 0, 0, $selectedMonth, 1, $selectedYear); $daysInSelectedMonth = cal_days_in_month(CAL_GREGORIAN, $selectedMonth, $selectedYear); $mySqlFormatedDateStart = $selectedYear . "-" . $selectedMonth . "-1"; $mySqlFormatedDateEnd = $selectedYear . "-" . $selectedMonth . "-" . $daysInSelectedMonth; $selectedMonthName = getMonthsArray()[$selectedMonth - 1]; } else { if ($view === "yearly") { // Check if a specified date was entered. If not then set the month as the current month if (isset($_GET["year"])) { if (isValidYear(intval($_GET["year"]))) { $selectedYear = intval($_GET["year"]); } else { $invalidDate = true; require_once ROOT_PATH . "includes/layouts/output.html.php"; exit; } } else { $selectedYear = date("Y", time()); } $selectedDate = mktime(0, 0, 0, 1, 1, $selectedYear);
<?php $months = getMonthsArray(); ?> <div id="calendar"> <h4 id="calendarHeading"> <img src="<?php echo BASE_URL . "images/leftArrow.png"; ?> " alt="prevMonth" id="prevCalendar"> <span id="calendarHeadingText"><?php echo "{$selectedYear}"; ?> </span> <img src="<?php echo BASE_URL . "images/rightArrow.png"; ?> " alt="nextMonth" id="nextCalendar"> </h4> <ul id="months"> <?php for ($ii = 1; $ii <= count($months); $ii++) { ?> <li<?php if ($selectedMonth === $ii) { echo ' id="currentMonth"'; } ?> ><a href="<?php
<table> <tr> <th></th> <th>Income</th> <th>Expenses</th> <th>Net</th> </tr> <?php for ($ii = 1; $ii <= 12; $ii++) { ?> <tr> <td><a href="<?php echo BASE_URL . "main/?view=monthly&month={$ii}&year={$selectedYear}"; ?> "><?php echo getMonthsArray()[$ii - 1]; ?> </a></td> <td><?php echo htmlentities(Income::formatDisplayAmount($incomeEachMonth[$ii - 1])); ?> </td> <td><?php echo htmlentities(Expense::formatDisplayAmount($expenseEachMonth[$ii - 1])); ?> </td> <td><?php echo htmlentities(IncomeExpenseObject::formatDisplayAmount($totalEachMonth[$ii - 1])); ?> </td> </tr>