Changeset 452 for trunk/finance


Ignore:
Timestamp:
Oct 28, 2012, 10:20:32 AM (13 years ago)
Author:
chronos
Message:
  • Opraveno: Zobrazování odkazů v aktualitách.
  • Upraveno: Tabulka Product rozdělena na Product a StockItem. Upravena struktura.
Location:
trunk/finance
Files:
3 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>';
  • trunk/finance/tarify.php

    r438 r452  
    6262
    6363    $Output .= '<br />Tarif na další období si lze nastavit po přihlášení do systému pomocí nastavení domácnosti přes pravé užifatelské menu.<br />';
    64     $Output .= '<a href="http://centrala.zdechov.net/forum/viewtopic.php?t=50">Diskuse</a><br />';
     64    $Output .= '<a href="http://forum.zdechov.net/viewtopic.php?t=50">Diskuse</a><br />';
    6565    return($Output);
    6666  }
  • 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.