Changeset 452 for trunk/finance/zarizeni.php
- Timestamp:
- Oct 28, 2012, 10:20:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/zarizeni.php
r438 r452 11 11 { 12 12 // Seznam segmentů a zařízení 13 $Price = 0; 13 14 $Output = 'Seznam segmentů a zařízení:<br><table style="font-size: smaller;" class="WideTable"><tr><th>Název</th><th>Spotřeba<br>[W]</th><th>Datum<br>zakoupení</th><th>Cena [Kč]</th></tr>'; 14 15 $DbResult = $this->Database->query('SELECT * FROM NetworkSegment'); 15 while($Segment = $DbResult->fetch_a rray())16 while($Segment = $DbResult->fetch_assoc()) 16 17 { 17 18 $Output .= '<tr><td style="text-align: left" colspan="3"><strong>Segment: '.$Segment['Name'].' ('.$Segment['Users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Segment['Price'].'</td></tr>'; 18 $DbResult2 = $this->Database->query('SELECT * FROM Product WHERE Segment='.$Segment['Id'].' AND used=1'); 19 while($Row = $DbResult2->fetch_array()) 19 $DbResult2 = $this->Database->query('SELECT Product.Consumption AS Consumption, Product.Name AS Name, '. 20 'StockItem.BuyPrice AS Price, StockItem.TimeEnlistment AS Date '. 21 'FROM StockItem JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)'); 22 while($Row = $DbResult2->fetch_assoc()) 20 23 { 21 $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'.$Row['Name'].'</td><td align="right">'.$Row['Consumption'].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td align="right">'.$Row['Price'].'</td></tr>'; 24 $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'. 25 $Row['Name'].'</td><td align="right">'.$Row['Consumption'].'</td><td align="right">'. 26 HumanDate($Row['Date']).'</td><td align="right">'.$Row['Price'].'</td></tr>'; 22 27 } 28 $Price = $Price + $Row['Price']; 23 29 } 24 $DbResult = $this->Database->query('SELECT SUM(Price) FROM Product WHERE Used=1'); 25 $Row = $DbResult->fetch_array(); 26 $Output .= '<tr><td colspan="3"><strong>Celkem:</strong></td><td align="right"><strong>'.$Row[0].'</strong></td></tr>'; 30 $Output .= '<tr><td colspan="3"><strong>Celkem:</strong></td><td align="right"><strong>'. 31 $Price.'</strong></td></tr>'; 27 32 $Output .= '</table>'; 28 33 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.