Changeset 444 for trunk/finance/finance.php
- Timestamp:
- Oct 14, 2012, 10:27:19 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r419 r444 170 170 $Cash = $Cash[0]; 171 171 172 $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE (User='.$Member['Id'].') AND ( used = 1)');172 $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE (User='.$Member['Id'].') AND (Used = 1)'); 173 173 $ConsumptionPlus = $DbResult2->fetch_row(); 174 174 $ConsumptionPlus = $ConsumptionPlus[0]; … … 176 176 $NetworkDevice = 0; 177 177 $Consumption = 0; 178 $I D= $Member['NetworkSegment'];179 while( $ID != '')180 { 181 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$I D);178 $Id = $Member['NetworkSegment']; 179 while(($Id != '') and ($Id != 0)) 180 { 181 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$Id); 182 182 $Device = $DbResult2->fetch_assoc(); 183 //print_r($Device); 184 //echo($Id.': '.$NetworkDevice.', '.$Device['Price'].', '.$Device['Users']."<br/>\n"); 183 185 $NetworkDevice += $Device['Price'] / $Device['Users']; 184 186 $Consumption += $Device['Consumption'] / $Device['UsersOverheads']; 185 187 //echo($ID.' '.$InternetSegment.' '.$InternetSegmentId.' '.$Row['inet_hw'].' '.$Price.'<br>'); 186 $I D= $Device['Parent'];188 $Id = $Device['Parent']; 187 189 } 188 190 … … 206 208 $Consumption = 0; 207 209 } 208 $this->Database->insert('MemberPayment', array('Member' => $Member['Id'], 'NetworkDevice' => $NetworkDevice, 'MonthlyInternet' => $MonthlyInet, 'MonthlyTotal' => $Monthly, 'MonthlyConsumption' => $this->W2Kc($Consumption), 'Cash' => $Cash, 'MonthlyPlus' => $this->W2Kc($ConsumptionPlus))); 210 $this->Database->insert('MemberPayment', array('Member' => $Member['Id'], 211 'NetworkDevice' => $NetworkDevice, 'MonthlyInternet' => $MonthlyInet, 212 'MonthlyTotal' => $Monthly, 'MonthlyConsumption' => $this->W2Kc($Consumption), 213 'Cash' => $Cash, 'MonthlyPlus' => $this->W2Kc($ConsumptionPlus))); 209 214 } 210 215 $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateMemberPayment'); … … 238 243 $Row4 = $DbResult2->fetch_array(); 239 244 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0]))); 240 $ID = $Row4[' parent'];245 $ID = $Row4['Parent']; 241 246 } 242 247 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
Note:
See TracChangeset
for help on using the changeset viewer.