From: Thomas Mudrunka Date: Mon, 23 Jun 2014 18:18:26 +0000 (+0200) Subject: Limit dlouhejch vypisu v kase X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=9787a5ca4ed77d6a1ebd42ad86aa1db55fe0d7cd;p=mirrors%2FSokoMan.git Limit dlouhejch vypisu v kase --- diff --git a/assistants/bank.inc.php b/assistants/bank.inc.php index d6137cf..548e56d 100644 --- a/assistants/bank.inc.php +++ b/assistants/bank.inc.php @@ -3,6 +3,7 @@ $bank_currency='Kč'; global $bank_table; $bank_table='transaction'; $recursive=true; //USE RECURSIVE QUERIES??? +$limit=23; function bank_name($name) { return strtolower(trim($name)); @@ -145,6 +146,9 @@ foreach($accounts as $account) { switch($SUBPATH[0]) { default: + if(isset($_GET['limit'])) $limit = intval($_GET['limit']); + $limit_sql = $limit==0 ? '' : ' LIMIT '.intval($limit); + if(!isset($_GET['account'])) { echo("

Banka $month

"); echo ("

Stav $month

"); @@ -152,7 +156,7 @@ switch($SUBPATH[0]) { echo("Transakcí $month: ".$result[0]['troughput']."
"); $result = $this->db->safe_query_fetch("SELECT SUM(${bank_table}_amount) as troughput FROM ${bank_table} WHERE ".bank_month_sql($this,$month).';'); echo("Obrat $month: ".$result[0]['troughput'].' '.$bank_currency); - $result = $this->db->safe_query_fetch("SELECT * FROM `${bank_table}` WHERE ".bank_month_sql($this,$month)." ORDER BY ${bank_table}_time DESC;"); + $result = $this->db->safe_query_fetch("SELECT * FROM `${bank_table}` WHERE ".bank_month_sql($this,$month)." ORDER BY ${bank_table}_time DESC".$limit_sql.";"); $overview=bank_get_overview($this,$bank_table.'_',$month); echo $this->html->render_item_table($overview['table'],'bank'); } else { @@ -185,11 +189,16 @@ switch($SUBPATH[0]) { -(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":''; //(@flux := IF(transaction_to='harvie',IF(transaction_from='harvie',0,1),IF(transaction_from='harvie',-1,0))) as flux - $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;"); + $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".$limit_sql.";"); } echo ("

Přehled transakcí $month

"); echo $this->html->render_item_table($result,$bank_table); + if(!isset($_GET['limit'])) + echo("zobrazit vše..."); + if($limit == 0) + echo('to je vše.'); + break; case 'admin': ?>