Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // statistics.php
- $client_list = "";
- $years = array("2010", "2011", "2012", "2013", "2014");
- foreach($years as $year) {
- $stats[$year] = $db->getAll("SELECT clientname, type, currency, unit,
- COUNT(projectID) as count,
- SUM(units) AS units_sum,
- SUM(totalprice) AS client_sum
- FROM `".PROJECT_TABLE."`
- WHERE YEAR(duedate) = {$year}
- GROUP BY clientID, type, unit, currency");
- }
- //print_r($stat_by_type);
- foreach($stats as $type_key => $type_value) {
- $client_list .= "<tr><td>".$type_key."</td></tr><tr><td>";
- print "<pre>";
- print_r($type_value);
- print "</pre>";
- foreach($type_value as $value) {
- $client_list .= $value->clientname.":";
- $client_list .= "<li>".$value->count." ".$value->type."</li>";
- $client_list .= "<li>".$value->units_sum." ".$value->unit."</li>";
- $client_list .= "<li>".$value->client_sum." ".$value->currency."</li>";
- }
- $client_list .= "</td></tr>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment