Changeset 167 for www/finance/user_state.php
- Timestamp:
- Mar 24, 2009, 11:44:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/user_state.php
r165 r167 29 29 $DbResult = $this->Database->query('SELECT Id FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))'); 30 30 $Subject = $DbResult->fetch_assoc(); 31 $DbResult = $this->Database->query('SELECT * FROM Member JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Id=(SELECT Member FROM User WHERE User.Id='.$UserId.')');31 $DbResult = $this->Database->query('SELECT * FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Id=(SELECT Member FROM User WHERE User.Id='.$UserId.')'); 32 32 $Member = $DbResult->fetch_assoc(); 33 33 $TarifName = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['name']; … … 41 41 $Output .= '<table style="font-size: smaller;" class="WideTable"><tr><th>Datum</th><th>Popis</th><th>Částka</th><th>Doklad</th></tr>'; 42 42 $Operations = array(); 43 $DbResult = $this->Database->query('(SELECT Time, Value, Text, Bill FROM FinanceOperation WHERE (DestinationSubject='.$Subject['Id'].') AND (SourceSubject = '.$Finance->ExternalSubject.')) UNION ALL '. 44 '(SELECT Time, -Value as Value, Text, Bill FROM FinanceOperation WHERE (SourceSubject='.$Subject['Id'].') AND (DestinationSubject='.$Finance->MainSubject.')) UNION ALL '. 45 '(SELECT Time, -Value as Value, Text, Bill FROM FinanceOperation WHERE (SourceSubject='.$Subject['Id'].') AND (DestinationSubject='.$Finance->ExternalSubject.')) UNION ALL '. 46 '(SELECT Time, Value, Text, Bill FROM FinanceOperation WHERE (DestinationSubject='.$Subject['Id'].') AND (SourceSubject = '.$Finance->MainSubject.')) '. 47 'ORDER BY Time DESC'); 43 $UserOperationTableQuery = '((SELECT Text, Time, Value AS Value, Bill FROM FinanceOperation WHERE (Subject='.$Subject['Id'].')) UNION ALL '. 44 '(SELECT Text, TimeCreation as Time, -Value as Value, Bill FROM FinanceClaimsLiabilities WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1'; 45 $DbResult = $this->Database->query('SELECT T1.* FROM '.$UserOperationTableQuery); 48 46 while($DbRow = $DbResult->fetch_array()) 49 47 $Operations[] = $DbRow; … … 57 55 //echo('<tr><td> </td><td>-'.$Row2['network_device'].'</td><td>Proměnná cena za zařízení</td></tr> 58 56 $Output .= '</table>'; 59 $DbResult = $this->Database->query('SELECT ('. 60 '(SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation WHERE (DestinationSubject='.$Subject['Id'].') AND (SourceSubject = '.$Finance->ExternalSubject.')) - '. 61 '(SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation WHERE (SourceSubject='.$Subject['Id'].') AND (DestinationSubject='.$Finance->MainSubject.')) - '. 62 '(SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation WHERE (SourceSubject='.$Subject['Id'].') AND (DestinationSubject = '.$Finance->ExternalSubject.')) + '. 63 '(SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation WHERE (DestinationSubject='.$Subject['Id'].') AND (SourceSubject='.$Finance->MainSubject.'))) as Total'); 57 $DbResult = $this->Database->query('SELECT SUM(T1.Value) AS Total FROM '.$UserOperationTableQuery); 64 58 $DbRow = $DbResult->fetch_array(); 65 59 $Total = $DbRow['Total'];
Note:
See TracChangeset
for help on using the changeset viewer.