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
RevLine 
[4]1<?php
[1]2
[521]3class PageFinanceConsumption extends Page
[152]4{
5 var $FullTitle = 'Spotřeba energie';
6 var $ShortTitle = 'Spotřeba';
[521]7 var $ParentClass = 'PageFinance';
[1]8
[152]9 function Show()
10 {
[167]11 $Finance = $this->System->Modules['Finance'];
[152]12
13 // Seznam segmentů a zařízení
[167]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>';
[152]15 $CelkovaSpotreba = 0;
[415]16 $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');
[452]17 while($Segment = $DbResult->fetch_assoc())
[152]18 {
[710]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)');
[452]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>';
[152]25 }
[157]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>';
[167]27 $Output .= '</table></div>';
28 $Output .= 'Dohodnutá cena za jednu kWh: <strong>'.$Finance->kWh.' Kč</strong><br />';
[152]29 return($Output);
30 }
[1]31}
Note: See TracBrowser for help on using the repository browser.