Beispiel #1
0
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'03\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month3,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'04\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month4,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'05\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month5,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'06\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month6,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'07\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month7,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'08\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month8,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'09\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month9,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'10\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month10,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'11\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month11,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'12\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month12
					FROM ' . TABLE_CUSTOMERS . '
					GROUP BY month1';
                $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
                $third_tab_content .= $nl . ' data.addRows(12);';
                if ($result[1] >= 0) {
                    $third_tab_content .= draw_set_values($result[0], $chart_type, _LOGINS);
                }
                $third_tab_content .= ' } </script>';
                $third_tab_content .= '<script type="text/javascript">';
                $third_tab_content .= $nl . ' google.load(\'visualization\', \'1\', {packages: [\'' . $chart_type . '\']});';
                $third_tab_content .= $nl . ' google.setOnLoadCallback(drawVisualization);';
                $third_tab_content .= $nl . ' function frmStatistics_Submit() { document.frmStatistics.submit(); }';
                $third_tab_content .= '</script>';
                $third_tab_content .= get_chart_changer('1_3', $chart_type, $year);
                $third_tab_content .= '<div id="div_visualization" style="width:600px;height:310px;">
		<img src="images/loading.gif" style="margin:100px auto;" alt="" /></div>';
            }
        }
    }
    $tabs = new Tabs(1, 'xp', TABS_DIR, '?admin=statistics');
    //$tabs->SetHttpVars(array('admin'));
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'04\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month4,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'05\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month5,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'06\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month6,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'07\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month7,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'08\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month8,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'09\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month9,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'10\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month10,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'11\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month11,
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'12\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month12
				  FROM ' . TABLE_ORDERS . '
				  GROUP BY month1 ';
            $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
            $second_tab_content .= $nl . ' data.addRows(12);';
            if ($result[1] >= 0) {
                $default_currency = Currencies::GetDefaultCurrency();
                $second_tab_content .= draw_set_values($result[0], $chart_type, _INCOME, $default_currency);
            }
            $second_tab_content .= ' } </script>';
            $second_tab_content .= '<script type="text/javascript">';
            $second_tab_content .= $nl . ' google.load(\'visualization\', \'1\', {packages: [\'' . $chart_type . '\']});';
            $second_tab_content .= $nl . ' google.setOnLoadCallback(drawVisualization);';
            $second_tab_content .= $nl . ' function frmStatistics_Submit() { document.frmStatistics.submit(); }';
            $second_tab_content .= '</script>';
            $second_tab_content .= get_chart_changer('1_2', $chart_type, $year, 'mod_payments_statistics');
            $second_tab_content .= '<div id="div_visualization" style="width:600px;height:310px;">
		<img src="images/ajax_loading.gif" style="margin:100px auto;" alt="' . _LOADING . '..."></div>';
        } else {
            $sql = 'SELECT
					COUNT(*) as cnt,
					c.abbrv as country_abbrv,
					c.name as country_name