Changeset 479 for trunk


Ignore:
Timestamp:
Feb 5, 2013, 9:45:44 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Tabulka pro přiřazení více služeb jednomu zákazníkovi. Původní data jsou převedena do nové struktury. Tabulka Service je společná pro všechny typy služeb a pro každou službu se zobrazí nebo vyplní pouze určité použitelné sloupce.
  • Opraveno: Korekce názvů modulů na názvy začínající slovem Module.
Location:
trunk
Files:
1 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Global.php

    r477 r479  
    11<?php
     2
     3$Revision =
    24
    35$ConfigFileName = dirname(__FILE__).'/../config.php';
     
    294296 
    295297  // Register new modules
    296   $System->ModuleManager->RegisterModule(new Meteostation($System));
    297   $System->ModuleManager->RegisterModule(new Portal($System));
    298   $System->ModuleManager->RegisterModule(new IS($System));
    299   $System->ModuleManager->RegisterModule(new Network($System));
    300   $System->ModuleManager->RegisterModule(new TV($System));
     298  $System->ModuleManager->RegisterModule(new ModuleMeteostation($System));
     299  $System->ModuleManager->RegisterModule(new ModulePortal($System));
     300  $System->ModuleManager->RegisterModule(new ModuleIS($System));
     301  $System->ModuleManager->RegisterModule(new ModuleNetwork($System));
     302  $System->ModuleManager->RegisterModule(new ModuleTV($System));
    301303  $System->ModuleManager->RegisterModule(new ModuleOpeningHours($System));
    302304  $System->ModuleManager->RegisterModule(new ModuleMap($System));
  • trunk/Common/Page.php

    r473 r479  
    185185      $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
    186186      $Output .= $this->ShowFooter();
    187       if($this->FormatHTML == true) echo($this->FormatOutput($Output));
     187      if($this->FormatHTML == true) $Output = $this->FormatOutput($Output);
    188188    }
    189189    echo($Output);
  • trunk/Modules/IS/IS.php

    r470 r479  
    239239}
    240240
    241 class IS extends AppModule
     241class ModuleIS extends AppModule
    242242{
    243243  function __construct($System)
  • trunk/Modules/Meteostation/Meteostation.php

    r470 r479  
    1111  function Show()
    1212  {
    13     return('Stav meteostanice');
     13    $Output = 'Stav meteostanice:<br/>';
     14    $Output .= '<img src="'.$this->System->Link('/Modules/Meteostation/cache/1.png').'" alt="stav meteostanice"/>';
     15    return($Output);
    1416  }
    1517}
    1618
    17 class MeteoStation extends AppModule
     19class MeteoStation extends Module
    1820{
    19   var $Data;
     21  var $Id;
     22  var $Name;
     23  var $Period;
     24  var $URL;
    2025 
    21   function __construct($System)
     26  function DownloadData()
    2227  {
    23     parent::__construct($System);
    24     $this->Name = 'MeteoStation';
    25     $this->Version = '1.0';
    26     $this->Creator = 'Chronos';
    27     $this->License = 'GNU/GPLv3';
    28     $this->Description = 'Gathering and presentation of data from network meteostation.';
    29     $this->Dependencies = array();
    30   }
    31  
    32   function DownloadData($Id, $URL)
    33   {
    34     $XmlData = simplexml_load_file($URL);
     28    $XmlData = simplexml_load_file($this->URL);
    3529
    36     $Data = array('MeteoStation' => $Id,
     30    $Data = array('MeteoStation' => $this->Id,
    3731      'WindSpeed' => trim($XmlData->windspeed),
    3832      'WindDir' => trim($XmlData->winddir),
     
    5852  }
    5953 
    60   function DownloadAll()
    61   {
    62     $DbResult = $this->Database->select('MeteoStation', '*');
    63     while($DbRow = $DbResult->fetch_assoc())
    64     {
    65       $this->DownloadData($DbRow['Id'], $DbRow['URL']);
    66       $this->CreateImage('cache/'.$DbRow['Id'].'.png');
    67     }
    68   }
    69  
    7054  function CreateImage($FileName)
    7155  {
     
    7660    //$Image->Font->Color = COLOR_RED;
    7761    //$Image->Line(10, 10, 100, 100);
    78     $Image->TextOut(10, 10, 'Meteo Koliba Zděchov');
     62    $Image->TextOut(10, 10, 'Meteo '.$this->Name);
    7963    $Image->TextOut(10, 30, 'Teplote: '.$this->Data['Temperature'].' °C');
    8064    $Image->SaveToFile($FileName);
    8165  }
     66 
     67  function LoadFromDb()
     68  {
     69    $DbResult = $this->Database->select('Meteostation', '*', 'Id = '.$this->Id);
     70    $DbRow = $DbResult->fetch_assoc();
     71    $this->Name = $DbRow['Name'];
     72    $this->URL = $DbRow['URL'];
     73    $this->Period = $DbRow['Period'];
     74  }
     75}
     76
     77class ModuleMeteoStation extends AppModule
     78{
     79  var $Data;
     80 
     81  function __construct($System)
     82  {
     83    parent::__construct($System);
     84    $this->Name = 'MeteoStation';
     85    $this->Version = '1.0';
     86    $this->Creator = 'Chronos';
     87    $this->License = 'GNU/GPLv3';
     88    $this->Description = 'Gathering and presentation of data from network meteostation.';
     89    $this->Dependencies = array();
     90  }
     91 
     92 
     93  function DownloadAll()
     94  {
     95    $DbResult = $this->Database->select('MeteoStation', '*');
     96    while($DbRow = $DbResult->fetch_assoc())
     97    {
     98      $MeteoStation = new MeteoStation();
     99      $MeteoStation->Id = $DbRow['Id'];
     100      $MeteoStation->LoadFromDb();     
     101      $MeteoStation->DownloadData();
     102      $MeteoStation->CreateImage('cache/'.$DbRow['Id'].'.png');
     103    }
     104  }
     105 
    82106 
    83107  function Install()
  • trunk/Modules/Network/Network.php

    r471 r479  
    8080}
    8181
    82 class Network extends AppModule
     82class ModuleNetwork extends AppModule
    8383{
    8484  function __construct($System)
  • trunk/Modules/Portal/Portal.php

    r476 r479  
    4141    $Output = '<img alt="" src="images/favicons/comp.png" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' &nbsp;  &nbsp; ';
    4242
    43     $DbResult = $this->Database->select('Member', 'COUNT(*)', 'MemberState=0');
     43    $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
    4444    $DbRow = $DbResult->fetch_array();
    4545    $TotalUser = $DbRow[0];
     
    246246        {
    247247          $CustomerUserRel = $DbResult->fetch_assoc();
    248           $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, '.
     248          $DbResult = $this->Database->query('SELECT Member.Id, '.
    249249            'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
    250250            'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
     
    268268          $UserOptions->Values['BillingPeriodNext'] = 2;
    269269         
    270         $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], array('InternetTariffNextMonth' => $UserOptions->Values['InternetTariffNextMonth'], 'FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'], 'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));
     270        $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'],
     271           array('FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'],
     272           'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));
    271273        $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']);
    272274        $Member = $DbResult->fetch_assoc();
     
    278280        $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
    279281        $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']);
    280         $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     282        $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
    281283        $DbRow = $DbResult->fetch_array();
    282284        foreach($UserOptions->Definition['Items'] as $Index => $Item)
     
    324326}
    325327
    326 class Portal extends AppModule
     328class ModulePortal extends AppModule
    327329{
    328330  function __construct($System)
  • trunk/Modules/TV/TV.php

    r473 r479  
    104104}
    105105
    106 class TV extends AppModule
     106class ModuleTV extends AppModule
    107107{
    108108  function __construct($System)
  • trunk/finance/clenove.php

    r438 r479  
    1414
    1515    $Output = 'Seznam účastníků:<br/>';
    16     $Query = 'SELECT MonthlyTotal, Cash, Subject.Id, Subject.WWW, Subject.Note, Subject.Name, NetworkDevice, InternetTariffCurrentMonth, InternetTariffNextMonth, User.Name AS FullName FROM MemberPayment LEFT JOIN Member ON Member.Id=MemberPayment.Member LEFT JOIN Subject ON Subject.Id=Member.Subject JOIN User ON User.Id=Member.ResponsibleUser';
     16    $Query = 'SELECT MonthlyTotal, Cash, Subject.Id, Subject.WWW, Subject.Note, '.
     17      'Subject.Name, NetworkDevice, '.
     18      '(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
     19      'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND ServiceCustomerRel.Period=0) AS ServicesCurrentMonth, '.
     20      '(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
     21      'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND ServiceCustomerRel.Period=1) AS ServicesNextMonth, '.
     22      'User.Name AS FullName FROM MemberPayment LEFT JOIN Member ON '.
     23      'Member.Id=MemberPayment.Member LEFT JOIN Subject ON Subject.Id=Member.Subject '.
     24      'JOIN User ON User.Id=Member.ResponsibleUser';
    1725    $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T');
    1826    $DbRow = $DbResult->fetch_row();
     
    2735      array('Name' => 'MonthlyTotal', 'Title' => 'Měsíční poplatek [Kč]'),
    2836      array('Name' => 'Cash', 'Title' => 'Stav účtu [Kč]'),
    29       array('Name' => 'InternetTariffCurrentMonth', 'Title' => 'Běžící tarif'),
    30       array('Name' => 'InternetTariffNextMonth', 'Title' => 'Příští tarif'),
     37      array('Name' => 'ServicesCurrentMonth', 'Title' => 'Běžící tarif'),
     38      array('Name' => 'ServicesNextMonth', 'Title' => 'Příští tarif'),
    3139      array('Name' => 'Note', 'Title' => 'Poznámky'),
    3240      array('Name' => 'WWW', 'Title' => 'WWW'),
     
    4654      $TotalCash += $Row['Cash'];
    4755      if($Row['Cash'] < 0) $Row['Cash'] = '<span style="color: red;">'.$Row['Cash'].'</span>';
    48       $Tarif = $Finance->Tariffs[$Row['InternetTariffCurrentMonth']]['Name'];
    49       $PristiTarif = $Finance->Tariffs[$Row['InternetTariffNextMonth']]['Name'];
     56      $Tarif = $Row['ServicesCurrentMonth'];
     57      $PristiTarif = $Row['ServicesNextMonth'];
    5058      $Output .= '<tr><td>'.$Row['FullName'].'</td><td><a href="user_state.php?Subject='.$Row['Id'].'">'.$Row['Name'].'</a></td>';
    5159      //<td align="right">'.$Row['network_device'].'</td>
  • trunk/finance/finance.php

    r458 r479  
    22
    33define('TARIFF_FREE', 7);
     4define('INVOICE_DUE_DAYS', 15);
     5define('INVOICE_OUT_DOC_LINE', 6);
    46
    57class Finance extends Module
     
    3032  {
    3133    $this->Tariffs = array();
    32     $DbResult = $this->Database->select('FinanceTariff', '*', 'ReplaceId IS NULL ORDER BY SpeedMax');
     34    $DbResult = $this->Database->select('Service', '*', 'ReplaceId IS NULL ORDER BY InternetSpeedMax');
    3335    while($Tariff = $DbResult->fetch_array())
    3436    {
    35       $Tariff['SpeedMin'] = $Tariff['SpeedMin'] * 1024;
    36       $Tariff['SpeedMax'] = $Tariff['SpeedMax'] * 1024;
     37      $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 1024;
     38      $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 1024;
    3739      $this->Tariffs[$Tariff['Id']] = $Tariff;
    3840    } 
     
    5052    foreach($this->Tariffs as $Index => $Tariff)
    5153    {
    52       $DbResult = $this->Database->select('Member', 'COUNT(*)', '(InternetTariffCurrentMonth='.$Index.') AND (BillingPeriod > 1) AND (Blocked=0)');
     54      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Member '.
     55        'LEFT JOIN ServiceCustomerRel ON ServiceCustomerRel.Customer=Member.Id '.
     56        '(ServiceCustomerRel.Service='.$Index.') AND (Member.BillingPeriod > 1) AND (Member.Blocked=0)');
    5357      $Row = $DbResult->fetch_row();
    54       $this->Tariffs[$Index]['MemberCount'] = $Row[0];
    55       $Tariffs['MemberCount'] = $Row[0];
     58      $this->Tariffs[$Index]['CustomerCount'] = $Row[0];
     59      $Tariffs['CustomerCount'] = $Row[0];
    5660     
    5761      //echo($Tariff['Name'].' '.$Tariff['MemberCount'].' '.$Tariff['SpeedMax'] * $Tariff['MemberCount'].' '.$ResidualSpeed.'<br />');
    58       switch($Tariff['Group'])
     62      switch($Tariff['Category'])
    5963      {
    6064        case 1:
    61           $TotalMemberCount += $Tariff['MemberCount'];
    62           $TotalMaxSpeed += $Tariff['SpeedMax'] * $Tariff['MemberCount'];
     65          $TotalMemberCount += $Tariff['CustomerCount'];
     66          $TotalMaxSpeed += $Tariff['InternetSpeedMax'] * $Tariff['CustomerCount'];
    6367          break;
    6468        case 2:
    65           $ResidualSpeed -= $Tariff['SpeedMin'] * $Tariff['MemberCount'];
     69          $ResidualSpeed -= $Tariff['InternetSpeedMin'] * $Tariff['CustomerCount'];
    6670          break;
    6771        case 3:
     
    7579    foreach($this->Tariffs as $Index => $Tariff)
    7680    {
    77       switch($Tariff['Group'])
     81      switch($Tariff['Category'])
    7882      {
    7983        case 1:
    8084          // Přepočítávání rychlostí koliduje s rozdílovým zapisováním stromu front do mikrotiku. Vždy při změně počtu počítačů či domácností docházelo ke změně minima a přepočtu všeho.
    81           //$Tariff['SpeedMin'] = round($Tariff['SpeedMax'] * $Aggregation);
     85          //$Tariff['InternetSpeedMin'] = round($Tariff['InternetSpeedMax'] * $Aggregation);
    8286          break;
    8387        case 2:
     
    8690          break;
    8791      }
    88       //echo('MinSpeed: '.$Tariff['SpeedMin'].'<br />');
    89       $this->Database->update('FinanceTariff', 'Id='.$Tariff['Id'], array('SpeedMin' => ($Tariff['SpeedMin'] / 1024), 'MemberCount' => $Tariff['MemberCount']));
     92      //echo('MinSpeed: '.$Tariff['InternetSpeedMin'].'<br />');
     93      $this->Database->update('Service', 'Id='.$Tariff['Id'],
     94        array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1024),
     95        'CustomerCount' => $Tariff['CustomerCount']));
    9096    }
    9197    $this->LoadTariffs();
  • trunk/finance/manage.php

    r477 r479  
    355355        if($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'])
    356356        {
    357           $this->Database->update('Member', 'Id='.$Member['Id'], array('BillingPeriod' => $Member['BillingPeriodNext'], 'InternetTariffCurrentMonth' => $Member['InternetTariffNextMonth']));
     357          $this->Database->update('Member', 'Id='.$Member['Id'],
     358            array('BillingPeriod' => $Member['BillingPeriodNext']));
    358359          $Member['BillingPeriod'] = $Member['BillingPeriodNext'];
    359           $Member['InternetTariffCurrentMonth'] = $Member['InternetTariffNextMonth'];
    360360        }
    361361        $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
    362         $PayPerPeriod = $Member['MonthlyTotal'] * $Period['MonthCount'];
    363362        if(($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']) and ($Member['InternetTariffCurrentMonth'] != TARIFF_FREE) and ($PayPerPeriod > 0) and
    364363        ($Member['Blocked'] == 0))
    365364        {
    366           //echo($Mesic.'%'.$MonthCount.'='.($Mesic % $MonthCount).' ');                 
     365          $BillItems = array();
     366          $MonthlyTotal = 0;
     367          $DbResult2 = $this->Database->query('(SELECT Service.* FROM ServiceCustomerRel LEFT JOIN Service '.
     368            'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer='.$Member['Id'].') AND (ServiceCustomerRel.Period=0)');
     369          while($Service = $DbResult2->fetch_assoc())
     370          {
     371            $BillItems[] = array('Description' => $Service['Name'], 'Price' => $Service['Price'],
     372            'Quantity' => $Period['MonthCount']);
     373            $MonthlyTotal += $ServicePrice['Price'];
     374            $this->Database->update('ServiceCustomerRel', 'Id='); 
     375          }
     376          if($Member['Hire'] != 0)
     377          {
     378            $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';
     379            $MonthlyTotal -= $Member['Hire'];
     380          }
     381          if($Member['MonthlyPlus'] != 0)
     382          {
     383            $MonthlyTotal -= $Member['MonthlyPlus'];
     384          }
     385          $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];
     386   
     387//echo($Mesic.'%'.$MonthCount.'='.($Mesic % $MonthCount).' ');                 
    367388          $TimePeriodText = date('j.n.Y', $Period['From']).' - '.date('j.n.Y', $Period['To']);
    368           $Output .= $TimePeriodText.': '.$Member['MonthlyTotal'].' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />';
    369           $BillCode = $Finance->GetNextDocumentLineNumber(6); // Faktury vydané
     389          $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />';
     390          $BillCode = $Finance->GetNextDocumentLineNumber(INVOICE_OUT_DOC_LINE);
    370391          $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'],
    371             array(array('Description' => 'Připojení k Internetu', 'Price' => $PayPerPeriod,
    372             'Quantity' => 1)), time(), time() + 3600 * 24 * 15, $BillCode, $Period['From'], $Period['To']);
     392            $BillItems, time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, $BillCode, $Period['From'], $Period['To']);
    373393          $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod,
    374394            'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()',
    375             'TimeDue' => 'DATE_ADD(NOW(), INTERVAL 15 DAY)',
    376             'Text' => 'Připojení k Internetu za období '.$TimePeriodText,
     395            'TimeDue' => 'DATE_ADD(NOW(), INTERVAL '.INVOICE_DUE_DAYS.' DAY)',
     396            'Text' => 'Vyúčtování služeb za období '.$TimePeriodText,
    377397            'Bill' => $BillId, 'BillCode' => $BillCode));
    378398          $Output .= $this->SendPaymentEmail($Member['Id']);
     
    392412      $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()', 'Money' => $Finance->Internet, 'kWh' => $Finance->kWh, 'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem, 'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid, 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'], 'MemberCount' => $Finance->InternetUsers));
    393413
    394       // Update tarrifs
     414      // Update services
    395415      $Output .= 'Měním aktuální tarify....<br>';
    396       $DbResult = $this->Database->select('FinanceTariff', '*', '`ReplaceId` IS NOT NULL');
    397       while($Tariff = $DbResult->fetch_array())
     416      $DbResult = $this->Database->select('Service', '*', '`ReplaceId` IS NOT NULL');
     417      while($Service = $DbResult->fetch_array())
    398418      {
    399         $this->Database->update('FinanceTariff', 'Id='.$Tariff['ReplaceId'], array('Name' => $Tariff['Name'],
    400           'UploadAsymmetry' => $Tariff['UploadAsymmetry'], 'MemberCount' => $Tariff['MemberCount'],
    401           'Group' => $Tariff['Group'], 'SpeedMin' => $Tariff['SpeedMin'],
    402           'SpeedMax' => $Tariff['SpeedMax'], 'Price' => $Tariff['Price']));
     419        $Service['Id'] = $Service['ReplaceId'];
     420        $Service['ReplaceId'] = '';
     421        $this->Database->update('Service', 'Id='.$Service['ReplaceId'], $Service);
    403422      }
    404       $this->Database->delete('FinanceTariff', '`ReplaceId` IS NOT NULL');
     423      $this->Database->delete('Service', '`ReplaceId` IS NOT NULL');
    405424
    406425      $Finance->RecalculateMemberPayment();
     
    429448    $DbResult = $this->Database->select('User', '*', 'Id='.$Member['ResponsibleUser']);   
    430449    $User = $DbResult->fetch_assoc();
     450   
     451    $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']);
     452    $MainSubject = $DbResult->fetch_assoc(); 
     453   
     454    $DbResult = $this->Database->select('FinanceBankAccount', '*', '(`Subject`='.
     455      $Config['Finance']['MainSubjectId'].') AND (`Use`=1)');
     456    $MainSubjectAccount = $DbResult->fetch_assoc();
    431457       
    432458    if($User['Email'] != '')
    433459    {
    434460      $Title = 'Pravidelné vyúčtování služeb';
    435       $Content = 'Vyúčtovaní subjektu <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.$User['Name'].'</strong> ke dni <strong>'.$this->System->HumanDate(time()).'</strong>.<br /><br />'."\n".
    436         'Váš aktuální tarif: <strong>'.$this->System->Modules['Finance']->Tariffs[$Member['InternetTariffCurrentMonth']]['Name'].' '.$this->System->AddPrefixMultipliers($this->System->Modules['Finance']->Tariffs[$Member['InternetTariffCurrentMonth']]['SpeedMax'], 'bit/s', 3, 'Binary').'</strong><br />'."\n".
     461      $Content = 'Vyúčtovaní zákazníka <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.$User['Name'].'</strong> ke dni <strong>'.$this->System->HumanDate(time()).'</strong>.<br /><br />'."\n".
     462        'Váše aktuální služby: ';
     463      $DbResult = $this->Database->query('SELECT GROUP_CONCAT(Service.Name) AS Name FROM ServiceCustomerRel LEFT JOIN Service '.
     464      'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer='.$Member['Id'].' AND ServiceCustomerRel.Period=0');
     465        $Service = $DbRow->fetch_assoc();
     466      $Content .= '<strong>'.$Service['Name'].'</strong><br />'."\n".
    437467        'Vaše platební období: <strong>'.$this->System->Modules['Finance']->BillingPeriods[$Member['BillingPeriod']]['Name'].'</strong><br />'."\n".
    438468        'Pravidelná platba za období: <strong>'.$MemberPayment['MonthlyTotal'].' Kč</strong><br />'."\n".
    439         'Bankovní účet: <strong>2600134781 / 2010</strong> (EUR Slovensko 2600134781 / 8330, Fio banka)<br/>'."\n".
     469        'Bankovní účet: <strong>'.$MainSubjectAccount['Number'].'<br/>'."\n".
    440470        'Variabilní symbol: <strong>'.$Member['Subject'].'</strong><br/>'."\n".
    441471        'Stav vašeho účtu: <strong>'.($MemberPayment['Cash'] - $MemberPayment['MonthlyTotal']).' Kč</strong><br /><br />'."\n";
  • trunk/finance/tarify.php

    r452 r479  
    2424    foreach($Finance->Tariffs as $Index => $Tariff)
    2525    {
    26       $Tariff['Aggregation'] = '1:'.round($Tariff['SpeedMax'] / $Tariff['SpeedMin']);
    27       $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['SpeedMin'] / 1024).'</td><td align="center" style="color: blue;">'.round($Tariff['SpeedMax'] / 1024).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['MemberCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['MemberCount'] * $Tariff['Price'].'</td></tr>';
    28       $TotalPrice = $TotalPrice + $Tariff['Price'] * $Tariff['MemberCount'];
    29       $TotalMemberCount = $TotalMemberCount + $Tariff['MemberCount'];
     26      $Tariff['Aggregation'] = '1:'.round($Tariff['InternetSpeedMax'] / $Tariff['InternetSpeedMin']);
     27      $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['InternetSpeedMin'] / 1024).'</td><td align="center" style="color: blue;">'.round($Tariff['InternetSpeedMax'] / 1024).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['CustomerCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['CustomerCount'] * $Tariff['Price'].'</td></tr>';
     28      $TotalPrice = $TotalPrice + $Tariff['Price'] * $Tariff['CustomerCount'];
     29      $TotalMemberCount = $TotalMemberCount + $Tariff['CustomerCount'];
    3030    }
    3131    $Output .= '<tr><td>Součty</td><td colspan="3">&nbsp;</td><td align="center">'.$TotalMemberCount.'</td><td>&nbsp;</td><td align="center">'.$TotalPrice.'</td></tr>';
  • trunk/finance/user_state.php

    r456 r479  
    3535      'FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Subject='.$Subject['Id']);
    3636    $Member = $DbResult->fetch_assoc();
    37     $TarifName = $Finance->Tariffs[$Member['InternetTariffCurrentMonth']]['Name'];
    38     $TarifPrice = $Finance->Tariffs[$Member['InternetTariffCurrentMonth']]['Price'];
    3937    $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';
    4038
     
    8987      $SumValue = $SumValue + $Row['Value'];
    9088    }
    91       $Output .= '<tr><td style="text-align: right;" colspan="2"><strong>Celkem za rok</strong></td><td style="text-align: right;"><strong>'.$SumValue.'</strong></td><td style="text-align: center;">&nbsp;</td></tr>';
     89    $Output .= '<tr><td style="text-align: right;" colspan="2"><strong>Celkem za rok</strong></td><td style="text-align: right;"><strong>'.$SumValue.'</strong></td><td style="text-align: center;">&nbsp;</td></tr>';
    9290   
    9391   
     
    10098    $Total = 0;
    10199    $Output .= 'Rozpis měsíčního poplatku:<br><table class="WideTable">'.
    102       '<tr><th>Část</th><th>Cena [Kč]</th></tr>'.
    103       '<tr><td>Internet - tarif '.$TarifName.'</td><td>'.$TarifPrice.'</td></tr>';
    104     $Total += $TarifPrice;
     100      '<tr><th>Služba</th><th>Cena [Kč]</th></tr>';
     101    $DbResult = $this->Database->query('SELECT Service.Name, Service.Price FROM ServiceCustomerRel LEFT JOIN Service '.
     102      'ON Service.Id=ServiceCustomerRel.Service WHERE (ServiceCustomerRel.Customer='.$Member['Id'].') AND (ServiceCustomerRel.Period=0)');
     103    while($DbRow = $DbResult->fetch_assoc())
     104    {
     105          $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
     106      $Total += $DbRow['Price'];
     107    }
     108   
    105109    if($Member['Hire'] != 0)
    106110    {
  • trunk/finance/zivnost.php

    r454 r479  
    291291        break;
    292292      case 'SubjectAccount':
     293        $Output .= '<table style="width: 100%"><tr><td style="vertical-align: top;">';
    293294        $Output .= '<strong>Výpis příjmů/výdajů</strong>';
    294295        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    295         $Output .= '<tr><th>Datum</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
    296         $DbResult = $this->Database->select('FinanceCashFlow', '*', 'Subject='.$_GET['Id']);
    297         while($Row = $DbResult->fetch_array())
    298         {
    299           $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['Bill'].'</td></tr>';
    300         }
    301         $Output .= '</table><br />';
     296        $Output .= '<tr><th>Datum</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
     297        $DbResult = $this->Database->select('FinanceOperation', '*', 'Subject='.$_GET['Id'].' ORDER BY Time');
     298        while($Row = $DbResult->fetch_array())
     299        {
     300          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].
     301            '</td><td>'.$Row['Value'].'</td><td>'.$Row['BillCode'].'</td></tr>';
     302        }
     303        $Output .= '</table></td><td style="vertical-align: top;">';
    302304
    303305        $Output .= '<strong>Výpis závazků/pohledávek</strong>';
    304306        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    305         $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
    306         $DbResult = $this->Database->select('FinanceClaimsLiabilities', '*', 'Subject='.$_GET['Id']);
    307         while($Row = $DbResult->fetch_array())
    308         {
    309           $Output .= '<tr><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimePayment'].'</td><td>'.$Row['Text'].'</td><td>'.(-$Row['Value']).'</td><td>'.$Row['Bill'].'</td></tr>';
    310         }
    311         $Output .= '</table><br />';
    312 
    313         $Output .= '<strong>Výpis záloh</strong>';
     307        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
     308        $DbResult = $this->Database->select('FinanceClaimsLiabilities', '*', 'Subject='.$_GET['Id'].' ORDER BY TimeCreation');
     309        while($Row = $DbResult->fetch_array())
     310        {
     311          $Output .= '<tr><td>'.HumanDate($Row['TimeCreation']).'</td><td>'.HumanDate($Row['TimePayment']).
     312            '</td><td>'.$Row['Text'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['BillCode'].'</td></tr>';
     313        }
     314        $Output .= '</table></td></tr></table>';
     315
     316        /*$Output .= '<strong>Výpis záloh</strong>';
    314317        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    315318        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
     
    319322          $Output .= '<tr><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';
    320323        }
    321         $Output .= '</table>';
    322 
    323         $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject WHERE Id='.$_GET['Id']);
     324        $Output .= '</table>';*/
     325
     326        $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) '.
     327          'FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND '.
     328          'FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) '.
     329          'FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND '.
     330          'FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, '.
     331          '(SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities '.
     332          'WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) AS '.
     333          'Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities '.
     334          'WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 '.
     335          'AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceOperation.Value) '.
     336          'FROM FinanceOperation WHERE FinanceOperation.Subject = Subject.Id AND FinanceOperation.Value > 0) '.
     337          'AS Gains, (SELECT SUM(FinanceOperation.Value) FROM FinanceOperation WHERE '.
     338          'FinanceOperation.Subject = Subject.Id AND FinanceOperation.Value < 0) as Spends '.
     339          'FROM Subject WHERE Id='.$_GET['Id']);
    324340        $Row = $DbResult->fetch_array();
    325         $Output .= 'Stav placení: '.($Row['AdvancesIn'] - $Row['AdvancesOut'] - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
     341        $Output .= 'Stav placení: '.(-$Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
    326342        break;
    327343      case 'PrintMonthOperations':
  • trunk/form_classes.php

    r478 r479  
    257257    ),
    258258  ),
    259   'FinanceTariff' => array(
    260     'Title' => 'Tarify',
    261     'Table' => 'FinanceTariff',
    262     'DefaultSortColumn' => 'Name',
    263     'Items' => array(
    264       'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
    265       'Group' => array('Type' => 'TFinanceTariffGroup', 'Caption' => 'Skupina', 'Default' => '', 'Null' => true),
    266       'SpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost', 'Default' => '0', 'Suffix' => 'kbit/s'),
    267       'SpeedMax' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'kbit/s'),
     259  'Service' => array(
     260    'Title' => 'Služby',
     261    'Table' => 'Service',
     262    'DefaultSortColumn' => 'Name',
     263    'Items' => array(
     264      'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     265      'Category' => array('Type' => 'TServiceCategory', 'Caption' => 'Skupina', 'Default' => '', 'Null' => true),
     266      'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč'),
     267      'CustomerCount' => array('Type' => 'Integer', 'Caption' => 'Počet zákazníků', 'Default' => ''),
     268      'ReplaceId' => array('Type' => 'TService', 'Caption' => 'Nahradit', 'Default' => '', 'Null' => true),
     269      'Public' => array('Type' => 'Boolean', 'Caption' => 'Veřejné', 'Default' => ''),
     270      'InternetSpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
     271      'InternetSpeedMax' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'),
    268272      'UploadAsymmetry' => array('Type' => 'Integer', 'Caption' => 'Asymetrie odesílání', 'Default' => '1'),
    269       'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč'),
    270       'MemberCount' => array('Type' => 'Integer', 'Caption' => 'Počet členů', 'Default' => ''),
    271       'ReplaceId' => array('Type' => 'TFinanceTariff', 'Caption' => 'Nahradí tarif', 'Default' => '', 'Null' => true),
    272       'Public' => array('Type' => 'Boolean', 'Caption' => 'Veřejné', 'Default' => ''),
     273      'Memory' => array('Type' => 'Integer', 'Caption' => 'Paměť', 'Default' => '0', 'Suffix' => 'GB'),
     274      'MemorySwap' => array('Type' => 'Integer', 'Caption' => 'Odkládací oddíl', 'Default' => '0', 'Suffix' => 'GB'),
     275      'Storage' => array('Type' => 'Integer', 'Caption' => 'Úložiště', 'Default' => '0', 'Suffix' => 'GB'),
     276      'CPUCount' => array('Type' => 'Integer', 'Caption' => 'Počet jader', 'Default' => '0', 'Suffix' => ''),
    273277    ),
    274278  ),
     
    283287      'FamilyMemberCount' => array('Type' => 'String', 'Caption' => 'Osob v domácnosti', 'Default' => '0', 'Suffix' => 'osob'),
    284288      'MembershipDate' => array('Type' => 'Date', 'Caption' => 'Datum členství', 'Default' => ''),
    285       'MemberState' => array('Type' => 'Integer', 'Caption' => 'Stav', 'Default' => '0'),
    286       'InternetTariffCurrentMonth' => array('Type' => 'TFinanceTariff', 'Caption' => 'Tarif aktuální', 'Default' => ''),
    287       'InternetTariffNextMonth' => array('Type' => 'TFinanceTariff', 'Caption' => 'Tarif příští', 'Default' => ''),
    288289      'BillingPeriod' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Fakturační období aktuální', 'Default' => ''),
    289290      'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Fakturační období příští', 'Default' => ''),
     
    554555  'MemberOptions' => array(
    555556    'Title' => 'Nastavení domácnosti',
    556     'Table' => '(SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject)',
     557    'Table' => '(SELECT Member.Id, Member.FamilyMemberCount, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject)',
    557558    'Items' => array(
    558559      'Name' => array('Type' => 'String', 'Caption' => 'Fakturační jméno', 'Default' => ''),
     
    565566      'FamilyMemberCount' => array('Type' => 'Integer', 'Caption' => 'Počet osob v domácnosti', 'Default' => '', 'Suffix' => 'osob'),
    566567      'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Požadované fakturované období', 'Default' => ''),
    567       'InternetTariffNextMonth' => array('Type' => 'TFinanceTariff', 'Caption' => 'Tarif internetu od dalšího období', 'Default' => 2),
    568568    ),
    569569  ),
     
    640640
    641641$FormTypes = array(
    642   'TFinanceTariffGroup' => array(
    643     'Type' => 'Enumeration',
    644     'States' => array('Neurčeno', 'Běžné', 'Hosting', 'Zdarma'),
     642  'TServiceCategory' => array(
     643    'Type' => 'Reference',
     644    'Table' => 'ServiceCategory',
     645    'Id' => 'Id',
     646    'Name' => 'Name',
     647    'Filter' => '1',
    645648  ),
    646649  'TPriority' => array(
     
    656659    'States' => array('Zakoupeno', 'Prodáno', 'Zařazeno do použití', 'Vyřazeno z použití', 'Zasláno do reklamace', 'Přijato z reklamace'),
    657660  ),
    658   'TFinanceTariff' => array(
    659     'Type' => 'Reference',
    660     'Table' => 'FinanceTariff',
     661  'TService' => array(
     662    'Type' => 'Reference',
     663    'Table' => 'Service',
    661664    'Id' => 'Id',
    662665    'Name' => 'Name',
  • trunk/sql/full.sql

    r441 r479  
    44--
    55-- Počítač: localhost
    6 -- Vygenerováno: Sob 13. říj 2012, 18:52
     6-- Vygenerováno: Pon 07. led 2013, 23:00
    77-- Verze MySQL: 5.1.60
    88-- Verze PHP: 5.3.8
     
    1515--
    1616
     17DELIMITER $$
     18--
     19-- Funkce
     20--
     21CREATE DEFINER=`centrala`@`localhost` FUNCTION `CompareNetworkPrefix`(Address1 INT(11) UNSIGNED, Address2 INT(11) UNSIGNED, Size INT(11)) RETURNS tinyint(1)
     22RETURN Address1 & (-1 << (32 - Size)) = Address2 & (-1 << (32 - Size))$$
     23
     24DELIMITER ;
     25
     26-- --------------------------------------------------------
     27
     28--
     29-- Struktura tabulky `ChatHistory`
     30--
     31
     32CREATE TABLE IF NOT EXISTS `ChatHistory` (
     33  `Id` int(11) NOT NULL AUTO_INCREMENT,
     34  `Nick` varchar(64) COLLATE utf8_czech_ci NOT NULL,
     35  `Text` text COLLATE utf8_czech_ci NOT NULL,
     36  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     37  `Color` int(11) NOT NULL DEFAULT '0',
     38  `RoomName` varchar(32) COLLATE utf8_czech_ci NOT NULL,
     39  `RoomType` int(11) NOT NULL DEFAULT '0',
     40  `Host` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     41  PRIMARY KEY (`Id`)
     42) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=528576 ;
     43
     44-- --------------------------------------------------------
     45
     46--
     47-- Struktura tabulky `Country`
     48--
     49
     50CREATE TABLE IF NOT EXISTS `Country` (
     51  `Id` int(11) NOT NULL AUTO_INCREMENT,
     52  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     53  PRIMARY KEY (`Id`)
     54) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     55
     56-- --------------------------------------------------------
     57
     58--
     59-- Struktura tabulky `DocumentLine`
     60--
     61
     62CREATE TABLE IF NOT EXISTS `DocumentLine` (
     63  `Id` int(11) NOT NULL AUTO_INCREMENT,
     64  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     65  `Shortcut` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     66  PRIMARY KEY (`Id`),
     67  UNIQUE KEY `Shortcut` (`Shortcut`)
     68) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=9 ;
     69
     70-- --------------------------------------------------------
     71
     72--
     73-- Struktura tabulky `DocumentLineSequence`
     74--
     75
     76CREATE TABLE IF NOT EXISTS `DocumentLineSequence` (
     77  `Id` int(11) NOT NULL AUTO_INCREMENT,
     78  `DocumentLine` int(11) NOT NULL,
     79  `FinanceYear` int(11) NOT NULL,
     80  `NextNumber` int(11) NOT NULL,
     81  `YearPrefix` int(11) NOT NULL,
     82  PRIMARY KEY (`Id`),
     83  KEY `DocumentLine` (`DocumentLine`),
     84  KEY `FinanceYear` (`FinanceYear`)
     85) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=35 ;
     86
     87--
     88-- RELACE PRO TABULKU `DocumentLineSequence`:
     89--   `DocumentLine`
     90--       `DocumentLine` -> `Id`
     91--   `FinanceYear`
     92--       `FinanceYear` -> `Id`
     93--
     94
     95-- --------------------------------------------------------
     96
     97--
     98-- Struktura tabulky `EmailQueue`
     99--
     100
     101CREATE TABLE IF NOT EXISTS `EmailQueue` (
     102  `Id` int(11) NOT NULL AUTO_INCREMENT,
     103  `Time` datetime NOT NULL,
     104  `To` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     105  `Subject` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     106  `Content` text COLLATE utf8_czech_ci NOT NULL,
     107  `Headers` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     108  `Archive` int(11) NOT NULL DEFAULT '0',
     109  `From` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     110  `AttachmentFile` int(11) DEFAULT NULL,
     111  PRIMARY KEY (`Id`),
     112  KEY `Archive` (`Archive`)
     113) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3052 ;
     114
     115-- --------------------------------------------------------
     116
     117--
     118-- Struktura tabulky `File`
     119--
     120
     121CREATE TABLE IF NOT EXISTS `File` (
     122  `Id` int(11) NOT NULL AUTO_INCREMENT,
     123  `Name` varchar(256) COLLATE utf8_czech_ci NOT NULL,
     124  `Size` int(11) NOT NULL,
     125  PRIMARY KEY (`Id`)
     126) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     127
     128-- --------------------------------------------------------
     129
     130--
     131-- Struktura tabulky `FinanceAssetsHistory`
     132--
     133
     134CREATE TABLE IF NOT EXISTS `FinanceAssetsHistory` (
     135  `AssetsId` int(11) NOT NULL DEFAULT '0',
     136  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     137  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     138  `User` int(11) NOT NULL DEFAULT '0',
     139  KEY `AssetsId` (`AssetsId`)
     140) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     141
     142-- --------------------------------------------------------
     143
     144--
     145-- Struktura tabulky `FinanceBankAccount`
     146--
     147
     148CREATE TABLE IF NOT EXISTS `FinanceBankAccount` (
     149  `Id` int(11) NOT NULL AUTO_INCREMENT,
     150  `TimeCreate` date NOT NULL,
     151  `Number` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     152  `Comment` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     153  PRIMARY KEY (`Id`)
     154) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     155
     156-- --------------------------------------------------------
     157
     158--
     159-- Struktura tabulky `FinanceBillingPeriod`
     160--
     161
     162CREATE TABLE IF NOT EXISTS `FinanceBillingPeriod` (
     163  `Id` int(11) NOT NULL AUTO_INCREMENT,
     164  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     165  `MonthCount` int(11) NOT NULL,
     166  PRIMARY KEY (`Id`)
     167) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6 ;
     168
     169-- --------------------------------------------------------
     170
     171--
     172-- Struktura tabulky `FinanceBills`
     173--
     174
     175CREATE TABLE IF NOT EXISTS `FinanceBills` (
     176  `Id` int(11) NOT NULL AUTO_INCREMENT,
     177  `TimeFrom` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     178  `Subject` int(11) NOT NULL DEFAULT '0',
     179  `TimeTo` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     180  `TimeCreate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     181  `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     182  `BillCode` varchar(32) COLLATE utf8_czech_ci NOT NULL,
     183  `Type` enum('invoice','income') COLLATE utf8_czech_ci NOT NULL,
     184  `Cash` int(11) NOT NULL DEFAULT '0',
     185  PRIMARY KEY (`Id`),
     186  KEY `Subject` (`Subject`),
     187  KEY `Subject_2` (`Subject`)
     188) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6204 ;
     189
     190--
     191-- RELACE PRO TABULKU `FinanceBills`:
     192--   `Subject`
     193--       `Subject` -> `Id`
     194--
     195
     196-- --------------------------------------------------------
     197
     198--
     199-- Struktura tabulky `FinanceBillsItems`
     200--
     201
     202CREATE TABLE IF NOT EXISTS `FinanceBillsItems` (
     203  `Id` int(11) NOT NULL AUTO_INCREMENT,
     204  `Bill` int(11) NOT NULL DEFAULT '0',
     205  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     206  `Price` float NOT NULL DEFAULT '0',
     207  `Quantity` float NOT NULL DEFAULT '1',
     208  PRIMARY KEY (`Id`),
     209  KEY `Bill` (`Bill`)
     210) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17745 ;
     211
     212--
     213-- RELACE PRO TABULKU `FinanceBillsItems`:
     214--   `Bill`
     215--       `FinanceBills` -> `Id`
     216--
     217
     218-- --------------------------------------------------------
     219
     220--
     221-- Struktura tabulky `FinanceCharge`
     222--
     223
     224CREATE TABLE IF NOT EXISTS `FinanceCharge` (
     225  `Period` int(11) NOT NULL DEFAULT '0',
     226  `Internet` int(11) NOT NULL DEFAULT '0',
     227  `InternetSpeed` int(11) NOT NULL DEFAULT '0',
     228  `InternetSpeedReserve` int(11) NOT NULL DEFAULT '0',
     229  `AdministrationPerUser` int(20) NOT NULL DEFAULT '0',
     230  `kWh` int(11) NOT NULL DEFAULT '0',
     231  `BaseSpeedElement` int(11) NOT NULL DEFAULT '0',
     232  `BaseTariffPrice` int(11) NOT NULL DEFAULT '0',
     233  `TopTariffPrice` int(11) NOT NULL DEFAULT '0'
     234) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     235
     236-- --------------------------------------------------------
     237
     238--
     239-- Struktura tabulky `FinanceClaimsLiabilities`
     240--
     241
     242CREATE TABLE IF NOT EXISTS `FinanceClaimsLiabilities` (
     243  `Id` int(11) NOT NULL AUTO_INCREMENT,
     244  `BillCode` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     245  `Subject` int(11) NOT NULL DEFAULT '0',
     246  `TimeCreation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     247  `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     248  `TimePayment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     249  `Value` float NOT NULL DEFAULT '0',
     250  `Bill` int(11) DEFAULT '0',
     251  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     252  PRIMARY KEY (`Id`),
     253  KEY `Subject` (`Subject`),
     254  KEY `Bill` (`Bill`)
     255) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8670 ;
     256
     257--
     258-- RELACE PRO TABULKU `FinanceClaimsLiabilities`:
     259--   `Subject`
     260--       `Subject` -> `Id`
     261--
     262
     263-- --------------------------------------------------------
     264
     265--
     266-- Struktura tabulky `FinanceGroup`
     267--
     268
     269CREATE TABLE IF NOT EXISTS `FinanceGroup` (
     270  `Id` int(11) NOT NULL AUTO_INCREMENT,
     271  `Description` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     272  PRIMARY KEY (`Id`)
     273) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     274
     275-- --------------------------------------------------------
     276
     277--
     278-- Struktura tabulky `FinanceLog`
     279--
     280
     281CREATE TABLE IF NOT EXISTS `FinanceLog` (
     282  `Id` int(11) NOT NULL AUTO_INCREMENT,
     283  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     284  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     285  PRIMARY KEY (`Id`)
     286) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     287
     288-- --------------------------------------------------------
     289
     290--
     291-- Struktura tabulky `FinanceMonthlyOverall`
     292--
     293
     294CREATE TABLE IF NOT EXISTS `FinanceMonthlyOverall` (
     295  `Id` int(11) NOT NULL AUTO_INCREMENT,
     296  `Money` int(11) NOT NULL DEFAULT '0',
     297  `Date` date NOT NULL DEFAULT '0000-00-00',
     298  `Administration` int(11) NOT NULL DEFAULT '0',
     299  `kWh` int(11) NOT NULL DEFAULT '0',
     300  `AdministrationTotal` int(11) NOT NULL DEFAULT '0',
     301  `ConsumptionTotal` int(11) NOT NULL DEFAULT '0',
     302  `TotalPaid` int(11) NOT NULL DEFAULT '0',
     303  `BaseTariffPrice` int(11) NOT NULL DEFAULT '0',
     304  `TopTariffPrice` int(11) NOT NULL DEFAULT '0',
     305  `MemberCount` int(11) NOT NULL DEFAULT '0',
     306  `Investment` int(11) NOT NULL,
     307  PRIMARY KEY (`Id`)
     308) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=121 ;
     309
     310-- --------------------------------------------------------
     311
     312--
     313-- Struktura tabulky `FinanceOperation`
     314--
     315
     316CREATE TABLE IF NOT EXISTS `FinanceOperation` (
     317  `Id` int(11) NOT NULL AUTO_INCREMENT,
     318  `Time` datetime NOT NULL,
     319  `Subject` int(11) NOT NULL DEFAULT '0',
     320  `Cash` int(11) NOT NULL DEFAULT '0',
     321  `Value` float NOT NULL,
     322  `BillCode` varchar(32) COLLATE utf8_czech_ci DEFAULT NULL,
     323  `Taxable` tinyint(1) NOT NULL DEFAULT '1',
     324  `Bill` int(11) DEFAULT NULL,
     325  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT 'Vklad',
     326  `Network` int(11) NOT NULL DEFAULT '1',
     327  `BankAccount` int(11) DEFAULT NULL COMMENT 'FinanceBankAccount',
     328  `Treasury` int(11) DEFAULT NULL COMMENT 'FinanceTreasury',
     329  PRIMARY KEY (`Id`),
     330  UNIQUE KEY `BillCode` (`BillCode`),
     331  UNIQUE KEY `BillCode_2` (`BillCode`),
     332  KEY `Subject` (`Subject`),
     333  KEY `Bill` (`Bill`),
     334  KEY `BankAccount` (`BankAccount`),
     335  KEY `Treasury` (`Treasury`)
     336) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6487 ;
     337
     338--
     339-- RELACE PRO TABULKU `FinanceOperation`:
     340--   `Subject`
     341--       `Subject` -> `Id`
     342--   `Bill`
     343--       `FinanceBills` -> `Id`
     344--   `BankAccount`
     345--       `FinanceBankAccount` -> `Id`
     346--   `Treasury`
     347--       `FinanceTreasury` -> `Id`
     348--
     349
     350-- --------------------------------------------------------
     351
     352--
     353-- Struktura tabulky `FinanceSmallAssets`
     354--
     355
     356CREATE TABLE IF NOT EXISTS `FinanceSmallAssets` (
     357  `Id` int(11) NOT NULL AUTO_INCREMENT,
     358  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     359  `PricePurchase` float NOT NULL DEFAULT '0',
     360  `TimeEnlistment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     361  `TimeElimination` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     362  `SupplySubject` int(11) NOT NULL DEFAULT '0',
     363  `DeviceId` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     364  PRIMARY KEY (`Id`)
     365) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     366
     367-- --------------------------------------------------------
     368
     369--
     370-- Struktura tabulky `FinanceTariff`
     371--
     372
     373CREATE TABLE IF NOT EXISTS `FinanceTariff` (
     374  `Id` int(11) NOT NULL AUTO_INCREMENT,
     375  `Name` varchar(32) COLLATE utf8_czech_ci NOT NULL,
     376  `Group` int(11) NOT NULL DEFAULT '0',
     377  `SpeedMin` int(11) NOT NULL DEFAULT '0',
     378  `SpeedMax` int(11) NOT NULL DEFAULT '0',
     379  `UploadAsymmetry` int(11) NOT NULL DEFAULT '1',
     380  `Price` int(11) NOT NULL DEFAULT '0',
     381  `MemberCount` int(11) NOT NULL DEFAULT '0',
     382  `ReplaceId` int(11) DEFAULT NULL,
     383  `Public` int(11) NOT NULL DEFAULT '1',
     384  PRIMARY KEY (`Id`),
     385  KEY `ReplaceId` (`ReplaceId`),
     386  KEY `Public` (`Public`)
     387) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=16 ;
     388
     389-- --------------------------------------------------------
     390
     391--
     392-- Struktura tabulky `FinanceTreasury`
     393--
     394
     395CREATE TABLE IF NOT EXISTS `FinanceTreasury` (
     396  `Id` int(11) NOT NULL AUTO_INCREMENT,
     397  `TimeCreate` date NOT NULL,
     398  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     399  PRIMARY KEY (`Id`)
     400) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;
     401
     402-- --------------------------------------------------------
     403
     404--
     405-- Struktura tabulky `FinanceYear`
     406--
     407
     408CREATE TABLE IF NOT EXISTS `FinanceYear` (
     409  `Id` int(11) NOT NULL AUTO_INCREMENT,
     410  `Year` int(11) NOT NULL,
     411  `DateStart` date NOT NULL,
     412  `DateEnd` date NOT NULL,
     413  PRIMARY KEY (`Id`)
     414) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=9 ;
     415
     416-- --------------------------------------------------------
     417
     418--
     419-- Struktura tabulky `HostedProject`
     420--
     421
     422CREATE TABLE IF NOT EXISTS `HostedProject` (
     423  `Id` int(11) NOT NULL AUTO_INCREMENT,
     424  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     425  `Homepage` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     426  `User` int(255) NOT NULL COMMENT 'User.Id',
     427  `TimeCreate` datetime NOT NULL,
     428  `Server` int(11) DEFAULT NULL COMMENT 'NetworkDevice.Id',
     429  `Active` int(11) NOT NULL DEFAULT '1',
     430  `WebHosting` int(11) NOT NULL,
     431  PRIMARY KEY (`Id`)
     432) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=16 ;
     433
     434-- --------------------------------------------------------
     435
     436--
     437-- Struktura tabulky `Hyperlink`
     438--
     439
     440CREATE TABLE IF NOT EXISTS `Hyperlink` (
     441  `Id` int(11) NOT NULL AUTO_INCREMENT,
     442  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     443  `URL` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     444  `Group` int(11) NOT NULL,
     445  `IconFile` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     446  `PermissionModule` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     447  `PermissionOperation` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     448  `Enable` int(11) NOT NULL DEFAULT '1',
     449  PRIMARY KEY (`Id`),
     450  KEY `Group` (`Group`),
     451  KEY `Enable` (`Enable`)
     452) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=68 ;
     453
     454--
     455-- RELACE PRO TABULKU `Hyperlink`:
     456--   `Group`
     457--       `HyperlinkGroup` -> `Id`
     458--
     459
     460-- --------------------------------------------------------
     461
     462--
     463-- Struktura tabulky `HyperlinkGroup`
     464--
     465
     466CREATE TABLE IF NOT EXISTS `HyperlinkGroup` (
     467  `Id` int(11) NOT NULL AUTO_INCREMENT,
     468  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     469  PRIMARY KEY (`Id`)
     470) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=10 ;
     471
     472-- --------------------------------------------------------
     473
     474--
     475-- Struktura tabulky `ISMenuItem`
     476--
     477
     478CREATE TABLE IF NOT EXISTS `ISMenuItem` (
     479  `Id` int(11) NOT NULL AUTO_INCREMENT,
     480  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     481  `Parent` int(11) DEFAULT NULL,
     482  `Table` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     483  `IconName` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     484  PRIMARY KEY (`Id`),
     485  KEY `Parent` (`Parent`)
     486) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=38 ;
     487
     488--
     489-- RELACE PRO TABULKU `ISMenuItem`:
     490--   `Parent`
     491--       `ISMenuItem` -> `Id`
     492--
     493
     494-- --------------------------------------------------------
     495
     496--
     497-- Struktura tabulky `Language`
     498--
     499
     500CREATE TABLE IF NOT EXISTS `Language` (
     501  `Id` int(11) NOT NULL AUTO_INCREMENT,
     502  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     503  PRIMARY KEY (`Id`)
     504) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=7 ;
     505
    17506-- --------------------------------------------------------
    18507
     
    22511
    23512CREATE TABLE IF NOT EXISTS `Log` (
     513  `Id` int(11) NOT NULL AUTO_INCREMENT,
    24514  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    25515  `User` int(11) NOT NULL DEFAULT '0',
     
    27517  `Operation` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    28518  `Value` text COLLATE utf8_czech_ci NOT NULL,
     519  PRIMARY KEY (`Id`),
    29520  KEY `Time` (`Time`),
    30521  KEY `User` (`User`)
    31 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     522) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=37799 ;
    32523
    33524--
     
    37528--
    38529
     530-- --------------------------------------------------------
     531
     532--
     533-- Struktura tabulky `Meals`
     534--
     535
     536CREATE TABLE IF NOT EXISTS `Meals` (
     537  `Date` date NOT NULL DEFAULT '0000-00-00',
     538  `Soup` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     539  `Meal` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     540  `Status` int(11) NOT NULL DEFAULT '0',
     541  UNIQUE KEY `date` (`Date`)
     542) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci ROW_FORMAT=DYNAMIC;
     543
     544-- --------------------------------------------------------
     545
     546--
     547-- Struktura tabulky `MealsInfo`
     548--
     549
     550CREATE TABLE IF NOT EXISTS `MealsInfo` (
     551  `Info` text COLLATE utf8_czech_ci NOT NULL,
     552  `Price` int(11) NOT NULL DEFAULT '0'
     553) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci ROW_FORMAT=DYNAMIC;
     554
     555-- --------------------------------------------------------
     556
     557--
     558-- Struktura tabulky `Member`
     559--
     560
     561CREATE TABLE IF NOT EXISTS `Member` (
     562  `Id` int(11) NOT NULL AUTO_INCREMENT,
     563  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     564  `Subject` int(11) NOT NULL,
     565  `ResponsibleUser` int(11) NOT NULL,
     566  `FamilyMemberCount` int(11) NOT NULL,
     567  `MembershipDate` date NOT NULL,
     568  `MemberState` int(11) NOT NULL,
     569  `InternetTariffCurrentMonth` int(11) NOT NULL,
     570  `InternetTariffNextMonth` int(11) NOT NULL,
     571  `GPS` int(11) NOT NULL,
     572  `BillingPeriod` int(11) NOT NULL DEFAULT '2',
     573  `NetworkSegment` int(11) DEFAULT NULL,
     574  `BillingPeriodNext` int(11) NOT NULL DEFAULT '2',
     575  `BillingPeriodLastDate` date NOT NULL,
     576  `Hire` float NOT NULL DEFAULT '0',
     577  `Blocked` int(11) NOT NULL DEFAULT '0',
     578  `PayDay` int(11) NOT NULL DEFAULT '1',
     579  PRIMARY KEY (`Id`),
     580  KEY `Subject` (`Subject`),
     581  KEY `ResponsibleUser` (`ResponsibleUser`),
     582  KEY `InternetTariffCurrentMonth` (`InternetTariffCurrentMonth`),
     583  KEY `InternetTariffNextMonth` (`InternetTariffNextMonth`),
     584  KEY `BillingPeriod` (`BillingPeriod`),
     585  KEY `BillingPeriodNext` (`BillingPeriodNext`),
     586  KEY `NetworkSegment` (`NetworkSegment`)
     587) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=199 ;
     588
     589--
     590-- RELACE PRO TABULKU `Member`:
     591--   `Subject`
     592--       `Subject` -> `Id`
     593--   `ResponsibleUser`
     594--       `User` -> `Id`
     595--   `InternetTariffCurrentMonth`
     596--       `FinanceTariff` -> `Id`
     597--   `InternetTariffNextMonth`
     598--       `FinanceTariff` -> `Id`
     599--   `BillingPeriod`
     600--       `FinanceBillingPeriod` -> `Id`
     601--   `BillingPeriodNext`
     602--       `FinanceBillingPeriod` -> `Id`
     603--
     604
     605-- --------------------------------------------------------
     606
     607--
     608-- Struktura tabulky `MemberPayment`
     609--
     610
     611CREATE TABLE IF NOT EXISTS `MemberPayment` (
     612  `Id` int(11) NOT NULL AUTO_INCREMENT,
     613  `Member` int(11) NOT NULL,
     614  `MonthlyTotal` float NOT NULL,
     615  `MonthlyInternet` float NOT NULL,
     616  `MonthlyConsumption` float NOT NULL,
     617  `NetworkDevice` float NOT NULL,
     618  `MonthlyPlus` float NOT NULL,
     619  `Cash` float NOT NULL,
     620  PRIMARY KEY (`Id`),
     621  KEY `Member` (`Member`)
     622) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=181 ;
     623
     624--
     625-- RELACE PRO TABULKU `MemberPayment`:
     626--   `Member`
     627--       `Member` -> `Id`
     628--
     629
     630-- --------------------------------------------------------
     631
     632--
     633-- Struktura tabulky `NetworkAP`
     634--
     635
     636CREATE TABLE IF NOT EXISTS `NetworkAP` (
     637  `Id` int(11) NOT NULL AUTO_INCREMENT,
     638  `SSID` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     639  `Frequency` int(11) NOT NULL,
     640  `ChannelWidth` int(11) NOT NULL DEFAULT '20',
     641  `NetworkDevice` int(11) DEFAULT NULL,
     642  PRIMARY KEY (`Id`),
     643  KEY `NetworkDevice` (`NetworkDevice`)
     644) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=45 ;
     645
     646--
     647-- RELACE PRO TABULKU `NetworkAP`:
     648--   `NetworkDevice`
     649--       `NetworkDevice` -> `Id`
     650--
     651
     652-- --------------------------------------------------------
     653
     654--
     655-- Struktura tabulky `NetworkConfiguration`
     656--
     657
     658CREATE TABLE IF NOT EXISTS `NetworkConfiguration` (
     659  `Id` int(11) NOT NULL AUTO_INCREMENT,
     660  `Caption` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     661  `Execute` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     662  `Changed` int(11) NOT NULL DEFAULT '0',
     663  `LastTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     664  `ExecutionTime` int(11) NOT NULL,
     665  `Enabled` int(11) NOT NULL DEFAULT '1',
     666  `Period` int(11) NOT NULL DEFAULT '60',
     667  `Log` mediumtext COLLATE utf8_czech_ci NOT NULL,
     668  PRIMARY KEY (`Id`)
     669) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=14 ;
     670
     671-- --------------------------------------------------------
     672
     673--
     674-- Struktura tabulky `NetworkDevice`
     675--
     676
     677CREATE TABLE IF NOT EXISTS `NetworkDevice` (
     678  `Id` int(11) NOT NULL AUTO_INCREMENT,
     679  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     680  `Member` int(11) NOT NULL COMMENT 'Member',
     681  `Location` int(11) NOT NULL COMMENT 'Member',
     682  `Type` int(11) NOT NULL COMMENT 'NetworkDeviceType',
     683  `PositionLatitude` double NOT NULL DEFAULT '0',
     684  `PositionLongitude` double NOT NULL DEFAULT '0',
     685  `Used` int(11) NOT NULL DEFAULT '1',
     686  `Online` int(11) NOT NULL DEFAULT '0',
     687  `LastOnline` datetime NOT NULL,
     688  `PermanentOnline` int(11) NOT NULL DEFAULT '0',
     689  `InboundNATPriority` int(11) NOT NULL DEFAULT '1',
     690  PRIMARY KEY (`Id`),
     691  UNIQUE KEY `Name` (`Name`),
     692  KEY `Member` (`Member`),
     693  KEY `Location` (`Location`),
     694  KEY `Type` (`Type`)
     695) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=639 ;
     696
     697--
     698-- RELACE PRO TABULKU `NetworkDevice`:
     699--   `Member`
     700--       `Member` -> `Id`
     701--   `Location`
     702--       `Member` -> `Id`
     703--   `Type`
     704--       `NetworkDeviceType` -> `Id`
     705--
     706
     707-- --------------------------------------------------------
     708
     709--
     710-- Struktura tabulky `NetworkDeviceConfig`
     711--
     712
     713CREATE TABLE IF NOT EXISTS `NetworkDeviceConfig` (
     714  `Id` int(11) NOT NULL AUTO_INCREMENT,
     715  `Device` int(11) NOT NULL,
     716  `Time` date NOT NULL,
     717  `ConfigFull` mediumtext NOT NULL,
     718  `ConfigCompact` mediumtext NOT NULL,
     719  PRIMARY KEY (`Id`),
     720  KEY `Time` (`Time`),
     721  KEY `Device` (`Device`)
     722) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     723
     724--
     725-- RELACE PRO TABULKU `NetworkDeviceConfig`:
     726--   `Device`
     727--       `NetworkDevice` -> `Id`
     728--
     729
     730-- --------------------------------------------------------
     731
     732--
     733-- Struktura tabulky `NetworkDeviceHistory`
     734--
     735
     736CREATE TABLE IF NOT EXISTS `NetworkDeviceHistory` (
     737  `Id` int(11) NOT NULL AUTO_INCREMENT,
     738  `Device` int(11) NOT NULL DEFAULT '0',
     739  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     740  `Action` int(11) NOT NULL DEFAULT '0',
     741  `Notice` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     742  PRIMARY KEY (`Id`),
     743  KEY `Device` (`Device`)
     744) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     745
     746-- --------------------------------------------------------
     747
     748--
     749-- Struktura tabulky `NetworkDeviceType`
     750--
     751
     752CREATE TABLE IF NOT EXISTS `NetworkDeviceType` (
     753  `Id` int(11) NOT NULL AUTO_INCREMENT,
     754  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     755  `ShowOnline` int(11) NOT NULL DEFAULT '0',
     756  `IconName` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     757  PRIMARY KEY (`Id`)
     758) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=11 ;
     759
     760-- --------------------------------------------------------
     761
     762--
     763-- Struktura tabulky `NetworkDomainAlias`
     764--
     765
     766CREATE TABLE IF NOT EXISTS `NetworkDomainAlias` (
     767  `Id` int(11) NOT NULL AUTO_INCREMENT,
     768  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     769  `Target` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     770  `Comment` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     771  PRIMARY KEY (`Id`),
     772  UNIQUE KEY `Name` (`Name`,`Target`),
     773  UNIQUE KEY `Name_2` (`Name`,`Target`)
     774) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=40 ;
     775
     776-- --------------------------------------------------------
     777
     778--
     779-- Struktura tabulky `NetworkFirewall`
     780--
     781
     782CREATE TABLE IF NOT EXISTS `NetworkFirewall` (
     783  `Id` int(11) NOT NULL AUTO_INCREMENT,
     784  `NetworkDevice` int(11) NOT NULL,
     785  `SourceInterface` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     786  `DestinationInterface` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     787  `SourceAddress` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     788  `DestinationAddress` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     789  `SourcePort` int(11) DEFAULT NULL,
     790  `DestinationPort` int(11) DEFAULT NULL,
     791  `Action` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     792  `Comment` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     793  PRIMARY KEY (`Id`),
     794  KEY `NetworkDevice` (`NetworkDevice`)
     795) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8 ;
     796
     797--
     798-- RELACE PRO TABULKU `NetworkFirewall`:
     799--   `NetworkDevice`
     800--       `NetworkDevice` -> `Id`
     801--
     802
     803-- --------------------------------------------------------
     804
     805--
     806-- Struktura tabulky `NetworkInterface`
     807--
     808
     809CREATE TABLE IF NOT EXISTS `NetworkInterface` (
     810  `Id` int(11) NOT NULL AUTO_INCREMENT,
     811  `Name` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     812  `Type` int(11) NOT NULL,
     813  `MAC` varchar(17) COLLATE utf8_czech_ci NOT NULL,
     814  `LocalIP` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     815  `IPv6` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     816  `ExternalIP` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     817  `Device` int(11) NOT NULL,
     818  `Online` int(11) NOT NULL DEFAULT '0',
     819  `LastOnline` datetime NOT NULL,
     820  PRIMARY KEY (`Id`),
     821  KEY `Device` (`Device`),
     822  KEY `Type` (`Type`)
     823) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=705 ;
     824
     825--
     826-- RELACE PRO TABULKU `NetworkInterface`:
     827--   `Type`
     828--       `NetworkInterfaceType` -> `Id`
     829--   `Device`
     830--       `NetworkDevice` -> `Id`
     831--
     832
     833-- --------------------------------------------------------
     834
     835--
     836-- Struktura tabulky `NetworkInterfacePortable`
     837--
     838
     839CREATE TABLE IF NOT EXISTS `NetworkInterfacePortable` (
     840  `Id` int(11) NOT NULL AUTO_INCREMENT,
     841  `NetworkInterface` int(11) NOT NULL,
     842  `DynamicIP` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     843  `Time` datetime NOT NULL,
     844  `Update` int(11) NOT NULL,
     845  PRIMARY KEY (`Id`),
     846  KEY `NetworkInterface` (`NetworkInterface`),
     847  KEY `Update` (`Update`)
     848) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     849
     850-- --------------------------------------------------------
     851
     852--
     853-- Struktura tabulky `NetworkInterfaceStat`
     854--
     855
     856CREATE TABLE IF NOT EXISTS `NetworkInterfaceStat` (
     857  `NetworkInterface` int(11) NOT NULL DEFAULT '0',
     858  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     859  `PingCount` smallint(11) NOT NULL DEFAULT '0',
     860  KEY `host_id` (`NetworkInterface`),
     861  KEY `time` (`Time`)
     862) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     863
     864-- --------------------------------------------------------
     865
     866--
     867-- Struktura tabulky `NetworkInterfaceType`
     868--
     869
     870CREATE TABLE IF NOT EXISTS `NetworkInterfaceType` (
     871  `Id` int(11) NOT NULL AUTO_INCREMENT,
     872  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     873  `MaxSpeed` int(11) NOT NULL,
     874  `FullDuplex` int(11) NOT NULL DEFAULT '1',
     875  `Color` varchar(6) COLLATE utf8_czech_ci NOT NULL DEFAULT 'ffffff',
     876  PRIMARY KEY (`Id`)
     877) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8 ;
     878
     879-- --------------------------------------------------------
     880
     881--
     882-- Struktura tabulky `NetworkLink`
     883--
     884
     885CREATE TABLE IF NOT EXISTS `NetworkLink` (
     886  `Id` int(11) NOT NULL AUTO_INCREMENT,
     887  `Type` int(11) NOT NULL,
     888  `Interface1` int(11) NOT NULL,
     889  `Interface2` int(11) NOT NULL,
     890  PRIMARY KEY (`Id`),
     891  KEY `Interface1` (`Interface1`),
     892  KEY `Interface2` (`Interface2`)
     893) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=356 ;
     894
     895-- --------------------------------------------------------
     896
     897--
     898-- Struktura tabulky `NetworkMangleSubgroup`
     899--
     900
     901CREATE TABLE IF NOT EXISTS `NetworkMangleSubgroup` (
     902  `Id` int(11) NOT NULL AUTO_INCREMENT,
     903  `AddressRange` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     904  PRIMARY KEY (`Id`),
     905  KEY `AddressRange` (`AddressRange`)
     906) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=147 ;
     907
     908-- --------------------------------------------------------
     909
     910--
     911-- Struktura tabulky `NetworkMark`
     912--
     913
     914CREATE TABLE IF NOT EXISTS `NetworkMark` (
     915  `Id` int(11) NOT NULL AUTO_INCREMENT,
     916  `Comment` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     917  PRIMARY KEY (`Id`),
     918  KEY `Comment` (`Comment`)
     919) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1404 ;
     920
     921-- --------------------------------------------------------
     922
     923--
     924-- Struktura tabulky `NetworkSegment`
     925--
     926
     927CREATE TABLE IF NOT EXISTS `NetworkSegment` (
     928  `Id` int(11) NOT NULL AUTO_INCREMENT,
     929  `Name` varchar(128) COLLATE utf8_czech_ci NOT NULL,
     930  `Price` int(11) NOT NULL DEFAULT '0',
     931  `Parent` int(11) DEFAULT '0',
     932  `Users` int(11) NOT NULL DEFAULT '0',
     933  `Consumption` int(11) NOT NULL DEFAULT '0',
     934  `UsersOverheads` int(11) NOT NULL DEFAULT '0',
     935  PRIMARY KEY (`Id`),
     936  KEY `Parent` (`Parent`)
     937) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=33 ;
     938
     939--
     940-- RELACE PRO TABULKU `NetworkSegment`:
     941--   `Parent`
     942--       `NetworkSegment` -> `Id`
     943--
     944
     945-- --------------------------------------------------------
     946
     947--
     948-- Struktura tabulky `NetworkSubnet`
     949--
     950
     951CREATE TABLE IF NOT EXISTS `NetworkSubnet` (
     952  `Id` int(11) NOT NULL AUTO_INCREMENT,
     953  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     954  `AddressRange` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     955  `Mask` int(11) NOT NULL,
     956  `DHCP` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     957  `Gateway` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     958  `WINS` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     959  `DNS` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     960  `Domain` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     961  `NTP` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     962  `Member` int(11) DEFAULT NULL,
     963  `ExtAddressRange` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     964  `ExtMask` int(11) NOT NULL DEFAULT '32',
     965  `AddressRangeIPv6` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     966  `Configure` int(11) NOT NULL DEFAULT '1',
     967  PRIMARY KEY (`Id`),
     968  KEY `Member` (`Member`),
     969  KEY `Configure` (`Configure`)
     970) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=44 ;
     971
     972--
     973-- RELACE PRO TABULKU `NetworkSubnet`:
     974--   `Member`
     975--       `Member` -> `Id`
     976--
     977
     978-- --------------------------------------------------------
     979
     980--
     981-- Struktura tabulky `NetworkTopology`
     982--
     983
     984CREATE TABLE IF NOT EXISTS `NetworkTopology` (
     985  `Host` int(11) NOT NULL DEFAULT '0',
     986  `Depth` int(11) NOT NULL DEFAULT '0',
     987  `Pos` int(11) NOT NULL DEFAULT '0',
     988  `First` int(11) NOT NULL DEFAULT '0',
     989  `Last` int(11) NOT NULL DEFAULT '0',
     990  PRIMARY KEY (`Host`)
     991) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     992
     993-- --------------------------------------------------------
     994
     995--
     996-- Struktura tabulky `News`
     997--
     998
     999CREATE TABLE IF NOT EXISTS `News` (
     1000  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1001  `Title` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1002  `Content` text COLLATE utf8_czech_ci NOT NULL,
     1003  `Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1004  `TargetDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1005  `Author` varchar(32) COLLATE utf8_czech_ci NOT NULL,
     1006  `IP` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     1007  `Category` int(11) DEFAULT '0',
     1008  `Enclosure` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1009  `User` int(11) DEFAULT NULL,
     1010  `Link` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1011  PRIMARY KEY (`Id`),
     1012  KEY `category` (`Category`),
     1013  KEY `date` (`Date`),
     1014  KEY `Title` (`Title`),
     1015  KEY `Link` (`Link`),
     1016  KEY `User` (`User`)
     1017) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=973267 ;
     1018
     1019--
     1020-- RELACE PRO TABULKU `News`:
     1021--   `Category`
     1022--       `NewsCategory` -> `Id`
     1023--   `User`
     1024--       `User` -> `Id`
     1025--
     1026
     1027-- --------------------------------------------------------
     1028
     1029--
     1030-- Struktura tabulky `NewsCategory`
     1031--
     1032
     1033CREATE TABLE IF NOT EXISTS `NewsCategory` (
     1034  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1035  `Caption` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1036  `Permission` int(11) NOT NULL DEFAULT '0',
     1037  `Sequence` int(11) NOT NULL,
     1038  `Group` int(11) NOT NULL DEFAULT '1',
     1039  `RSS` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1040  PRIMARY KEY (`Id`),
     1041  KEY `Sequence` (`Sequence`),
     1042  KEY `Group` (`Group`)
     1043) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17 ;
     1044
     1045-- --------------------------------------------------------
     1046
     1047--
     1048-- Struktura tabulky `Panel`
     1049--
     1050
     1051CREATE TABLE IF NOT EXISTS `Panel` (
     1052  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1053  `Module` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1054  `Parameters` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1055  `Order` int(11) NOT NULL,
     1056  `PanelColumn` int(11) NOT NULL,
     1057  PRIMARY KEY (`Id`),
     1058  KEY `PanelColumn` (`PanelColumn`)
     1059) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=14 ;
     1060
     1061--
     1062-- RELACE PRO TABULKU `Panel`:
     1063--   `PanelColumn`
     1064--       `PanelColumn` -> `Id`
     1065--
     1066
     1067-- --------------------------------------------------------
     1068
     1069--
     1070-- Struktura tabulky `PanelColumn`
     1071--
     1072
     1073CREATE TABLE IF NOT EXISTS `PanelColumn` (
     1074  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1075  `Width` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1076  PRIMARY KEY (`Id`)
     1077) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     1078
     1079-- --------------------------------------------------------
     1080
     1081--
     1082-- Struktura tabulky `PermissionGroup`
     1083--
     1084
     1085CREATE TABLE IF NOT EXISTS `PermissionGroup` (
     1086  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1087  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1088  PRIMARY KEY (`Id`)
     1089) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6 ;
     1090
     1091-- --------------------------------------------------------
     1092
     1093--
     1094-- Struktura tabulky `PermissionGroupAssignment`
     1095--
     1096
     1097CREATE TABLE IF NOT EXISTS `PermissionGroupAssignment` (
     1098  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1099  `Group` int(11) NOT NULL DEFAULT '0',
     1100  `AssignedGroup` int(11) DEFAULT NULL,
     1101  `AssignedOperation` int(11) DEFAULT NULL,
     1102  PRIMARY KEY (`Id`),
     1103  KEY `Group` (`Group`),
     1104  KEY `AssignedGroup` (`AssignedGroup`),
     1105  KEY `AssignedOperation` (`AssignedOperation`)
     1106) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=48 ;
     1107
     1108--
     1109-- RELACE PRO TABULKU `PermissionGroupAssignment`:
     1110--   `Group`
     1111--       `PermissionGroup` -> `Id`
     1112--   `AssignedGroup`
     1113--       `PermissionGroup` -> `Id`
     1114--   `AssignedOperation`
     1115--       `PermissionOperation` -> `Id`
     1116--
     1117
     1118-- --------------------------------------------------------
     1119
     1120--
     1121-- Struktura tabulky `PermissionOperation`
     1122--
     1123
     1124CREATE TABLE IF NOT EXISTS `PermissionOperation` (
     1125  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1126  `Module` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1127  `Operation` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1128  `Item` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1129  `ItemId` int(11) NOT NULL DEFAULT '0',
     1130  PRIMARY KEY (`Id`),
     1131  KEY `Module` (`Module`),
     1132  KEY `Operation` (`Operation`),
     1133  KEY `Item` (`Item`),
     1134  KEY `ItemId` (`ItemId`)
     1135) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=45 ;
     1136
     1137-- --------------------------------------------------------
     1138
     1139--
     1140-- Struktura tabulky `PermissionUserAssignment`
     1141--
     1142
     1143CREATE TABLE IF NOT EXISTS `PermissionUserAssignment` (
     1144  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1145  `User` int(11) NOT NULL DEFAULT '0',
     1146  `AssignedGroup` int(11) DEFAULT NULL,
     1147  `AssignedOperation` int(11) DEFAULT NULL,
     1148  PRIMARY KEY (`Id`),
     1149  KEY `User` (`User`),
     1150  KEY `AssignedGroup` (`AssignedGroup`),
     1151  KEY `AssignedOperation` (`AssignedOperation`)
     1152) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=225 ;
     1153
     1154--
     1155-- RELACE PRO TABULKU `PermissionUserAssignment`:
     1156--   `User`
     1157--       `User` -> `Id`
     1158--   `AssignedGroup`
     1159--       `PermissionGroup` -> `Id`
     1160--   `AssignedOperation`
     1161--       `PermissionOperation` -> `Id`
     1162--
     1163
     1164-- --------------------------------------------------------
     1165
     1166--
     1167-- Struktura tabulky `PhoneBook`
     1168--
     1169
     1170CREATE TABLE IF NOT EXISTS `PhoneBook` (
     1171  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1172  `Number` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1173  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1174  `Address` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1175  `LastUpdate` datetime NOT NULL,
     1176  `Operator` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1177  PRIMARY KEY (`Id`)
     1178) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=53 ;
     1179
     1180-- --------------------------------------------------------
     1181
     1182--
     1183-- Struktura tabulky `Product`
     1184--
     1185
     1186CREATE TABLE IF NOT EXISTS `Product` (
     1187  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1188  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1189  `SellPrice` float NOT NULL,
     1190  `BuyPrice` float NOT NULL,
     1191  `VAT` float DEFAULT NULL,
     1192  `Consumption` int(11) DEFAULT NULL COMMENT 'In Watts',
     1193  `Supplier` int(11) DEFAULT NULL COMMENT 'Subject',
     1194  `Manufacturer` int(11) DEFAULT NULL,
     1195  `Code` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     1196  `UnitOfMeasure` int(11) NOT NULL,
     1197  PRIMARY KEY (`Id`),
     1198  UNIQUE KEY `Code` (`Code`),
     1199  KEY `Supplier` (`Supplier`),
     1200  KEY `UnitOfMeasure` (`UnitOfMeasure`),
     1201  KEY `Manufacturer` (`Manufacturer`)
     1202) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=166 ;
     1203
     1204--
     1205-- RELACE PRO TABULKU `Product`:
     1206--   `Supplier`
     1207--       `Subject` -> `Id`
     1208--   `Manufacturer`
     1209--       `Subject` -> `Id`
     1210--   `UnitOfMeasure`
     1211--       `UnitOfMeasure` -> `Id`
     1212--
     1213
     1214-- --------------------------------------------------------
     1215
     1216--
     1217-- Struktura tabulky `ProductOld`
     1218--
     1219
     1220CREATE TABLE IF NOT EXISTS `ProductOld` (
     1221  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1222  `Name` varchar(128) COLLATE utf8_czech_ci NOT NULL,
     1223  `Price` int(11) NOT NULL DEFAULT '0',
     1224  `Count` int(11) NOT NULL DEFAULT '1',
     1225  `Date` date NOT NULL DEFAULT '0000-00-00',
     1226  `Segment` int(11) DEFAULT '0',
     1227  `Used` int(11) NOT NULL DEFAULT '0',
     1228  `Consumption` int(11) NOT NULL DEFAULT '0',
     1229  `User` int(11) DEFAULT '0',
     1230  `Info` text COLLATE utf8_czech_ci NOT NULL,
     1231  `Channel` int(11) NOT NULL DEFAULT '0',
     1232  `DeviceId` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1233  `Shop` varchar(64) COLLATE utf8_czech_ci NOT NULL,
     1234  `DeprecatedPrice` int(11) NOT NULL DEFAULT '0',
     1235  `TimeEnlistment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1236  `TimeElimination` datetime DEFAULT '0000-00-00 00:00:00',
     1237  `StockCard` int(11) NOT NULL,
     1238  PRIMARY KEY (`Id`),
     1239  KEY `Segment` (`Segment`),
     1240  KEY `Used` (`Used`),
     1241  KEY `User` (`User`)
     1242) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=164 ;
     1243
     1244--
     1245-- RELACE PRO TABULKU `ProductOld`:
     1246--   `Segment`
     1247--       `NetworkSegment` -> `Id`
     1248--
     1249
     1250-- --------------------------------------------------------
     1251
     1252--
     1253-- Struktura tabulky `Service`
     1254--
     1255
     1256CREATE TABLE IF NOT EXISTS `Service` (
     1257  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1258  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1259  PRIMARY KEY (`Id`)
     1260) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     1261
     1262-- --------------------------------------------------------
     1263
     1264--
     1265-- Struktura tabulky `Stock`
     1266--
     1267
     1268CREATE TABLE IF NOT EXISTS `Stock` (
     1269  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1270  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1271  `Location` int(11) DEFAULT NULL,
     1272  PRIMARY KEY (`Id`),
     1273  KEY `Location` (`Location`)
     1274) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     1275
     1276--
     1277-- RELACE PRO TABULKU `Stock`:
     1278--   `Location`
     1279--       `Member` -> `Id`
     1280--
     1281
     1282-- --------------------------------------------------------
     1283
     1284--
     1285-- Struktura tabulky `StockItem`
     1286--
     1287
     1288CREATE TABLE IF NOT EXISTS `StockItem` (
     1289  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1290  `Stock` int(11) NOT NULL,
     1291  `Product` int(11) NOT NULL,
     1292  `TimeEnlistment` date NOT NULL,
     1293  `TimeElimination` date DEFAULT NULL,
     1294  `BuyPrice` decimal(10,0) NOT NULL,
     1295  `SellPrice` decimal(10,0) NOT NULL,
     1296  `Amount` float NOT NULL,
     1297  `SerialNumber` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
     1298  `Location` int(11) DEFAULT NULL COMMENT 'Member',
     1299  `Segment` int(11) DEFAULT NULL,
     1300  `Info` text COLLATE utf8_czech_ci NOT NULL,
     1301  PRIMARY KEY (`Id`),
     1302  UNIQUE KEY `SerialNumber` (`SerialNumber`),
     1303  KEY `Product` (`Product`),
     1304  KEY `Stock` (`Stock`),
     1305  KEY `Segment` (`Segment`),
     1306  KEY `Location` (`Location`)
     1307) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=164 ;
     1308
     1309--
     1310-- RELACE PRO TABULKU `StockItem`:
     1311--   `Location`
     1312--       `Member` -> `Id`
     1313--   `Stock`
     1314--       `Stock` -> `Id`
     1315--   `StockCard`
     1316--       `StockCard` -> `Id`
     1317--   `Product`
     1318--       `Product` -> `Id`
     1319--   `Segment`
     1320--       `NetworkSegment` -> `Id`
     1321--
     1322
     1323-- --------------------------------------------------------
     1324
     1325--
     1326-- Struktura tabulky `Subject`
     1327--
     1328
     1329CREATE TABLE IF NOT EXISTS `Subject` (
     1330  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1331  `Name` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1332  `AddressStreet` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1333  `AddressTown` varchar(64) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1334  `AddressPSC` int(11) NOT NULL DEFAULT '0',
     1335  `AddressCountry` int(11) NOT NULL,
     1336  `IC` varchar(32) COLLATE utf8_czech_ci NOT NULL,
     1337  `DIC` varchar(32) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1338  `MapPositionX` float NOT NULL DEFAULT '0',
     1339  `MapPositionY` float NOT NULL DEFAULT '0',
     1340  `WWW` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1341  `Note` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1342  PRIMARY KEY (`Id`),
     1343  KEY `AddressCountry` (`AddressCountry`)
     1344) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=229 ;
     1345
     1346--
     1347-- RELACE PRO TABULKU `Subject`:
     1348--   `AddressCountry`
     1349--       `Country` -> `Id`
     1350--
     1351
     1352-- --------------------------------------------------------
     1353
     1354--
     1355-- Struktura tabulky `SubjectOpenTime`
     1356--
     1357
     1358CREATE TABLE IF NOT EXISTS `SubjectOpenTime` (
     1359  `Subject` int(11) NOT NULL DEFAULT '0',
     1360  `UpdateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1361  `Notice` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1362  `Photo` int(11) NOT NULL,
     1363  KEY `Subject` (`Subject`)
     1364) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     1365
     1366--
     1367-- RELACE PRO TABULKU `SubjectOpenTime`:
     1368--   `Subject`
     1369--       `Subject` -> `Id`
     1370--
     1371
     1372-- --------------------------------------------------------
     1373
     1374--
     1375-- Struktura tabulky `SubjectOpenTimeDay`
     1376--
     1377
     1378CREATE TABLE IF NOT EXISTS `SubjectOpenTimeDay` (
     1379  `Subject` int(11) NOT NULL,
     1380  `Day` int(11) NOT NULL,
     1381  `Open1` int(11) NOT NULL,
     1382  `Close1` int(11) NOT NULL,
     1383  `Open2` int(11) NOT NULL,
     1384  `Close2` int(11) NOT NULL,
     1385  KEY `Subject` (`Subject`)
     1386) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     1387
     1388--
     1389-- RELACE PRO TABULKU `SubjectOpenTimeDay`:
     1390--   `Subject`
     1391--       `Subject` -> `Id`
     1392--
     1393
     1394-- --------------------------------------------------------
     1395
     1396--
     1397-- Struktura tabulky `SystemVersion`
     1398--
     1399
     1400CREATE TABLE IF NOT EXISTS `SystemVersion` (
     1401  `Rev464` bit(1) DEFAULT NULL
     1402) ENGINE=InnoDB DEFAULT CHARSET=utf8;
     1403
     1404-- --------------------------------------------------------
     1405
     1406--
     1407-- Struktura tabulky `Task`
     1408--
     1409
     1410CREATE TABLE IF NOT EXISTS `Task` (
     1411  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1412  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1413  `Description` text COLLATE utf8_czech_ci NOT NULL,
     1414  `TimeCreate` date NOT NULL,
     1415  `TimeDue` date DEFAULT NULL,
     1416  `TimeClose` date DEFAULT NULL,
     1417  `Priority` int(11) NOT NULL,
     1418  `Conclusion` text COLLATE utf8_czech_ci NOT NULL,
     1419  `Public` int(11) NOT NULL,
     1420  `Progress` int(11) NOT NULL,
     1421  `Group` int(11) DEFAULT NULL,
     1422  `AssignedTo` int(11) DEFAULT NULL,
     1423  PRIMARY KEY (`Id`),
     1424  KEY `Group` (`Group`),
     1425  KEY `AssignedTo` (`AssignedTo`)
     1426) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=7 ;
     1427
     1428--
     1429-- RELACE PRO TABULKU `Task`:
     1430--   `Group`
     1431--       `TaskGroup` -> `Id`
     1432--   `AssignedTo`
     1433--       `User` -> `Id`
     1434--
     1435
     1436-- --------------------------------------------------------
     1437
     1438--
     1439-- Struktura tabulky `TaskGroup`
     1440--
     1441
     1442CREATE TABLE IF NOT EXISTS `TaskGroup` (
     1443  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1444  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1445  `Description` text COLLATE utf8_czech_ci NOT NULL,
     1446  `Parent` int(11) DEFAULT NULL,
     1447  PRIMARY KEY (`Id`),
     1448  KEY `Parent` (`Parent`)
     1449) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=3 ;
     1450
     1451--
     1452-- RELACE PRO TABULKU `TaskGroup`:
     1453--   `Parent`
     1454--       `TaskGroup` -> `Id`
     1455--
     1456
     1457-- --------------------------------------------------------
     1458
     1459--
     1460-- Struktura tabulky `TV`
     1461--
     1462
     1463CREATE TABLE IF NOT EXISTS `TV` (
     1464  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1465  `Name` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     1466  `Frequency` int(11) NOT NULL DEFAULT '0',
     1467  `Norm` varchar(8) COLLATE utf8_czech_ci NOT NULL,
     1468  `Homepage` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1469  `Language` int(11) DEFAULT NULL,
     1470  `ShortName` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     1471  `Stream` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1472  `StreamWeb` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1473  `SourceType` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1474  `Category` int(11) DEFAULT NULL,
     1475  PRIMARY KEY (`Id`),
     1476  UNIQUE KEY `ShortName` (`ShortName`),
     1477  KEY `Language` (`Language`),
     1478  KEY `Category` (`Category`)
     1479) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=46 ;
     1480
     1481--
     1482-- RELACE PRO TABULKU `TV`:
     1483--   `Language`
     1484--       `Language` -> `Id`
     1485--   `Category`
     1486--       `TVGroup` -> `Id`
     1487--
     1488
     1489-- --------------------------------------------------------
     1490
     1491--
     1492-- Struktura tabulky `TVGroup`
     1493--
     1494
     1495CREATE TABLE IF NOT EXISTS `TVGroup` (
     1496  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1497  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1498  PRIMARY KEY (`Id`)
     1499) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=7 ;
     1500
     1501-- --------------------------------------------------------
     1502
     1503--
     1504-- Struktura tabulky `UnitOfMeasure`
     1505--
     1506
     1507CREATE TABLE IF NOT EXISTS `UnitOfMeasure` (
     1508  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1509  `Unit` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1510  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1511  PRIMARY KEY (`Id`)
     1512) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=11 ;
     1513
     1514-- --------------------------------------------------------
     1515
     1516--
     1517-- Struktura tabulky `User`
     1518--
     1519
     1520CREATE TABLE IF NOT EXISTS `User` (
     1521  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1522  `Login` varchar(64) COLLATE utf8_czech_ci NOT NULL,
     1523  `Name` varchar(128) COLLATE utf8_czech_ci NOT NULL,
     1524  `Password` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1525  `Salt` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1526  `Email` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1527  `LastIpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1528  `LastLoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1529  `RegistrationTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1530  `Locked` tinyint(1) NOT NULL DEFAULT '0',
     1531  `ICQ` int(11) NOT NULL DEFAULT '0',
     1532  `PhoneNumber` varchar(32) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1533  `InitPassword` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1534  PRIMARY KEY (`Id`),
     1535  UNIQUE KEY `Name` (`Login`),
     1536  UNIQUE KEY `Nick` (`Name`)
     1537) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=250 ;
     1538
     1539-- --------------------------------------------------------
     1540
     1541--
     1542-- Struktura tabulky `UserCustomerRel`
     1543--
     1544
     1545CREATE TABLE IF NOT EXISTS `UserCustomerRel` (
     1546  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1547  `Customer` int(11) NOT NULL,
     1548  `User` int(11) NOT NULL,
     1549  PRIMARY KEY (`Id`),
     1550  KEY `Customer` (`Customer`),
     1551  KEY `User` (`User`)
     1552) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=519 ;
     1553
     1554--
     1555-- RELACE PRO TABULKU `UserCustomerRel`:
     1556--   `Customer`
     1557--       `Member` -> `Id`
     1558--   `User`
     1559--       `User` -> `Id`
     1560--
     1561
     1562-- --------------------------------------------------------
     1563
     1564--
     1565-- Struktura tabulky `UserOnline`
     1566--
     1567
     1568CREATE TABLE IF NOT EXISTS `UserOnline` (
     1569  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1570  `User` int(11) NOT NULL DEFAULT '0' COMMENT 'User.Id',
     1571  `ActivityTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1572  `LoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     1573  `SessionId` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1574  `IpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1575  `HostName` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     1576  `ScriptName` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     1577  PRIMARY KEY (`Id`),
     1578  KEY `User` (`User`)
     1579) ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6761 ;
     1580
     1581-- --------------------------------------------------------
     1582
     1583--
     1584-- Struktura tabulky `Work`
     1585--
     1586
     1587CREATE TABLE IF NOT EXISTS `Work` (
     1588  `Id` int(11) NOT NULL AUTO_INCREMENT,
     1589  `Name` varchar(255) NOT NULL,
     1590  `Description` text,
     1591  `TimeStart` datetime NOT NULL,
     1592  `Duration` float NOT NULL,
     1593  `User` int(11) DEFAULT NULL,
     1594  `Task` int(11) DEFAULT NULL,
     1595  PRIMARY KEY (`Id`),
     1596  KEY `User` (`User`),
     1597  KEY `Task` (`Task`),
     1598  KEY `TimeStart` (`TimeStart`)
     1599) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     1600
     1601--
     1602-- RELACE PRO TABULKU `Work`:
     1603--   `User`
     1604--       `User` -> `Id`
     1605--   `Task`
     1606--       `Task` -> `Id`
     1607--
     1608
    391609--
    401610-- Omezení pro exportované tabulky
    411611--
     1612
     1613--
     1614-- Omezení pro tabulku `DocumentLineSequence`
     1615--
     1616ALTER TABLE `DocumentLineSequence`
     1617  ADD CONSTRAINT `DocumentLineSequence_ibfk_1` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`),
     1618  ADD CONSTRAINT `DocumentLineSequence_ibfk_2` FOREIGN KEY (`FinanceYear`) REFERENCES `FinanceYear` (`Id`);
     1619
     1620--
     1621-- Omezení pro tabulku `FinanceBills`
     1622--
     1623ALTER TABLE `FinanceBills`
     1624  ADD CONSTRAINT `FinanceBills_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1625
     1626--
     1627-- Omezení pro tabulku `FinanceBillsItems`
     1628--
     1629ALTER TABLE `FinanceBillsItems`
     1630  ADD CONSTRAINT `FinanceBillsItems_ibfk_1` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`);
     1631
     1632--
     1633-- Omezení pro tabulku `FinanceClaimsLiabilities`
     1634--
     1635ALTER TABLE `FinanceClaimsLiabilities`
     1636  ADD CONSTRAINT `FinanceClaimsLiabilities_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1637
     1638--
     1639-- Omezení pro tabulku `FinanceOperation`
     1640--
     1641ALTER TABLE `FinanceOperation`
     1642  ADD CONSTRAINT `FinanceOperation_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`),
     1643  ADD CONSTRAINT `FinanceOperation_ibfk_2` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`),
     1644  ADD CONSTRAINT `FinanceOperation_ibfk_3` FOREIGN KEY (`BankAccount`) REFERENCES `FinanceBankAccount` (`Id`),
     1645  ADD CONSTRAINT `FinanceOperation_ibfk_4` FOREIGN KEY (`Treasury`) REFERENCES `FinanceTreasury` (`Id`);
     1646
     1647--
     1648-- Omezení pro tabulku `Hyperlink`
     1649--
     1650ALTER TABLE `Hyperlink`
     1651  ADD CONSTRAINT `Hyperlink_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `HyperlinkGroup` (`Id`);
     1652
     1653--
     1654-- Omezení pro tabulku `ISMenuItem`
     1655--
     1656ALTER TABLE `ISMenuItem`
     1657  ADD CONSTRAINT `ISMenuItem_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `ISMenuItem` (`Id`);
    421658
    431659--
     
    461662ALTER TABLE `Log`
    471663  ADD CONSTRAINT `Log_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
     1664
     1665--
     1666-- Omezení pro tabulku `Member`
     1667--
     1668ALTER TABLE `Member`
     1669  ADD CONSTRAINT `Member_ibfk_23` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`),
     1670  ADD CONSTRAINT `Member_ibfk_24` FOREIGN KEY (`ResponsibleUser`) REFERENCES `User` (`Id`),
     1671  ADD CONSTRAINT `Member_ibfk_25` FOREIGN KEY (`InternetTariffCurrentMonth`) REFERENCES `FinanceTariff` (`Id`),
     1672  ADD CONSTRAINT `Member_ibfk_26` FOREIGN KEY (`InternetTariffNextMonth`) REFERENCES `FinanceTariff` (`Id`),
     1673  ADD CONSTRAINT `Member_ibfk_27` FOREIGN KEY (`BillingPeriod`) REFERENCES `FinanceBillingPeriod` (`Id`),
     1674  ADD CONSTRAINT `Member_ibfk_28` FOREIGN KEY (`BillingPeriodNext`) REFERENCES `FinanceBillingPeriod` (`Id`);
     1675
     1676--
     1677-- Omezení pro tabulku `MemberPayment`
     1678--
     1679ALTER TABLE `MemberPayment`
     1680  ADD CONSTRAINT `MemberPayment_ibfk_1` FOREIGN KEY (`Member`) REFERENCES `Member` (`Id`);
     1681
     1682--
     1683-- Omezení pro tabulku `NetworkAP`
     1684--
     1685ALTER TABLE `NetworkAP`
     1686  ADD CONSTRAINT `NetworkAP_ibfk_1` FOREIGN KEY (`NetworkDevice`) REFERENCES `NetworkDevice` (`Id`);
     1687
     1688--
     1689-- Omezení pro tabulku `NetworkDevice`
     1690--
     1691ALTER TABLE `NetworkDevice`
     1692  ADD CONSTRAINT `NetworkDevice_ibfk_4` FOREIGN KEY (`Member`) REFERENCES `Member` (`Id`),
     1693  ADD CONSTRAINT `NetworkDevice_ibfk_5` FOREIGN KEY (`Location`) REFERENCES `Member` (`Id`),
     1694  ADD CONSTRAINT `NetworkDevice_ibfk_6` FOREIGN KEY (`Type`) REFERENCES `NetworkDeviceType` (`Id`);
     1695
     1696--
     1697-- Omezení pro tabulku `NetworkDeviceConfig`
     1698--
     1699ALTER TABLE `NetworkDeviceConfig`
     1700  ADD CONSTRAINT `NetworkDeviceConfig_ibfk_1` FOREIGN KEY (`Device`) REFERENCES `NetworkDevice` (`Id`);
     1701
     1702--
     1703-- Omezení pro tabulku `NetworkFirewall`
     1704--
     1705ALTER TABLE `NetworkFirewall`
     1706  ADD CONSTRAINT `NetworkFirewall_ibfk_1` FOREIGN KEY (`NetworkDevice`) REFERENCES `NetworkDevice` (`Id`);
     1707
     1708--
     1709-- Omezení pro tabulku `NetworkInterface`
     1710--
     1711ALTER TABLE `NetworkInterface`
     1712  ADD CONSTRAINT `NetworkInterface_ibfk_1` FOREIGN KEY (`Type`) REFERENCES `NetworkInterfaceType` (`Id`),
     1713  ADD CONSTRAINT `NetworkInterface_ibfk_2` FOREIGN KEY (`Device`) REFERENCES `NetworkDevice` (`Id`);
     1714
     1715--
     1716-- Omezení pro tabulku `NetworkSegment`
     1717--
     1718ALTER TABLE `NetworkSegment`
     1719  ADD CONSTRAINT `NetworkSegment_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `NetworkSegment` (`Id`);
     1720
     1721--
     1722-- Omezení pro tabulku `NetworkSubnet`
     1723--
     1724ALTER TABLE `NetworkSubnet`
     1725  ADD CONSTRAINT `NetworkSubnet_ibfk_1` FOREIGN KEY (`Member`) REFERENCES `Member` (`Id`);
     1726
     1727--
     1728-- Omezení pro tabulku `News`
     1729--
     1730ALTER TABLE `News`
     1731  ADD CONSTRAINT `News_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `NewsCategory` (`Id`),
     1732  ADD CONSTRAINT `News_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
     1733
     1734--
     1735-- Omezení pro tabulku `Panel`
     1736--
     1737ALTER TABLE `Panel`
     1738  ADD CONSTRAINT `Panel_ibfk_1` FOREIGN KEY (`PanelColumn`) REFERENCES `PanelColumn` (`Id`);
     1739
     1740--
     1741-- Omezení pro tabulku `PermissionGroupAssignment`
     1742--
     1743ALTER TABLE `PermissionGroupAssignment`
     1744  ADD CONSTRAINT `PermissionGroupAssignment_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `PermissionGroup` (`Id`),
     1745  ADD CONSTRAINT `PermissionGroupAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `PermissionGroup` (`Id`),
     1746  ADD CONSTRAINT `PermissionGroupAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `PermissionOperation` (`Id`);
     1747
     1748--
     1749-- Omezení pro tabulku `PermissionUserAssignment`
     1750--
     1751ALTER TABLE `PermissionUserAssignment`
     1752  ADD CONSTRAINT `PermissionUserAssignment_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
     1753  ADD CONSTRAINT `PermissionUserAssignment_ibfk_2` FOREIGN KEY (`AssignedGroup`) REFERENCES `PermissionGroup` (`Id`),
     1754  ADD CONSTRAINT `PermissionUserAssignment_ibfk_3` FOREIGN KEY (`AssignedOperation`) REFERENCES `PermissionOperation` (`Id`);
     1755
     1756--
     1757-- Omezení pro tabulku `Product`
     1758--
     1759ALTER TABLE `Product`
     1760  ADD CONSTRAINT `Product_ibfk_1` FOREIGN KEY (`Supplier`) REFERENCES `Subject` (`Id`),
     1761  ADD CONSTRAINT `Product_ibfk_2` FOREIGN KEY (`Manufacturer`) REFERENCES `Subject` (`Id`),
     1762  ADD CONSTRAINT `Product_ibfk_3` FOREIGN KEY (`UnitOfMeasure`) REFERENCES `UnitOfMeasure` (`Id`);
     1763
     1764--
     1765-- Omezení pro tabulku `ProductOld`
     1766--
     1767ALTER TABLE `ProductOld`
     1768  ADD CONSTRAINT `ProductOld_ibfk_1` FOREIGN KEY (`Segment`) REFERENCES `NetworkSegment` (`Id`);
     1769
     1770--
     1771-- Omezení pro tabulku `Stock`
     1772--
     1773ALTER TABLE `Stock`
     1774  ADD CONSTRAINT `Stock_ibfk_1` FOREIGN KEY (`Location`) REFERENCES `Member` (`Id`);
     1775
     1776--
     1777-- Omezení pro tabulku `StockItem`
     1778--
     1779ALTER TABLE `StockItem`
     1780  ADD CONSTRAINT `StockItem_ibfk_1` FOREIGN KEY (`Stock`) REFERENCES `Stock` (`Id`),
     1781  ADD CONSTRAINT `StockItem_ibfk_3` FOREIGN KEY (`Location`) REFERENCES `Member` (`Id`),
     1782  ADD CONSTRAINT `StockItem_ibfk_5` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`),
     1783  ADD CONSTRAINT `StockItem_ibfk_6` FOREIGN KEY (`Segment`) REFERENCES `NetworkSegment` (`Id`);
     1784
     1785--
     1786-- Omezení pro tabulku `Subject`
     1787--
     1788ALTER TABLE `Subject`
     1789  ADD CONSTRAINT `Subject_ibfk_1` FOREIGN KEY (`AddressCountry`) REFERENCES `Country` (`Id`);
     1790
     1791--
     1792-- Omezení pro tabulku `SubjectOpenTime`
     1793--
     1794ALTER TABLE `SubjectOpenTime`
     1795  ADD CONSTRAINT `SubjectOpenTime_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1796
     1797--
     1798-- Omezení pro tabulku `SubjectOpenTimeDay`
     1799--
     1800ALTER TABLE `SubjectOpenTimeDay`
     1801  ADD CONSTRAINT `SubjectOpenTimeDay_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1802
     1803--
     1804-- Omezení pro tabulku `Task`
     1805--
     1806ALTER TABLE `Task`
     1807  ADD CONSTRAINT `Task_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `TaskGroup` (`Id`),
     1808  ADD CONSTRAINT `Task_ibfk_2` FOREIGN KEY (`AssignedTo`) REFERENCES `User` (`Id`);
     1809
     1810--
     1811-- Omezení pro tabulku `TaskGroup`
     1812--
     1813ALTER TABLE `TaskGroup`
     1814  ADD CONSTRAINT `TaskGroup_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `TaskGroup` (`Id`);
     1815
     1816--
     1817-- Omezení pro tabulku `TV`
     1818--
     1819ALTER TABLE `TV`
     1820  ADD CONSTRAINT `TV_ibfk_1` FOREIGN KEY (`Language`) REFERENCES `Language` (`Id`),
     1821  ADD CONSTRAINT `TV_ibfk_2` FOREIGN KEY (`Category`) REFERENCES `TVGroup` (`Id`);
     1822
     1823--
     1824-- Omezení pro tabulku `UserCustomerRel`
     1825--
     1826ALTER TABLE `UserCustomerRel`
     1827  ADD CONSTRAINT `usercustomerrel_ibfk_1` FOREIGN KEY (`Customer`) REFERENCES `Member` (`Id`),
     1828  ADD CONSTRAINT `usercustomerrel_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);
     1829
     1830--
     1831-- Omezení pro tabulku `Work`
     1832--
     1833ALTER TABLE `Work`
     1834  ADD CONSTRAINT `Work_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
     1835  ADD CONSTRAINT `Work_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`Id`);
  • trunk/system/generators/linux/traffic_shaping.php

    r440 r479  
    128128    $UserClassId = $ClassId;
    129129    $ClassId = $ClassId + 1;
    130     $SpeedIn = round($Tarify[$User['inet_tarif_now']]['SpeedMin'] / $InDivider);
    131     $SpeedOut = round($Tarify[$User['inet_tarif_now']]['SpeedMin'] / $OutDivider);
    132     $UserMaxSpeedIn = round($Tarify[$User['inet_tarif_now']]['SpeedMax'] / $InDivider);
    133     $UserMaxSpeedOut = round($Tarify[$User['inet_tarif_now']]['SpeedMax'] / $OutDivider);
     130    $SpeedIn = round($Tarify[$User['inet_tarif_now']]['InternetSpeedMin'] / $InDivider);
     131    $SpeedOut = round($Tarify[$User['inet_tarif_now']]['InternetSpeedMin'] / $OutDivider);
     132    $UserMaxSpeedIn = round($Tarify[$User['inet_tarif_now']]['InternetSpeedMax'] / $InDivider);
     133    $UserMaxSpeedOut = round($Tarify[$User['inet_tarif_now']]['InternetSpeedMax'] / $OutDivider);
    134134    $Quantum = $Tarify[$User['inet_tarif_now']]['speed_factor'] * 1500;
    135135
  • trunk/system/generators/queue.php

    r440 r479  
    3838$InInterface = 'ifb0';
    3939$InetInterface = $Config['MainRouter']['InetInterface'];
    40 $FreeInetSpeed = $Finance->Tariffs[7]['SpeedMax'];
     40$FreeInetSpeed = $Finance->Tariffs[TARIFF_FREE]['InternetSpeedMax'];
    4141
    4242$ItemsQueue = array();
     
    6262  echo('Uživatel '.$Member['Name'].': ');
    6363  $Tariff = $Finance->Tariffs[$Member['InternetTariffCurrentMonth']];
    64   $SpeedIn = round($Tariff['SpeedMin'] / $InDivider);
    65   $SpeedOut = round($Tariff['SpeedMin'] / $OutDivider);
    66   $UserMaxSpeedIn = round($Tariff['SpeedMax'] / $InDivider);
    67   $UserMaxSpeedOut = round($Tariff['SpeedMax'] / $OutDivider);
     64  $SpeedIn = round($Tariff['InternetSpeedMin'] / $InDivider);
     65  $SpeedOut = round($Tariff['InternetSpeedMin'] / $OutDivider);
     66  $UserMaxSpeedIn = round($Tariff['InternetSpeedMax'] / $InDivider);
     67  $UserMaxSpeedOut = round($Tariff['InternetSpeedMax'] / $OutDivider);
    6868  $ItemsQueue[] = array('name' => $Member['Name'].'-out', 'limit-at' => $SpeedIn, 'max-limit' => $UserMaxSpeedIn, 'parent' => 'main-out');
    6969  $ItemsQueue[] = array('name' => $Member['Name'].'-in', 'limit-at' => $SpeedOut, 'max-limit' => $UserMaxSpeedOut, 'parent' => 'main-in');
Note: See TracChangeset for help on using the changeset viewer.