Changeset 408
- Timestamp:
- Oct 4, 2012, 8:29:32 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r407 r408 113 113 114 114 $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'); 116 116 $TotalConsumption = $DbResult->fetch_array(); 117 117 $this->TotalConsumption = $TotalConsumption[0]; … … 172 172 $Consumption = 0; 173 173 $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); 177 177 $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']; 180 180 //echo($ID.' '.$InternetSegment.' '.$InternetSegmentId.' '.$Row['inet_hw'].' '.$Price.'<br>'); 181 $ID = $Device[' parent'];181 $ID = $Device['Parent']; 182 182 } 183 183 … … 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 `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0'); // Vynulovat počty uživatelů 215 $DbResult = $this->Database->query('SELECT * FROM `NetworkSegments`'); 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 `NetworkSegment` 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 `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']); 222 222 $RowP2 = $DbResult2->fetch_array(); 223 223 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'); 225 225 $Row2 = $DbResult2->fetch_array(); 226 226 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['id']); … … 230 230 { 231 231 //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); 233 233 $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]))); 235 235 $ID = $Row4['parent']; 236 236 } 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']))); 238 238 } 239 239 … … 241 241 $DbResult = $this->Database->select('Member', 'COUNT(*)'); 242 242 $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])); 244 244 $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters'); 245 245 return($Output); -
trunk/finance/manage.php
r407 r408 299 299 $Output .= 'Celková cena zařízení: Zařízení('.$TotalDeviceCost; 300 300 301 $DbResult = $this->Database->query('SELECT SUM( price) FROM network_segments');301 $DbResult = $this->Database->query('SELECT SUM(Price) FROM NetworkSegment'); 302 302 $Row = $DbResult->fetch_row(); 303 303 $TotalSegmentDeviceCost = $Row[0]; -
trunk/finance/spotreba.php
r167 r408 14 14 $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>'; 15 15 $CelkovaSpotreba = 0; 16 $DbResult = $this->Database->query("SELECT * FROM network_segments");16 $DbResult = $this->Database->query("SELECT * FROM NetworkSegment"); 17 17 while($Row = $DbResult->fetch_array()) 18 18 { 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"); 20 20 $Row2 = $DbResult2->fetch_array(); 21 21 $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>'; 23 23 } 24 24 $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 11 11 // Seznam segmentů a zařízení 12 12 $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'); 14 14 while($Row = $DbResult->fetch_array()) 15 15 { 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'); 18 18 while($Row = $DbResult2->fetch_array()) 19 19 { 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>'; 21 21 } 22 22 } -
trunk/form_classes.php
r309 r408 205 205 'TNetworkSegment' => array( 206 206 'Type' => 'Reference', 207 'Table' => ' network_segments',207 'Table' => 'NetworkSegment', 208 208 'Id' => 'id', 209 209 'Name' => 'name',
Note:
See TracChangeset
for help on using the changeset viewer.