Ignore:
Timestamp:
Oct 28, 2012, 10:20:32 AM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Zobrazování odkazů v aktualitách.
  • Upraveno: Tabulka Product rozdělena na Product a StockItem. Upravena struktura.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/zarizeni.php

    r438 r452  
    1111  {
    1212    // Seznam segmentů a zařízení
     13    $Price = 0;
    1314    $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>';
    1415    $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');   
    15     while($Segment = $DbResult->fetch_array())
     16    while($Segment = $DbResult->fetch_assoc())
    1617    {
    1718      $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())
    2023      {
    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>';
    2227      }
     28      $Price = $Price + $Row['Price'];
    2329    }
    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>';
    2732    $Output .= '</table>';
    2833    return($Output);
Note: See TracChangeset for help on using the changeset viewer.