created stats menu with balance stat
This commit is contained in:
56
_include/include_stats.php
Normal file
56
_include/include_stats.php
Normal 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');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user