Changeset 182 for trunk/finance/zivnost.php
- Timestamp:
- Mar 25, 2009, 3:08:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/zivnost.php
r167 r182 197 197 $Output .= '<table style="font-size: smaller;" class="WideTable">'; 198 198 $Output .= '<tr><th>Jméno</th><th>Závazky [Kč]</th><th>Pohledávky [Kč]</th><th>Příjmy [Kč]</th><th>Výdaje [Kč]</th><th>Stav účtu</th><th>Starý systém</th></tr>'; 199 $DbResult = $this->Database->query('SELECT Id, Name, 0 AS Cash, (SELECT SUM(T1.Value) FROM FinanceOperation AS T1 WHERE T1.SourceSubject = Subject.Id AND T1.DestinationSubject = 71) as Claims, (SELECT SUM(T2.Value) FROM FinanceOperation AS T2 WHERE T2.SourceSubject = Subject.Id AND T2.DestinationSubject = 71 AND Time IS NULL) as OpenedClaims, (SELECT SUM(T3.Value) FROM FinanceOperation AS T3 WHERE T3.DestinationSubject = Subject.Id AND T3.SourceSubject = 71) as Liabilities, (SELECT SUM(T4.Value) FROM FinanceOperation AS T4 WHERE T4.DestinationSubject = Subject.Id AND T4.SourceSubject = 71 AND Time IS NULL) as OpenedLiabilities, (SELECT SUM(T5.Value) FROM FinanceOperation AS T5 WHERE T5.DestinationSubject = Subject.Id AND T5.SourceSubject = 96) as Gains, (SELECT SUM(T6.Value) FROM FinanceOperation AS T6 WHERE T6.SourceSubject = Subject.Id AND T6.DestinationSubject = 96) as Spends FROM Subject ORDER BY Name'); 199 $DbResult = $this->Database->query('SELECT Id, Name, 0 AS Cash, '. 200 '(SELECT SUM(T1.Value) FROM FinanceClaimsLiabilities AS T1 WHERE (T1.Subject = Subject.Id) AND (T1.Value > 0)) as Claims, '. 201 '(SELECT SUM(T2.Value) FROM FinanceClaimsLiabilities AS T2 WHERE (T2.Subject = Subject.Id) AND (T2.Value > 0) AND (TimePayment IS NULL)) as OpenedClaims, '. 202 '(SELECT -SUM(T3.Value) FROM FinanceClaimsLiabilities AS T3 WHERE (T3.Subject = Subject.Id) AND (T3.Value < 0)) as Liabilities, '. 203 '(SELECT -SUM(T4.Value) FROM FinanceClaimsLiabilities AS T4 WHERE (T4.Subject = Subject.Id) AND (T4.Value < 0) AND (TimePayment IS NULL)) AS OpenedLiabilities, '. 204 '(SELECT SUM(T5.Value) FROM FinanceOperation AS T5 WHERE (T5.Subject = Subject.Id) AND (T5.Value > 0)) AS Gains, '. 205 '(SELECT -SUM(T6.Value) FROM FinanceOperation AS T6 WHERE (T6.Subject = Subject.Id) AND (T6.Value < 0)) AS Spends '. 206 'FROM Subject ORDER BY Name'); 200 207 while($Row = $DbResult->fetch_assoc()) 201 208 { 202 $Output .= '<tr><td ><a href="?table=SubjectAccount&Id='.$Row['Id'].'">'.$Row['Name'].'</a></td><td>'.$Row['Liabilities'].'/'.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].'/'.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.($Row['Gains'] - $Row['Spends'] - $Row['Claims'] + $Row['Liabilities']).'</td><td>'.$Row['Cash'].'</td></tr>';209 $Output .= '<tr><td style="text-align: left;"><a href="?table=SubjectAccount&Id='.$Row['Id'].'">'.$Row['Name'].'</a></td><td>'.$Row['Liabilities'].' / '.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].' / '.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.($Row['Gains'] - $Row['Spends'] - $Row['Claims'] + $Row['Liabilities']).'</td><td>'.$Row['Cash'].'</td></tr>'; 203 210 } 204 211 $Output .= '</table>';
Note:
See TracChangeset
for help on using the changeset viewer.