Changeset 327 for trunk/finance/finance.php
- Timestamp:
- Dec 17, 2011, 3:10:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r301 r327 25 25 var $BillingPeriods; 26 26 27 function LoadTariffs( $Period = 1)27 function LoadTariffs() 28 28 { 29 29 $this->Tariffs = array(); 30 $DbResult = $this->Database->select('FinanceTariff', '*', ' Period='.$Period.' ORDER BY Tariff,SpeedMax');30 $DbResult = $this->Database->select('FinanceTariff', '*', 'ReplaceId IS NULL ORDER BY SpeedMax'); 31 31 while($Tariff = $DbResult->fetch_array()) 32 32 { 33 33 $Tariff['SpeedMin'] = $Tariff['SpeedMin'] * 1024; 34 34 $Tariff['SpeedMax'] = $Tariff['SpeedMax'] * 1024; 35 $this->Tariffs[$Tariff[' Tariff']] = $Tariff;35 $this->Tariffs[$Tariff['Id']] = $Tariff; 36 36 } 37 37 } 38 38 39 function RecalculateTariffs( $Period = 1)39 function RecalculateTariffs() 40 40 { 41 41 $ResidualSpeed = $this->MaxSpeed * 1024; 42 42 43 $this->LoadTariffs( $Period);43 $this->LoadTariffs(); 44 44 45 45 $Column = array('Current', 'Next'); … … 48 48 foreach($this->Tariffs as $Index => $Tariff) 49 49 { 50 $DbResult = $this->Database->select('Member', 'COUNT(*)', 'InternetTariff '.$Column[$Period].'Month='.$Index.' AND (BillingPeriod > 1)');50 $DbResult = $this->Database->select('Member', 'COUNT(*)', 'InternetTariffCurrentMonth='.$Index.' AND (BillingPeriod > 1)'); 51 51 $Row = $DbResult->fetch_row(); 52 52 $this->Tariffs[$Index]['MemberCount'] = $Row[0]; … … 85 85 } 86 86 //echo('MinSpeed: '.$Tariff['SpeedMin'].'<br />'); 87 $this->Database->update('FinanceTariff', ' Tariff='.$Tariff['Tariff'], array('SpeedMin' => ($Tariff['SpeedMin'] / 1024), 'MemberCount' => $Tariff['MemberCount']));88 } 89 $this->LoadTariffs( $Period);87 $this->Database->update('FinanceTariff', 'Id='.$Tariff['Id'], array('SpeedMin' => ($Tariff['SpeedMin'] / 1024), 'MemberCount' => $Tariff['MemberCount'])); 88 } 89 $this->LoadTariffs(); 90 90 } 91 91 … … 174 174 while($ID != 0) 175 175 { 176 $DbResult2 = $this->Database->query('SELECT * FROM network_segments WHERE id='.$ID);176 $DbResult2 = $this->Database->query('SELECT * FROM `network_segments` WHERE `id`='.$ID); 177 177 $Device = $DbResult2->fetch_assoc(); 178 178 $NetworkDevice += $Device['price'] / $Device['users']; … … 212 212 { 213 213 $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 `network_segments` SET `users` = 0, `users_overheads` = 0'); // Vynulovat počty uživatelů 215 $DbResult = $this->Database->query('SELECT * FROM `network_segments`'); 216 216 while($NetworkSegment = $DbResult->fetch_array()) 217 217 { 218 218 //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 `network_segments` WHERE `id`='.$NetworkSegment['id']); 220 220 $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 `users_overheads` FROM `network_segments` WHERE `id`='.$NetworkSegment['id']); 222 222 $RowP2 = $DbResult2->fetch_array(); 223 223
Note:
See TracChangeset
for help on using the changeset viewer.