Changeset 379 for trunk/Modules/Finance/Finance.php
- Timestamp:
- Jan 20, 2012, 9:17:37 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Finance.php
r378 r379 398 398 399 399 $this->SpravaUsers = $this->InternetUsers; 400 $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegment s`');400 $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegment`'); 401 401 $TotalConsumption = $DbResult->fetch_array(); 402 402 $this->TotalConsumption = $TotalConsumption[0]; … … 459 459 while($ID != 0) 460 460 { 461 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment s` WHERE `Id`='.$ID);461 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$ID); 462 462 $Device = $DbResult2->fetch_assoc(); 463 463 $NetworkDevice += $Device['Price'] / $Device['Users']; … … 497 497 { 498 498 $Output = 'Aktualizuji parametry segmentů...<br />'; 499 $this->Database->query('UPDATE `NetworkSegment s` SET `Users` = 0, `UsersOverheads` = 0'); // Vynulovat počty uživatelů500 $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment s`');499 $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0'); // Vynulovat počty uživatelů 500 $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`'); 501 501 while($NetworkSegment = $DbResult->fetch_array()) 502 502 { 503 503 //echo('Segment '.$Row['name'].'<br>'); 504 $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment s` WHERE `Id`='.$NetworkSegment['Id']);504 $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']); 505 505 $RowP = $DbResult2->fetch_array(); 506 $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment s` WHERE `Id`='.$NetworkSegment['Id']);506 $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']); 507 507 $RowP2 = $DbResult2->fetch_array(); 508 508 … … 515 515 { 516 516 //echo($ID.', '); 517 $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment sWHERE Id='.$ID);517 $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID); 518 518 $Row4 = $DbResult2->fetch_array(); 519 $this->Database->update('NetworkSegment s', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));519 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0]))); 520 520 $ID = $Row4['Parent']; 521 521 } 522 $this->Database->update('NetworkSegment s', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));522 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads']))); 523 523 } 524 524 … … 526 526 $DbResult = $this->Database->select('Member', 'COUNT(*)'); 527 527 $Row = $DbResult->fetch_array(); 528 $DbResult = $this->Database->update('NetworkSegment s', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));528 $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0])); 529 529 $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters'); 530 530 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.