put shirt statistics into one table
This commit is contained in:
parent
e8daa4d2ce
commit
28788e6702
|
@ -146,25 +146,21 @@ function admin_active() {
|
||||||
$matched_users[] = $usr;
|
$matched_users[] = $usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
$given_shirt_statistics = sql_select("
|
$shirt_statistics = [];
|
||||||
SELECT `Size`, count(`Size`) AS `count`
|
foreach ($tshirt_sizes as $size => $_) {
|
||||||
FROM `User`
|
if ($size != '') {
|
||||||
WHERE `Tshirt`=1
|
$shirt_statistics[] = [
|
||||||
GROUP BY `Size`
|
'size' => $size,
|
||||||
ORDER BY `Size` DESC");
|
'needed' => sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Gekommen`=1"),
|
||||||
$given_shirt_statistics[] = array(
|
'given' => sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Tshirt`=1")
|
||||||
'Size' => '<b>' . _("Sum") . '</b>',
|
];
|
||||||
'count' => '<b>' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '</b>'
|
}
|
||||||
);
|
}
|
||||||
$needed_shirt_statistics = sql_select("
|
$shirt_statistics[] = [
|
||||||
SELECT `Size`, count(`Size`) AS `count`
|
'size' => '<b>' . _("Sum") . '</b>',
|
||||||
FROM `User`
|
'needed' => '<b>' . User_arrived_count() . '</b>',
|
||||||
GROUP BY `Size`
|
'given' => '<b>' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '</b>'
|
||||||
ORDER BY `Size` DESC");
|
];
|
||||||
$needed_shirt_statistics[] = array(
|
|
||||||
'Size' => '<b>' . _("Sum") . '</b>',
|
|
||||||
'count' => '<b>' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '</b>'
|
|
||||||
);
|
|
||||||
|
|
||||||
return page_with_title(admin_active_title(), array(
|
return page_with_title(admin_active_title(), array(
|
||||||
form(array(
|
form(array(
|
||||||
|
@ -187,22 +183,12 @@ function admin_active() {
|
||||||
'tshirt' => _("T-shirt?"),
|
'tshirt' => _("T-shirt?"),
|
||||||
'actions' => ""
|
'actions' => ""
|
||||||
), $matched_users),
|
), $matched_users),
|
||||||
div('row', [
|
'<h2>' . _("Shirt statistics") . '</h2>',
|
||||||
div('col-md-6', [
|
table(array(
|
||||||
'<h2>' . _("Needed shirts") . '</h2>' ,
|
'size' => _("Size"),
|
||||||
table(array(
|
'needed' => _("Needed shirts"),
|
||||||
'Size' => _("Size"),
|
'given' => _("Given shirts")
|
||||||
'count' => _("Count")
|
), $shirt_statistics)
|
||||||
), $needed_shirt_statistics)
|
|
||||||
]),
|
|
||||||
div('col-md-6', [
|
|
||||||
'<h2>' . _("Given shirts") . '</h2>',
|
|
||||||
table(array(
|
|
||||||
'Size' => _("Size"),
|
|
||||||
'count' => _("Count")
|
|
||||||
), $given_shirt_statistics)
|
|
||||||
])
|
|
||||||
])
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue