Files
code-cegled/_include/include_stats.php
2017-02-15 23:34:54 +01:00

56 lines
1013 B
PHP

<?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');
}
?>