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/spotreba.php

    r438 r452  
    1616    $CelkovaSpotreba = 0;
    1717    $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');
    18     while($Segment = $DbResult->fetch_array())
     18    while($Segment = $DbResult->fetch_assoc())
    1919    {
    20       $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE Segment='.$Segment['Id'].' AND Used=1');
    21       $Row2 = $DbResult2->fetch_array();
    22       $CelkovaSpotreba = $CelkovaSpotreba + $Row2[0];
    23       $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>';
     20      $DbResult2 = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockItem JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)');
     21      $Row2 = $DbResult2->fetch_assoc();
     22      $CelkovaSpotreba = $CelkovaSpotreba + $Row2['Consumption'];
     23      $Output .= '<tr><td>'.$Segment['Name'].'</td><td align="right">'.$Row2['Consumption'].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2['Consumption']).'</td></tr>';
    2424    }
    2525    $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>';
Note: See TracChangeset for help on using the changeset viewer.