From 0ab217099c554f1e6aebac5035501cf54308a6a7 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 9 Sep 2008 01:29:21 +0000 Subject: [PATCH] added checks to report page per krissy git-svn-id: svn://anubis/tipman@7 ce01c143-e732-0410-ac0e-c064f6e6c7ef --- report.css | 4 ++++ report.php | 59 +++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/report.css b/report.css index 3deae07..6036f8a 100644 --- a/report.css +++ b/report.css @@ -8,3 +8,7 @@ th, td { border-right: solid 1px #000; padding: 2px 1ex; } + +.amnt { + text-align: right; +} diff --git a/report.php b/report.php index 5ebfc81..fe2df1f 100644 --- a/report.php +++ b/report.php @@ -22,6 +22,7 @@ $userID = get_userID($_SESSION['user']); $year = $_GET['year']; $tip_totals = Array(); + $check_totals = Array(); /* Print some header HTML */ print <<'); - print('MonthPeriodAmountTotal'); + print('MonthPeriodTipsChecksTotal'); for ($monthIndex = 1; $monthIndex <= 12; $monthIndex++) { /* Get a timestamp for the current month */ $monthTimestamp = mktime(0, 0, 0, $monthIndex, 1, $year); - /* Set the tip totals for each period to 0 if they are not set */ + /* Set the totals for each period to 0 if they are not set */ if (!isset($tip_totals[$monthIndex][1])) $tip_totals[$monthIndex][1] = 0; if (!isset($tip_totals[$monthIndex][2])) $tip_totals[$monthIndex][2] = 0; + if (!isset($check_totals[$monthIndex][1])) + $check_totals[$monthIndex][1] = 0; + if (!isset($check_totals[$monthIndex][2])) + $check_totals[$monthIndex][2] = 0; /* Print a row in the report table */ print(''); printf('%s', date('F', $monthTimestamp)); print('1 - 15'); - printf('$%.2f', $tip_totals[$monthIndex][1]); - printf('$%.2f', - $tip_totals[$monthIndex][1] + $tip_totals[$monthIndex][2]); + printf('$%.2f', $tip_totals[$monthIndex][1]); + printf('$%.2f', $check_totals[$monthIndex][1]); + printf('$%.2f', + $tip_totals[$monthIndex][1] + $tip_totals[$monthIndex][2] + + $check_totals[$monthIndex][1] + $check_totals[$monthIndex][2]); print(''); printf('16 - %d', date('t', $monthTimestamp)); - printf('$%.2f', $tip_totals[$monthIndex][2]); + printf('$%.2f', $tip_totals[$monthIndex][2]); + printf('$%.2f', $check_totals[$monthIndex][2]); print("\n"); - /* Increment the year's total tips */ - $yearTotal += $tip_totals[$monthIndex][1]; - $yearTotal += $tip_totals[$monthIndex][2]; + /* Increment the year's totals */ + $yearTipTotal += $tip_totals[$monthIndex][1]; + $yearTipTotal += $tip_totals[$monthIndex][2]; + $yearChecksTotal += $check_totals[$monthIndex][1]; + $yearChecksTotal += $check_totals[$monthIndex][2]; } - printf(' - Total:$%.2f', - $yearTotal); + printf('Total: + $%.2f + $%.2f + $%.2f', + $yearTipTotal, + $yearChecksTotal, + $yearTipTotal + $yearChecksTotal); print(''); ?>