Changeset 494


Ignore:
Timestamp:
Mar 1, 2013, 10:44:18 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Přepočítávání stavu placení zákazníků.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Page.php

    r493 r494  
    149149    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
    150150    '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.
    151     '<head><link rel="stylesheet" href="'.$this->System->Config['Web']['RootFolder'].'/style/'.$this->System->Config['Web']['Style'].'/style.css" type="text/css" media="all" />'.
     151    '<head><link rel="stylesheet" href="'.$this->System->Link('/style/').$this->System->Config['Web']['Style'].'/style.css" type="text/css" media="all" />'.
    152152    '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'.
    153     '<script type="text/javascript" src="'.$this->System->Config['Web']['RootFolder'].'/style/'.$this->System->Config['Web']['Style'].'/global.js"></script>'.
     153    '<script type="text/javascript" src="'.$this->System->Link('/style/').$this->System->Config['Web']['Style'].'/global.js"></script>'.
    154154    '<title>'.$this->System->Config['Web']['Title'].' - '.$Path.'</title>
    155155    </head><body'.$BodyParam.'>
     
    159159    {
    160160      if($this->System->Modules['User']->User['Id'] == null)
    161         $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>';
    162         else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>';
     161        $Output .= '<a href="'.$this->System->Link('/?Action=LoginForm').'">Přihlášení</a> <a href="'.$this->System->Link('/?Action=UserRegister').'">Registrace</a>';
     162        else $Output .= $this->System->Modules['User']->User['Name'].' <a href="'.$this->System->Link('/?Action=Logout').'">Odhlásit</a>';
    163163   } else $Output .= '&nbsp;';
    164164// <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
  • trunk/Common/Version.php

    r493 r494  
    11<?php
    22
    3 $Revision = 493; // Subversion revision
    4 $DatabaseRevision = 493;
     3$Revision = 494; // Subversion revision
     4$DatabaseRevision = 494;
    55$ReleaseTime = '2013-03-01';
    66
  • trunk/Modules/Portal/Portal.php

    r493 r494  
    169169      if($_GET['Action'] == 'Logout')
    170170      {
    171         $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
     171        if($this->System->Modules['User']->User['Id'] != null)
     172        {
     173          $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
     174        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    172175      } else
    173176      if($_GET['Action'] == 'UserOptions')
    174177      {
    175         $UserOptions = new Form('UserOptions');
    176         $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
    177         $UserOptions->OnSubmit = '?Action=UserOptionsSave';
    178         $Output .= $UserOptions->ShowEditForm();
     178        if($this->System->Modules['User']->User['Id'] != null)
     179        {
     180          $UserOptions = new Form('UserOptions');
     181          $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     182          $UserOptions->OnSubmit = '?Action=UserOptionsSave';
     183          $Output .= $UserOptions->ShowEditForm();
     184        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    179185      } else
    180186      if($_GET['Action'] == 'UserOptionsSave')
  • trunk/Modules/TV/TV.php

    r479 r494  
    6868    $Output .= '</div><br/>';
    6969   
    70     $Output .= 'Originální informace o televizi: <a href="http://tv.hovnet.czf/">HovNet televize</a><br/>';
    7170    $Output .= 'Další online TV na webu: <a href="http://spustit.cz">Spustit.cz</a><br/>';
    7271    $Output .= 'Další online TV na webu: <a href="http://www.tvinfo.cz/live/televize/evropa/cz">TV info</a><br/>';
  • trunk/admin/FullInstall.php

    r493 r494  
    23362336(40, 'Produkty', 27, 'Product', ''),
    23372337(41, 'Sklady', 27, 'Stock', '');");
     2338  $Manager->Execute("INSERT INTO `ServiceCategory` (`Id`, `Name`) VALUES
     2339(1, 'Internet'),
     2340(2, 'VoIP'),
     2341(3, 'Spotřeba + nájem'),
     2342(4, 'IPTV'),
     2343(5, 'IP kamery'),
     2344(6, 'Meteostanice'),
     2345(7, 'Web hosting'),
     2346(8, 'VPS hosting');");
     2347  $Manager->Execute("INSERT INTO `Service` (`Id`, `Name`, `Category`, `Price`, `CustomerCount`, `ReplaceId`, `Public`, `InternetSpeedMin`, `InternetSpeedMax`, `UploadAsymmetry`, `Memory`, `MemorySwap`, `Storage`, `CPUCount`) VALUES
     2348(1, 'Internet 4M', 1, 190, 23, NULL, 1, 4096, 204, 1, 0, 0, 0, 0),
     2349(2, 'Internet 8M', 1, 260, 23, NULL, 1, 8192, 408, 1, 0, 0, 0, 0),
     2350(3, 'Internet 16M', 1, 360, 50, NULL, 1, 16384, 816, 1, 0, 0, 0, 0),
     2351(4, 'Internet 32M', 1, 520, 6, NULL, 1, 32768, 1638, 1, 0, 0, 0, 0),
     2352(5, 'Internet 64M', 1, 750, 0, NULL, 1, 65536, 8196, 1, 0, 0, 0, 0),
     2353(6, 'Internet Instituce', 2, 1000, 1, NULL, 1, 65536, 8192, 1, 0, 0, 0, 0),
     2354(7, 'Zdarma', 3, 0, 12, NULL, 1, 128, 128, 1, 0, 0, 0, 0),
     2355(8, 'Hosting 4GB', 2, 500, 2, NULL, 1, 64000, 4000, 1, 0, 0, 0, 0),
     2356(9, 'Hosting 2GB', 2, 300, 0, NULL, 1, 40000, 2000, 1, 0, 0, 0, 0),
     2357(10, 'Hosting 1GB', 2, 170, 1, NULL, 1, 30000, 2000, 1, 0, 0, 0, 0),
     2358(11, 'Hosting 512M', 2, 100, 0, NULL, 1, 20000, 1500, 1, 0, 0, 0, 0),
     2359(12, 'Hosting 8GB', 2, 900, 1, NULL, 1, 60000, 4000, 1, 0, 0, 0, 0),
     2360(13, 'Hosting 16G', 2, 1500, 0, NULL, 1, 60000, 4000, 1, 0, 0, 0, 0),
     2361(14, 'Hosting 6GB', 2, 700, 0, NULL, 1, 64000, 4000, 1, 0, 0, 0, 0);");
     2362  $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Id`, `Service`, `Customer`, `Period`) VALUES
     2363(1, 1, 1, 0), (2, 1, 1, 1);");
     2364  $Manager->Execute("INSERT INTO `File` (`Id` ,`Name` ,`Size` ,`Directory`) VALUES (NULL , 'invoice_1.pdf', '123', NULL);");
     2365  $Manager->Execute("INSERT INTO `FinanceInvoice` (`Id` ,`BillCode` ,`Subject` ,`TimeCreation` ,`TimeDue` ,`TimePayment` ,`Value` ,`File` ,`Text` ,`PeriodTo` ,`PeriodFrom`) ".
     2366    "VALUES (1 , 'VF123/2013', '1', NOW( ) , '0000-00-00 00:00:00', NULL , '300', '1', 'Měsíční paušál', '2013-01-01', '2013-01-31');");
     2367  $Manager->Execute("INSERT INTO `FinanceInvoiceItem` (`Id` ,`FinanceInvoice` ,`Description` ,`Price` ,`VAT` ,`Quantity`) ".
     2368     "VALUES (1 , '1', 'Internet 16M', '300', '21', '1');");
     2369  $Manager->Execute("INSERT INTO `FinanceYear` (`Id`, `Year`, `DateStart`, `DateEnd`) VALUES
     2370(1, 2007, '2007-12-01', '2007-12-31'),
     2371(2, 2008, '2008-01-01', '2008-12-31'),
     2372(3, 2009, '2009-01-01', '2009-12-31'),
     2373(4, 2010, '2010-01-01', '2010-12-31'),
     2374(6, 2011, '2011-01-01', '2011-12-31'),
     2375(7, 2012, '2012-01-01', '2012-12-31'),
     2376(8, 2013, '2013-01-01', '2013-12-31');");
     2377  $Manager->Execute("INSERT INTO `FinanceCharge` (`Period`, `Internet`, `InternetSpeed`, `InternetSpeedReserve`, `AdministrationPerUser`, `kWh`, `BaseSpeedElement`, `BaseTariffPrice`, `TopTariffPrice`) VALUES
     2378(1, 10000, 100000, 10000, 50, 6, 1024, 50, 138),
     2379(0, 10000, 100000, 10000, 50, 6, 1024, 50, 138);");
    23382380}
    23392381
  • trunk/admin/Updates.php

    r493 r494  
    66}
    77
     8function UpdateTo494($Manager)
     9{     
     10  $Manager->Execute("ALTER TABLE `FinanceOperation` DROP FOREIGN KEY `FinanceOperation_ibfk_2` ;\n".
     11    "ALTER TABLE `FinanceOperation` CHANGE `Bill` `File` INT( 11 ) NULL DEFAULT NULL;\n".
     12    "ALTER TABLE `FinanceOperation` ADD FOREIGN KEY ( `File` ) REFERENCES `File` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     13}
     14
     15
     16
    817$Updates = array(
    918        491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
     19  493 => array('Revision' => 494, 'Function' => 'UpdateTo494'),
    1020);
    1121
  • trunk/finance/finance.php

    r486 r494  
    5959      $Tariffs['CustomerCount'] = $Row[0];
    6060     
    61       //echo($Tariff['Name'].' '.$Tariff['MemberCount'].' '.$Tariff['SpeedMax'] * $Tariff['MemberCount'].' '.$ResidualSpeed.'<br />');
    6261      switch($Tariff['Category'])
    6362      {
     
    7372      }
    7473    }
    75     $Aggregation = $ResidualSpeed / $TotalMaxSpeed;
    76     //echo($TotalMaxSpeed.' '.$Aggregation.'<br />');
     74    if($TotalMaxSpeed > 0) $Aggregation = $ResidualSpeed / $TotalMaxSpeed;
     75      else $Aggregation = 1;
    7776 
    7877    // Recalculate price
     
    8281      {
    8382        case 1:
    84           // 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.
     83          // Přepočítávání rychlostí koliduje s rozdílovým zapisováním stromu front do mikrotiku.
     84          // 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.
    8585          //$Tariff['InternetSpeedMin'] = round($Tariff['InternetSpeedMax'] * $Aggregation);
    8686          break;
     
    9090          break;
    9191      }
    92       //echo('MinSpeed: '.$Tariff['InternetSpeedMin'].'<br />');
    9392      $this->Database->update('Service', 'Id='.$Tariff['Id'],
    9493        array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1024),
     
    196195        $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$Id);
    197196        $Device = $DbResult2->fetch_assoc();
    198         //print_r($Device);
    199         //echo($Id.': '.$NetworkDevice.', '.$Device['Price'].', '.$Device['Users']."<br/>\n");
    200         $NetworkDevice += $Device['Price'] / $Device['Users'];
    201         $Consumption += $Device['Consumption'] / $Device['UsersOverheads'];
    202         //echo($ID.' '.$InternetSegment.' '.$InternetSegmentId.' '.$Row['inet_hw'].' '.$Price.'<br>');
     197        if($Device['Users'] > 0) $NetworkDevice += $Device['Price'] / $Device['Users'];
     198        if($Device['UsersOverheads'] > 0) $Consumption += $Device['Consumption'] / $Device['UsersOverheads'];
    203199        $Id = $Device['Parent'];
    204200      }
     
    210206      $DbRow = $DbResult2->fetch_assoc();     
    211207      $Monthly = 0;
    212       $MonthlyInet = $DbRow['Price'];
     208      if($DbRow['Price'] != '') $MonthlyInet = $DbRow['Price'];
     209        else $MonthlyInet = 0;
     210     
    213211      //if($Row['inet'] == 1)
    214212      $Monthly += $MonthlyInet;
     
    216214      $Monthly -= $Member['Hire'];
    217215      //if($Row['overheads'] == 1) $Monthly += $Sprava; // + W2Kc($Consumption);
    218       //echo($Row['fullname'].' '.$Row['inet'].' '.$Monthly.'<br>');
    219216      $Monthly = round($Monthly);
    220       //echo($Row['fullname'].' '.$Row['inet'].' '.$Monthly.'<br>')
    221217     
    222218      if($Member['BillingPeriodNext'] == 1)
     
    246242    while($NetworkSegment = $DbResult->fetch_array())
    247243    {
    248       //echo('Segment '.$Row['name'].'<br>');
    249244      $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
    250245      $RowP = $DbResult2->fetch_array();
     
    262257      while($ID != 0)
    263258      {
    264         //echo($ID.', ');
    265259        $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);
    266260        $Row4 = $DbResult2->fetch_array();
  • trunk/finance/user_state.php

    r486 r494  
    6363   
    6464    // Account state   
    65     $UserOperationTableQuery = '((SELECT Text, Time, Value AS Value, Bill, BillCode, NULL AS PeriodFrom, NULL AS PeriodTo '.
     65    $UserOperationTableQuery = '((SELECT Text, Time, Value AS Value, File, BillCode, NULL AS PeriodFrom, NULL AS PeriodTo '.
    6666      'FROM FinanceOperation WHERE (Subject='.$Subject['Id'].')) UNION ALL '.
    6767      '(SELECT (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoice=FinanceInvoice.Id) AS Text, '.
    68       'TimeCreation as Time, -Value as Value, Bill, BillCode, PeriodFrom, PeriodTo FROM FinanceInvoice WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1';
     68      'TimeCreation as Time, -Value as Value, File, BillCode, PeriodFrom, PeriodTo FROM FinanceInvoice WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1';
    6969    $DbResult = $this->Database->query('SELECT SUM(T1.Value) AS Total FROM '.$UserOperationTableQuery);
    7070    $DbRow = $DbResult->fetch_array();
     
    8787      if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
    8888      if($Row['BillCode'] == '') $Row['BillCode'] = 'PDF';
    89       if($Row['Bill'] > 0) $Invoice = '<a href="bill.php?Id='.$Row['Bill'].'">'.$Row['BillCode'].'</a>';
     89      if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/FileDownload.php?Id='.$Row['File']).'">'.$Row['BillCode'].'</a>';
    9090        else $Invoice = '&nbsp;';
    9191      if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
  • trunk/sql/updates/486.sql

    r486 r494  
    3737ALTER TABLE `FinanceInvoice` CHANGE `TimePayment` `TimePayment` DATETIME NULL DEFAULT NULL ;
    3838ALTER TABLE `FinanceInvoice` CHANGE `Bill` `File` INT( 11 ) NULL DEFAULT NULL;
    39 ALTER TABLE `FinanceInvoice` DROP FOREIGN KEY `FinanceInvoice_ibfk_1` ,
     39-- ALTER TABLE `FinanceInvoice` DROP FOREIGN KEY `FinanceInvoice_ibfk_1` ,
    4040UPDATE `FinanceInvoice` SET `File` = NULL WHERE `File`=0;
    4141UPDATE `FinanceInvoice` SET File=NULL WHERE (NOT EXISTS (SELECT `Id` FROM `File` WHERE `File`.`Id` = `FinanceInvoice`.`File`));
Note: See TracChangeset for help on using the changeset viewer.