source: trunk/Modules/Finance/Consumption.php@ 710

Last change on this file since 710 was 710, checked in by chronos, 10 years ago
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1<?php
2
3class PageFinanceConsumption extends Page
4{
5 var $FullTitle = 'Spotřeba energie';
6 var $ShortTitle = 'Spotřeba';
7 var $ParentClass = 'PageFinance';
8
9 function Show()
10 {
11 $Finance = $this->System->Modules['Finance'];
12
13 // Seznam segmentů a zařízení
14 $Output = 'Spotřeba zařízení jednotlivých segmentů:<div align="center"><table class="WideTable"><tr><th>Jméno segmentu</th><th>Spotřeba [W]</th><th>Cena [Kč/měsíc]</th></tr>';
15 $CelkovaSpotreba = 0;
16 $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');
17 while($Segment = $DbResult->fetch_assoc())
18 {
19 $DbResult2 = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockSerialNumber '.
20 'JOIN Product ON Product.Id = StockSerialNumber.Product WHERE (StockSerialNumber.Segment='.$Segment['Id'].') '.
21 'AND (StockSerialNumber.TimeElimination IS NULL)');
22 $Row2 = $DbResult2->fetch_assoc();
23 $CelkovaSpotreba = $CelkovaSpotreba + $Row2['Consumption'];
24 $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2['Consumption'].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2['Consumption']).'</td></tr>';
25 }
26 $Output .= '<tr style="font-weight: Bold;"><td><strong>Celkem</strong></td><td align="right">'.$CelkovaSpotreba.'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($CelkovaSpotreba).'</td></tr>';
27 $Output .= '</table></div>';
28 $Output .= 'Dohodnutá cena za jednu kWh: <strong>'.$Finance->kWh.' Kč</strong><br />';
29 return($Output);
30 }
31}
Note: See TracBrowser for help on using the repository browser.