Changeset 167 for www/finance/prepocet.php
- Timestamp:
- Mar 24, 2009, 11:44:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/prepocet.php
r164 r167 11 11 $Finance = &$this->System->Modules['Finance']; 12 12 $Output = 'Aktualizuju finance uživatelů...<br />'; 13 $this->Database->query('TRUNCATE TABLE MemberPayment');13 $this->Database->query('TRUNCATE TABLE MemberPayment'); 14 14 $DbResult = $this->Database->query('SELECT * FROM Member'); 15 15 while($Member = $DbResult->fetch_assoc()) 16 16 { 17 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(Value), 0) FROM Finance CashFlowWHERE Subject='.$Member['Subject'].') + (SELECT COALESCE(SUM(-Value), 0) FROM FinanceClaimsLiabilities WHERE Subject='.$Member['Subject'].')) as Cash');17 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation WHERE Subject='.$Member['Subject'].') + (SELECT COALESCE(SUM(-Value), 0) FROM FinanceClaimsLiabilities WHERE Subject='.$Member['Subject'].')) as Cash'); 18 18 $Cash = $DbResult2->fetch_row(); 19 $Cash = $Cash[0];19 $Cash = $Cash[0]; 20 20 21 21 $DbResult2 = $this->Database->query('SELECT SUM(consumption) FROM network_devices WHERE user='.$Member['Id'].' AND used=1'); 22 22 $ConsumptionPlus = $DbResult2->fetch_row(); 23 $ConsumptionPlus = $ConsumptionPlus[0];23 $ConsumptionPlus = $ConsumptionPlus[0]; 24 24 25 25 $NetworkDevice = 0; … … 39 39 $MonthlyInet = $Finance->Tarify[$Member['InternetTariffNextMonth']]['price']; 40 40 //if($Row['inet'] == 1) 41 $Monthly += $MonthlyInet;41 $Monthly += $MonthlyInet; 42 42 $Monthly -= $Finance->W2Kc($ConsumptionPlus); 43 43 //if($Row['overheads'] == 1) $Monthly += $Sprava; // + W2Kc($Consumption); … … 196 196 $BillCode = $Finance->GetNextDocumentLineNumber(6); // Faktury vydané 197 197 $BillId = $this->System->Modules['Bill']->CreateBill($User['Id'], array(array('Description' => 'Připojení k síti', 'Price' => $PayPerPeriod, 'Quantity' => 1)), $PeriodFrom, $PeriodTo, $BillCode); 198 $this->Database->insert(' finance_operations', array('money' => -$PayPerPeriod, 'user' => $User['Id'], 'type' => 2, 'date' => 'NOW()', 'comment' => 'Připojení k síti za období '.$TimePeriodText, 'group' => 1, 'bill_id' => $BillId, 'BillCode' => $BillCode));198 $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 'Subject' => $User['Id'], 'TimeCreation' => 'NOW()', 'Text' => 'Připojení k síti za období '.$TimePeriodText, 'Bill' => $BillId, 'BillCode' => $BillCode)); 199 199 } else $Output .= ("<br />"); 200 200 }
Note:
See TracChangeset
for help on using the changeset viewer.