From: Thomas Mudrunka Date: Fri, 31 May 2013 04:54:42 +0000 (+0200) Subject: Hezci JSON z kasy X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=5a4b211608098406e4abab63cc8ff52f21e19275;p=mirrors%2FSokoMan.git Hezci JSON z kasy --- diff --git a/assistants/bank.inc.php b/assistants/bank.inc.php index eb04f23..0c0e27d 100644 --- a/assistants/bank.inc.php +++ b/assistants/bank.inc.php @@ -64,12 +64,16 @@ function bank_rename_account($ctx, $old, $new) { function bank_get_overview($ctx,$prefix='') { global $bank_table; $accounts = bank_get_accounts($ctx); - foreach($accounts as $acc) $overview[]=array("${prefix}account"=>$acc,"${prefix}total"=>bank_get_total($ctx, $acc)); + foreach($accounts as $acc) { + $total=bank_get_total($ctx, $acc); + $overview['table'][]=array("${prefix}account"=>$acc,"${prefix}total"=>$total); + $overview['array'][$acc]=$total; + } return $overview; } if(isset($bank_json_only) && $bank_json_only) die(json_encode(array( - 'overview'=>bank_get_overview($this) + 'overview'=>bank_get_overview($this)['array'] ))); if(isset($_POST['create_account'])) { @@ -109,7 +113,7 @@ switch($SUBPATH[0]) { $result = $this->db->safe_query_fetch("SELECT SUM(${bank_table}_amount) as troughput FROM ${bank_table};"); echo("Obrat: ".$result[0]['troughput'].' '.$bank_currency); $result = $this->db->safe_query_fetch("SELECT * FROM `${bank_table}` ORDER BY ${bank_table}_time DESC;"); - echo $this->html->render_item_table(bank_get_overview($this, $bank_table.'_'),'bank'); + echo $this->html->render_item_table(bank_get_overview($this, $bank_table.'_')['table'],'bank'); echo ("

Přehled transakcí

"); } else { $account=bank_name($_GET['account']);