$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,
- "<strike>Nakoupeno celkem $month</strike>"
- => '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,
- "<strike>Prodáno celkem $month</strike>"
- => '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"
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",
- "<strike>Bilance celkem =(prodej - všechny nákupy) $month</strike>"
- => "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",
);
<?php
$queries += array(
- "Skladová soupiska (Warehouse roster)"=>
- "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"
);