Permalink
Browse files

Improved statistics books per language.

  • Loading branch information...
fmfurtado committed Nov 3, 2018
1 parent 450e24a commit 7ec5f24f59e41de998cdded2144680c7e67e7ef3
Showing with 20 additions and 1 deletion.
  1. +20 −1 server/reportStatistics.php
@@ -7,15 +7,34 @@
<h1><?= $t->__('reportStatistics.title') ?></h1>
<?php
$query_books_per_language = "select total, language_name from (select language, count(*) total from tb_book where lost = 0 group by language) tb_book inner join tb_language on tb_book.language = tb_language.language";
$data = $database->query($query_books_per_language)->fetchAll();
$numberBooks = $database->count("tb_book", ["lost" => 0]);
$numberBooksLost = $database->count("tb_book", ["lost" => 1]);
$numberPersons = $database->count("tb_person");
$numberLendedBooks = $database->count("tb_lend");
$numberLendedBooksToday = $database->count("tb_lend", array("date_return" => null));
?>
<h3><?= $t->__('reportStatistics.total_books')?></h3>
<table class="table table-hover">
<?php
foreach($data as $row) {
$fmw->escapeHtmlArray($row);
echo "<tr>";
echo "<td>", $row['language_name'], "</td>";
echo "<td>", $row['total'], "</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td><strong>", $t->__('reportStatistics.total_books'), "</strong></td>";
echo "<td><strong>", $numberBooks, "</strong></td>";
echo "</tr>";
?>
</table>
<?= $t->__('reportStatistics.total_books') ?>: <?= $numberBooks ?><br/>
<?= $t->__('reportStatistics.total_books_lost') ?>: <?= $numberBooksLost ?><br/>
<?= $t->__('reportStatistics.total_people') ?>: <?= $numberPersons ?><br/>
<?= $t->__('reportStatistics.total_lent') ?>: <?= $numberLendedBooks ?><br/>

0 comments on commit 7ec5f24

Please sign in to comment.