From: Thomas Mudrunka Date: Fri, 26 Aug 2011 10:31:17 +0000 (+0200) Subject: Vylepseni financnich statistik X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=3d270c4f9affbada3f5171bd74437bcbcdf63430;p=mirrors%2FSokoMan.git Vylepseni financnich statistik --- diff --git a/assistants/stats.inc.php b/assistants/stats.inc.php index bd7caf0..2169da1 100644 --- a/assistants/stats.inc.php +++ b/assistants/stats.inc.php @@ -18,14 +18,14 @@ $queries = array( //TODO: use build_query_select()!!! "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, "Prodáno celkem $month" - => 'SELECT COUNT(item_id),SUM(item_price_out) FROM item WHERE item_valid_till=0 AND status_id = 3'.$month_sql, + => 'SELECT COUNT(item_id),SUM(item_price_out),SUM(item_price_in),(SUM(item_price_out)-SUM(item_price_in)) 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 $month" - => 'SELECT ( + => "SELECT ( SUM(item_price_out) - -(SELECT SUM(item_price_in) FROM item WHERE item_valid_till=0) - ) FROM item WHERE item_valid_till=0 AND ( status_id = 3 )', + -(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", "Počet kusů skladem" => 'SELECT room_id,room_name,model_id,model_name,model_barcode,COUNT(item_id),SUM(item_quantity)'. ' FROM item LEFT JOIN model USING(model_id) LEFT JOIN room USING(room_id)'.