From 0e44ea7a2366f1bc351aa3577436e0e185aedc57 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Sun, 2 Jun 2013 01:53:17 +0200 Subject: [PATCH] =?utf8?q?Mezisou=C4=8Dty=20v=20kase=20(sem=20zv=C4=9Bdave?= =?utf8?q?j=20p=C5=99i=20kolika=20radcich=20se=20to=20vysere=20:-)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- assistants/bank.inc.php | 7 ++++++- locale/cs/messages.inc.php | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assistants/bank.inc.php b/assistants/bank.inc.php index f6bc5c5..4c816cb 100644 --- a/assistants/bank.inc.php +++ b/assistants/bank.inc.php @@ -2,6 +2,7 @@ $bank_currency='Kč'; global $bank_table; $bank_table='transaction'; +$recursive=true; //USE RECURSIVE QUERIES??? function bank_name($name) { return strtolower(trim($name)); @@ -174,7 +175,11 @@ switch($SUBPATH[0]) { db->safe_query_fetch("SELECT * FROM `${bank_table}` WHERE (`${bank_table}_to`=$account_sql OR `${bank_table}_from`=$account_sql) AND (".bank_month_sql($this,$month).") ORDER BY ${bank_table}_time DESC;"); + $subtotal=$recursive?",( + (SELECT SUM(${bank_table}_amount) FROM ${bank_table} x WHERE ${bank_table}_to=$account_sql AND x.${bank_table}_id<=${bank_table}.${bank_table}_id) + -(SELECT SUM(${bank_table}_amount) FROM ${bank_table} x WHERE ${bank_table}_from=$account_sql AND x.${bank_table}_id<=${bank_table}.${bank_table}_id) + ) as ${bank_table}_subtotal":''; + $result = $this->db->safe_query_fetch("SELECT *${subtotal} FROM `${bank_table}` WHERE (`${bank_table}_to`=$account_sql OR `${bank_table}_from`=$account_sql) AND (".bank_month_sql($this,$month).") ORDER BY ${bank_table}_time DESC;"); //TADY } echo ("

Přehled transakcí $month

"); echo $this->html->render_item_table($result,$bank_table); diff --git a/locale/cs/messages.inc.php b/locale/cs/messages.inc.php index f8316e8..94e86f4 100644 --- a/locale/cs/messages.inc.php +++ b/locale/cs/messages.inc.php @@ -71,6 +71,7 @@ $LOCALE_MESSAGES = array( 'transaction_author_backend' => 'Odpověný', 'transaction_comment' => 'Popis', 'transaction_total' => 'Součet', + 'transaction_subtotal' => 'Mezisoučet', 'transaction_account' => 'Účet', 'model_relations' => 'Souvisejici s timto modelem', -- 2.30.2