Changeset 497 for trunk/finance/finance.php
- Timestamp:
- Mar 3, 2013, 1:03:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r494 r497 54 54 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` '. 55 55 'LEFT JOIN `ServiceCustomerRel` ON `ServiceCustomerRel`.`Customer`=`Member`.`Id` '. 56 'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) AND (`Member`.`Blocked`=0)'); 56 'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) '. 57 'AND (`Member`.`Blocked`=0)'); 57 58 $Row = $DbResult->fetch_row(); 58 59 $this->Tariffs[$Index]['CustomerCount'] = $Row[0]; … … 103 104 $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod; 104 105 105 $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE `Period`='.$Period); 106 // Period parameter is not used as it have to be determined from item replacement 107 $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE `ReplaceId` IS NULL LIMIT 1'); 106 108 $Row = $DbResult->fetch_array(); 107 109 $this->kWh = $Row['kWh']; … … 203 205 'FROM `ServiceCustomerRel` LEFT JOIN '. 204 206 '`Service` ON `Service`.`Id` = `ServiceCustomerRel`.`Service` WHERE `ServiceCustomerRel`.`Customer`='. 205 $Member['Id'].' AND `ServiceCustomerRel`.` Period`=1');207 $Member['Id'].' AND `ServiceCustomerRel`.`Action` IS NULL'); 206 208 $DbRow = $DbResult2->fetch_assoc(); 207 209 $Monthly = 0; … … 259 261 $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID); 260 262 $Row4 = $DbResult2->fetch_array(); 261 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0]))); 263 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], 264 array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0]))); 262 265 $ID = $Row4['Parent']; 263 266 } 264 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads']))); 267 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], 268 array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads']))); 265 269 } 266 270 … … 268 272 $DbResult = $this->Database->select('Member', 'COUNT(*)'); 269 273 $Row = $DbResult->fetch_array(); 270 $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0])); 274 $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, 275 array('Users' => $Row[0], 'UsersOverheads' => $Row[0])); 271 276 $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters'); 272 277 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.