<?php
include_once('../global.php');

class FinanceStoragePage extends Page
{
  var $FullTitle = 'Skladové zásoby';
  var $ShortTitle = 'Sklad';

  function Show()
  {
    $TotalPrice = 0;
    $Output = 'Výpis skladových zásob:<br><table class="WideTable">';
    $Output .= '<tr><th>Název</th><th>Datum<br />zakoupení</th><th>Cena [Kč]</th><th>Počet</th><th>Cena<br /> dohromady [Kč]</th></tr>';
    $DbResult = $this->Database->query("SELECT * FROM network_devices WHERE used=2");
    while($Row = $DbResult->fetch_array())
    {
      $Output .= '<tr><td>'.$Row['name'].'</td><td align="right">'.HumanDate($Row['date']).'</td><td align="right">'.$Row['price'].'</td><td align="right">'.$Row['count'].'</td><td align="right">'.$Row['count'] * $Row['price'].'</td></tr>';
      $TotalPrice = $TotalPrice + $Row['count'] * $Row['price'];
    }

    $Output .= '<tr><td colspan="4"><strong>Celkem:</strong></td><td align="right"><strong>'.$TotalPrice.'</strong></td></tr>';
    $Output .= '</table>';
    return($Output);
  }
}

$System->AddModule(new FinanceStoragePage());
$System->Modules['FinanceStoragePage']->GetOutput();

?>
