updated report page

git-svn-id: svn://anubis/tipman@5 ce01c143-e732-0410-ac0e-c064f6e6c7ef
This commit is contained in:
Josh Holtrop 2008-09-08 02:12:35 +00:00
parent 159338a18c
commit 6b0600ac4d
2 changed files with 16 additions and 3 deletions

10
report.css Normal file
View File

@ -0,0 +1,10 @@
table {
border-top: solid 1px #000;
border-left: solid 1px #000;
}
th, td {
border-bottom: solid 1px #000;
border-right: solid 1px #000;
padding: 2px 1ex;
}

View File

@ -1,5 +1,6 @@
<?php
include_once("vars.inc");
include_once("functions.inc");
session_start();
@ -18,7 +19,7 @@
}
/* Some variables */
$user = $_SESSION['user'];
$userID = get_userID($_SESSION['user']);
$year = $_GET['year'];
$tip_totals = Array();
@ -27,6 +28,7 @@
<html>
<head>
<title>TipMan Report for $year</title>
<link rel="stylesheet" href="report.css" />
</head>
<body>
EOP;
@ -38,7 +40,7 @@ SELECT MONTH(tips.date) AS month,
IF(DAYOFMONTH(tips.date) < 16, 1, 2) AS period,
SUM(tips.amount) AS tip_total
FROM tips
WHERE user = $user
WHERE user = $userID
AND YEAR(tips.date) = $year
GROUP BY month, period;
EOQ
@ -65,12 +67,13 @@ EOQ
$tip_totals[$monthIndex][2] = 0;
/* Print a row in the report table */
print('<td>');
print('<tr>');
printf('<td rowspan="2">%s</td>', date('F', $monthTimestamp));
print('<td>1 - 15</td>');
printf('<td>$%.2f</td>', $tip_totals[$monthIndex][1]);
printf('<td rowspan="2">$%.2f</td>',
$tip_totals[$monthIndex][1] + $tip_totals[$monthIndex][2]);
print('</tr><tr>');
printf('<td>16 - %d</td>', date('t', $monthTimestamp));
printf('<td>$%.2f</td>', $tip_totals[$monthIndex][2]);
print("</tr>\n");