$table_row = '<tr class="t%d"><td>%s</td><td align="center">%s</td><td align="center">%s</td><td><a href="edit.php?id=%d">%s</a></td></tr>';
$table_sum = '<tr class="t%d"><td> </td><td align="center"><strong>%s</strong></td><td> </td><td><strong>Summe</strong></td></tr>';
- $query = "SELECT stempel.oid,start,customer,time,task,kurz FROM stempel JOIN stempel_status ON (stempel.status = stempel_status.id) WHERE time IS NOT NULL ";
+ $query = <<<EOS
+SELECT stempel.oid,start,stempel_customer.name AS customer,time,task,kurz
+FROM stempel
+JOIN stempel_customer ON (stempel.customer = stempel_customer.short)
+JOIN stempel_status ON (stempel.status = stempel_status.id)
+WHERE time IS NOT NULL
+EOS;
if (isset($month) && $month !== 'all')
- $query .= "AND cast(start AS TEXT) LIKE '".$month."-%' ";
- $query .= "ORDER BY customer,start";
+ $query .= " AND cast(start AS TEXT) LIKE '".$month."-%'";
+ $query .= " ORDER BY customer,start";
$sth = pg_exec ($dbh, $query);
echo($table_foot);
}
$cname = $name[$row['customer']];
- if (!strlen($cname)) $cname = ucfirst($row['customer']);
+ if (!strlen($cname)) $cname = $row['customer'];
printf($table_head, $cname);
$customer = $row['customer'];
$sum = 0;