From fff6ce4082b64db5d470acf63ecb2730ef2b5e8a Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Sat, 20 Aug 2011 02:19:03 +0200 Subject: [PATCH] Pridany statistiky --- assistants/stats.inc.php | 16 ++++++++++++++++ index.php | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 assistants/stats.inc.php diff --git a/assistants/stats.inc.php b/assistants/stats.inc.php new file mode 100644 index 0000000..404a601 --- /dev/null +++ b/assistants/stats.inc.php @@ -0,0 +1,16 @@ + 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0', + 'Použito celkem' => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0 AND status_id = 2', + 'Prodáno celkem' => 'SELECT COUNT(item_id),SUM(item_price_in) FROM item WHERE item_valid_till=0 AND status_id = 3', + 'Počet kusů skladem' => 'SELECT room_id,room_name,model_id,model_name,model_barcode,COUNT(item_id)'. + ' FROM item LEFT JOIN model USING(model_id) LEFT JOIN room USING(room_id)'. + ' WHERE item_valid_till=0 AND status_id=1'. + ' GROUP BY model_id,room_id'. + ' ORDER BY room_id,model_id;' +); + +foreach($queries as $description => $sql) { + echo "

$description

"; + echo $this->html->render_item_table($result = $this->db->safe_query($sql)->fetchAll(PDO::FETCH_ASSOC)); +} diff --git a/index.php b/index.php index 93c32ad..8f37200 100755 --- a/index.php +++ b/index.php @@ -148,6 +148,7 @@ class Sklad_HTML extends HTML {
  • Home
  • Assistants +
  • stats
  • store
  • dispose
  • sell
  • @@ -224,7 +225,7 @@ EOF; ); foreach($table as $id => $row) { foreach($collapse as $link => $title) - if(isset($table[$id][$link])) { + if(isset($table[$id][$link]) && isset($row[$title])) { $type = @array_shift(preg_split('/_/', $link)); if($link != $title) unset($table[$id][$link]); $table[$id][$title]=$this->link($row[$title], $type.'/'.$row[$link].'/'); -- 2.30.2