From: Thomas Mudrunka Date: Sat, 1 Jun 2013 23:53:17 +0000 (+0200) Subject: Mezisoučty v kase (sem zvědavej při kolika radcich se to vysere :-) X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=0e44ea7a2366f1bc351aa3577436e0e185aedc57;p=mirrors%2FSokoMan.git Mezisoučty v kase (sem zvědavej při kolika radcich se to vysere :-) --- 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',