source: www/finance/zarizeni.php@ 157

Last change on this file since 157 was 157, checked in by george, 16 years ago
  • Upraveno: Soubor include.php ve financích přepracován na třídy ve finance.php.
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1<?php
2include_once('../global.php');
3
4class FinanceDeviceListPage extends Page
5{
6 var $FullTitle = 'Zařízení sítě';
7 var $ShortTitle = 'Zařízení';
8
9 function Show()
10 {
11 // Seznam segmentů a zařízení
12 $Output = 'Seznam segmentů a zařízení:<br><table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Název</th><th>Spotřeba<br>[W]</th><th>Datum<br>zakoupení</th><th>Cena [Kč]</th></tr>';
13 $DbResult = $this->Database->query("SELECT * FROM network_segments");
14 while($Row = $DbResult->fetch_array())
15 {
16 $Output .= '<tr><td colspan="3"><strong>Segment: '.$Row['name'].' ('.$Row['users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Row['price'].'</td></tr>';
17 $DbResult2 = $this->Database->query("SELECT * FROM network_devices WHERE segment=".$Row['id']." AND used=1");
18 while($Row = $DbResult2->fetch_array())
19 {
20 $Output .= '<tr><td>'.$Row['name'].'</td><td align="right">'.$Row['consumption'].'</td><td align="right">'.HumanDate($Row['date']).'</td><td align="right">'.$Row['price'].'</td></tr>';
21 }
22 }
23 $DbResult = $this->Database->query("SELECT SUM(price) FROM network_devices WHERE used=1");
24 $Row = $DbResult->fetch_array();
25 $Output .= '<tr><td colspan="3"><strong>Celkem:</strong></td><td align="right"><strong>'.$Row[0].'</strong></td></tr>';
26 $Output .= '</table>';
27 return($Output);
28 }
29}
30
31$System->AddModule(new FinanceDeviceListPage());
32$System->Modules['FinanceDeviceListPage']->GetOutput()
33
34?>
Note: See TracBrowser for help on using the repository browser.