Ignore:
Timestamp:
Oct 4, 2012, 10:12:08 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Vazba tabulky User na Member oddělena do samostatné tabulky jako vztah N:N.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r409 r410  
    172172      $Consumption = 0;
    173173      $ID = $Member['NetworkSegment'];
    174       while($ID != 'NULL')
     174      while($ID != '')
    175175      {
    176176        $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$ID);
     
    213213    $Output = 'Aktualizuji parametry segmentů...<br />';
    214214    $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0');     // Vynulovat počty uživatelů
    215     $DbResult = $this->Database->query('SELECT * FROM `NetworkSegments`');
     215    $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`');
    216216    while($NetworkSegment = $DbResult->fetch_array())
    217217    {
     
    222222      $RowP2 = $DbResult2->fetch_array();
    223223
    224       $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM NetworkDevice WHERE Segment='.$NetworkSegment['Id'].' AND Used=1');
     224      $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM Product WHERE Segment='.$NetworkSegment['Id'].' AND Used=1');
    225225      $Row2 = $DbResult2->fetch_array();
    226       $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['id']);
     226      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']);
    227227      $Row3 = $DbResult2->fetch_array();
    228       $ID = $NetworkSegment['parent'];
     228      $ID = $NetworkSegment['Parent'];
    229229      while($ID != 0)
    230230      {
     
    241241    $DbResult = $this->Database->select('Member', 'COUNT(*)');
    242242    $Row = $DbResult->fetch_array();
    243     $DbResult = $this->Database->update('NetworkSegments', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
     243    $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
    244244    $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
    245245    return($Output);
Note: See TracChangeset for help on using the changeset viewer.