Changeset 408


Ignore:
Timestamp:
Oct 4, 2012, 8:29:32 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Přejmenována sql tabulka network_segments na NetworkSegment.
Location:
trunk
Files:
1 added
3 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r407 r408  
    113113   
    114114    $this->SpravaUsers = $this->InternetUsers;
    115     $DbResult = $this->Database->query('SELECT SUM(consumption) FROM network_segments');
     115    $DbResult = $this->Database->query('SELECT SUM(Consumption) FROM NetworkSegment');
    116116    $TotalConsumption = $DbResult->fetch_array();
    117117    $this->TotalConsumption = $TotalConsumption[0];
     
    172172      $Consumption = 0;
    173173      $ID = $Member['NetworkSegment'];
    174       while($ID != 0)
    175       {
    176         $DbResult2 = $this->Database->query('SELECT * FROM `network_segments` WHERE `id`='.$ID);
     174      while($ID != 'NULL')
     175      {
     176        $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$ID);
    177177        $Device = $DbResult2->fetch_assoc();
    178         $NetworkDevice += $Device['price'] / $Device['users'];
    179         $Consumption += $Device['consumption'] / $Device['users_overheads'];
     178        $NetworkDevice += $Device['Price'] / $Device['Users'];
     179        $Consumption += $Device['Consumption'] / $Device['UsersOverheads'];
    180180        //echo($ID.' '.$InternetSegment.' '.$InternetSegmentId.' '.$Row['inet_hw'].' '.$Price.'<br>');
    181         $ID = $Device['parent'];
     181        $ID = $Device['Parent'];
    182182      }
    183183   
     
    212212  {
    213213    $Output = 'Aktualizuji parametry segmentů...<br />';
    214     $this->Database->query('UPDATE `network_segments` SET `users` = 0, `users_overheads` = 0');     // Vynulovat počty uživatelů
    215     $DbResult = $this->Database->query('SELECT * FROM `network_segments`');
     214    $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0');     // Vynulovat počty uživatelů
     215    $DbResult = $this->Database->query('SELECT * FROM `NetworkSegments`');
    216216    while($NetworkSegment = $DbResult->fetch_array())
    217217    {
    218218      //echo('Segment '.$Row['name'].'<br>');
    219       $DbResult2 = $this->Database->query('SELECT `users` FROM `network_segments` WHERE `id`='.$NetworkSegment['id']);
     219      $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
    220220      $RowP = $DbResult2->fetch_array();
    221       $DbResult2 = $this->Database->query('SELECT `users_overheads` FROM `network_segments` WHERE `id`='.$NetworkSegment['id']);
     221      $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
    222222      $RowP2 = $DbResult2->fetch_array();
    223223
    224       $DbResult2 = $this->Database->query('SELECT SUM(price) as Price, SUM(consumption) as Consumption FROM network_devices WHERE segment='.$NetworkSegment['id'].' AND used=1');
     224      $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM NetworkDevice WHERE Segment='.$NetworkSegment['Id'].' AND Used=1');
    225225      $Row2 = $DbResult2->fetch_array();
    226226      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['id']);
     
    230230      {
    231231        //echo($ID.', ');
    232         $DbResult2 = $this->Database->query('SELECT * FROM network_segments WHERE id='.$ID);
     232        $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);
    233233        $Row4 = $DbResult2->fetch_array();
    234         $this->Database->update('network_segments', 'id='.$Row4['id'], array('users' => ($Row4['users'] + $Row3[0]), 'users_overheads' => ($Row4['users_overheads'] + $Row3[0])));
     234        $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
    235235        $ID = $Row4['parent'];
    236236      }
    237       $this->Database->update('network_segments', 'id='.$NetworkSegment['id'], array('price' => $Row2['Price'], 'users' => ($Row3[0] + $RowP['users']), 'consumption' => $Row2['Consumption'], 'users_overheads' => ($Row3[0] + $RowP2['users_overheads'])));
     237      $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
    238238    }
    239239
     
    241241    $DbResult = $this->Database->select('Member', 'COUNT(*)');
    242242    $Row = $DbResult->fetch_array();
    243     $DbResult = $this->Database->update('network_segments','id='.$this->InternetSegmentId, array('users' => $Row[0], 'users_overheads' => $Row[0]));
     243    $DbResult = $this->Database->update('NetworkSegments', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
    244244    $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
    245245    return($Output);
  • trunk/finance/manage.php

    r407 r408  
    299299    $Output .= 'Celková cena zařízení: Zařízení('.$TotalDeviceCost;
    300300   
    301     $DbResult = $this->Database->query('SELECT SUM(price) FROM network_segments');
     301    $DbResult = $this->Database->query('SELECT SUM(Price) FROM NetworkSegment');
    302302    $Row = $DbResult->fetch_row();
    303303    $TotalSegmentDeviceCost = $Row[0];
  • trunk/finance/spotreba.php

    r167 r408  
    1414    $Output = 'Spotřeba zařízení jednotlivých segmentů:<div align="center"><table class="WideTable"><tr><th>Jméno segmentu</th><th>Spotřeba [W]</th><th>Cena [Kč/měsíc]</th></tr>';
    1515    $CelkovaSpotreba = 0;
    16     $DbResult = $this->Database->query("SELECT * FROM network_segments");
     16    $DbResult = $this->Database->query("SELECT * FROM NetworkSegment");
    1717    while($Row = $DbResult->fetch_array())
    1818    {
    19       $DbResult2 = $this->Database->query("SELECT SUM(consumption) FROM network_devices WHERE segment=".$Row['id']." AND used=1");
     19      $DbResult2 = $this->Database->query("SELECT SUM(consumption) FROM network_devices WHERE Segment=".$Row['Id']." AND Used=1");
    2020      $Row2 = $DbResult2->fetch_array();
    2121      $CelkovaSpotreba = $CelkovaSpotreba + $Row2[0];
    22       $Output .= '<tr><td>'.$Row['name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>';
     22      $Output .= '<tr><td>'.$Row['Name'].'</td><td align="right">'.$Row2[0].'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($Row2[0]).'</td></tr>';
    2323    }
    2424    $Output .= '<tr style="font-weight: Bold;"><td><strong>Celkem</strong></td><td align="right">'.$CelkovaSpotreba.'</td><td align="right">'.$this->System->Modules['Finance']->W2Kc($CelkovaSpotreba).'</td></tr>';
  • trunk/finance/zarizeni.php

    r195 r408  
    1111    // Seznam segmentů a zařízení
    1212    $Output = 'Seznam segmentů a zařízení:<br><table style="font-size: smaller;" class="WideTable"><tr><th>Název</th><th>Spotřeba<br>[W]</th><th>Datum<br>zakoupení</th><th>Cena [Kč]</th></tr>';
    13     $DbResult = $this->Database->query('SELECT * FROM network_segments');   
     13    $DbResult = $this->Database->query('SELECT * FROM NetworkSegment');   
    1414    while($Row = $DbResult->fetch_array())
    1515    {
    16       $Output .= '<tr><td style="text-align: left" colspan="3"><strong>Segment: '.$Row['name'].' ('.$Row['users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Row['price'].'</td></tr>';
    17       $DbResult2 = $this->Database->query('SELECT * FROM network_devices WHERE segment='.$Row['id'].' AND used=1');
     16      $Output .= '<tr><td style="text-align: left" colspan="3"><strong>Segment: '.$Row['Name'].' ('.$Row['Users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Row['Price'].'</td></tr>';
     17      $DbResult2 = $this->Database->query('SELECT * FROM network_devices WHERE segment='.$Row['Id'].' AND used=1');
    1818      while($Row = $DbResult2->fetch_array())
    1919      {
    20         $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'.$Row['name'].'</td><td align="right">'.$Row['consumption'].'</td><td align="right">'.HumanDate($Row['date']).'</td><td align="right">'.$Row['price'].'</td></tr>';
     20        $Output .= '<tr><td style="text-align: left; padding-left: 20px;">'.$Row['Name'].'</td><td align="right">'.$Row['consumption'].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td align="right">'.$Row['Price'].'</td></tr>';
    2121      }
    2222    }
  • trunk/form_classes.php

    r309 r408  
    205205  'TNetworkSegment' => array(
    206206    'Type' => 'Reference',
    207     'Table' => 'network_segments',
     207    'Table' => 'NetworkSegment',
    208208    'Id' => 'id',
    209209    'Name' => 'name',
Note: See TracChangeset for help on using the changeset viewer.