From: Thomas Mudrunka Date: Thu, 19 Jul 2012 17:58:57 +0000 (+0200) Subject: Roster veci na pocet, promazani financnich statistik X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=5396feb782b02e37a93c63d3e7f9e867940aa98b;p=mirrors%2FSokoMan.git Roster veci na pocet, promazani financnich statistik --- diff --git a/assistants/stats/financial.inc.php b/assistants/stats/financial.inc.php index d06edba..fe03f8b 100644 --- a/assistants/stats/financial.inc.php +++ b/assistants/stats/financial.inc.php @@ -20,14 +20,10 @@ if($month_sql == '') $month=''; $queries += array( //TODO: use build_query_select()!!! "Nakoupeno celkem $month" => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0'.$month_sql_bought, - "Nakoupeno celkem $month" - => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0'.$month_sql, "Použito celkem $month" => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0 AND status_id = 2'.$month_sql_sold, "Prodáno celkem $month" => 'SELECT COUNT(item_id),SUM(item_price_out),SUM(item_price_in),(SUM(item_price_out)-SUM(item_price_in)) as sale_profit FROM item WHERE item_valid_till=0 AND status_id = 3'.$month_sql_sold, - "Prodáno celkem $month" - => 'SELECT COUNT(item_id),SUM(item_price_out),SUM(item_price_in),(SUM(item_price_out)-SUM(item_price_in)) as sale_profit FROM item WHERE item_valid_till=0 AND status_id = 3'.$month_sql, "Skladem celkem $month" => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0 AND status_id = 1'.$month_sql, "Bilance celkem =(prodej - všechny nákupy) $month" @@ -35,9 +31,4 @@ $queries += array( //TODO: use build_query_select()!!! SUM(item_price_out) -(SELECT SUM(item_price_in) FROM item WHERE item_valid_till=0$month_sql_bought) ) FROM item WHERE item_valid_till=0 AND ( status_id = 3 )$month_sql_sold", - "Bilance celkem =(prodej - všechny nákupy) $month" - => "SELECT ( - SUM(item_price_out) - -(SELECT SUM(item_price_in) FROM item WHERE item_valid_till=0$month_sql) - ) FROM item WHERE item_valid_till=0 AND ( status_id = 3 )$month_sql", ); diff --git a/assistants/stats/roster.inc.php b/assistants/stats/roster.inc.php index d4b4d6c..a1e501d 100644 --- a/assistants/stats/roster.inc.php +++ b/assistants/stats/roster.inc.php @@ -1,5 +1,7 @@ - "select model_id, model_name, group_concat(item_serial separator ', ') from item LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 GROUP BY model_id", + "Skladová soupiska věcí se seriáky (Warehouse roster countable)"=> + "select model_id, model_name, group_concat(item_serial separator ', ') from item LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 AND model_countable=1 GROUP BY model_id", + "Skladová soupiska věcí na počet (Warehouse roster uncountable)"=> + "select model_id, model_name, sum(item_quantity) from item LEFT JOIN model USING(model_id) WHERE item_valid_till=0 AND status_id=1 AND model_countable=0 GROUP BY model_id" );