created stats menu with balance stat

This commit is contained in:
Ricsi
2017-02-14 21:31:56 +01:00
parent 45f147cc4f
commit 9d8a1bd7cc
6 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
# STATISZTIKÁK
if ($this->is_id()) {
# ADOTT STAT MEGJELENÍTÉSE
# nem lehet rá univerzális megoldást adni, mindegyiknél más kell majd
# todo: stat_group-ok és stat_value-k
if (1 == $this->get_id()) {
$balance_query = "
select
(select
sum(mod_sum)
from
money_deposit) - (select
sum(mox_sum)
from
money_expense) as diff
from dual;
";
$balance = $sql->single_variable($balance_query);
$smarty->assign('balance',$balance);
$smarty->display('stat_balance.tpl');
}
}
else {
# STAT LISTA
$stat_query = "SELECT * FROM statistics WHERE stat_deleted = 0 ORDER BY stat_order ASC;";
$stat_assoc_array = $sql->assoc_array($stat_query);
$stats = array();
foreach ($stat_assoc_array as $stat) {
$new_stat = new stat();
$new_stat->set_stat_data_by_id($stat['stat_id']);
$stats[] = $new_stat;
}
$smarty->assign('stats',$stats);
$smarty->display('stat_list.tpl');
}
?>