Last change
on this file was 36, checked in by george, 16 years ago |
- Upraveno: Funkce pro přidávání hodnot a vytváření ceche úrovní byla vnitřně zobecněna.
- Přidáno: Skript pro přestavbu grafu z tabulky finančních transakcí.
- Upraveno: Trochu zkorigována nápověda do praktičtější podoby.
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | include('../global.php');
|
---|
4 |
|
---|
5 | $MeasureId = 21;
|
---|
6 | //print_r(GetMeasureById($MeasureId));
|
---|
7 | $Database->query('TRUNCATE TABLE data_finance');
|
---|
8 | $Database->select_db('wow');
|
---|
9 | $DbRows = array();
|
---|
10 | $DbResult = $Database->query('SELECT (SELECT IFNULL(SUM( money ), 0) FROM finance AS fin WHERE fin.time <= f.time ) AS money, time FROM finance AS f ORDER BY f.time ASC');
|
---|
11 | echo($Database->error);
|
---|
12 | while($DbRows[] = $DbResult->fetch_assoc());
|
---|
13 |
|
---|
14 | $DbRows[count($DbRows) - 1] = $DbRows[count($DbRows) - 2];
|
---|
15 |
|
---|
16 | //print_r($DbRows);
|
---|
17 | $Measure = GetMeasureById($MeasureId);
|
---|
18 |
|
---|
19 | $LastTime = 0;
|
---|
20 | $Database->select_db('statistic');
|
---|
21 | foreach($DbRows as $Index => $DbRow)
|
---|
22 | {
|
---|
23 | if($Index < (count($DbRows) - 1))
|
---|
24 | {
|
---|
25 | $TimeEnd = MysqlDateTimeToTime($DbRows[$Index + 1]['time']);
|
---|
26 | $TimeStart = MysqlDateTimeToTime($DbRows[$Index]['time']);
|
---|
27 | $TimeDiff = ($TimeEnd - $TimeStart) / $Measure['Period'];
|
---|
28 | echo('Period:'.$Measure['Period'].' Diff:'.$TimeDiff.' '.($TimeEnd - $TimeStart)."\n");
|
---|
29 | for($I = 0; $I < $TimeDiff; $I++)
|
---|
30 | {
|
---|
31 | echo('*');
|
---|
32 | $Value = $DbRows[$Index]['money'];
|
---|
33 | //echo(TimeToMysqlDateTime($TimeStart + $Measure['Period'] * $I)." ".$DbRows[$Index]['money']." \n");
|
---|
34 | AddValue($Measure, array('min' => $Value, 'avg' => $Value, 'max' => $Value), 0, $TimeStart + $Measure['Period'] * $I);
|
---|
35 | }
|
---|
36 | echo('#');
|
---|
37 | }
|
---|
38 | }
|
---|
39 | echo("\n");
|
---|
40 |
|
---|
41 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.