Changeset 164 for www/finance/zivnost.php
- Timestamp:
- Feb 21, 2009, 11:04:42 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/zivnost.php
r157 r164 7 7 var $ShortTitle = 'Daňová evidence'; 8 8 9 function TransformFinance()9 /*function TransformFinance() 10 10 { 11 11 //$Database->Query('SELECT user as Subject, date as TimeCreation, date as TimeDue, date as TimePayment, -money as Value, bill_id as Bill, comment as Text FROM `finance_operations` WHERE Comment LIKE "Poplatek za měsíc%" AND date >= "2007-12-01"'); … … 26 26 } 27 27 } 28 } 28 }*/ 29 29 30 30 function Show() … … 156 156 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 157 157 $Output .= '<tr><th>Čas</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>'; 158 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceCashFlow JOIN users ON users.id = FinanceCashFlow.Subject ORDER BY Time');158 $DbResult = $this->Database->query('SELECT * FROM FinanceCashFlow JOIN Subject ON Subject.Id = FinanceCashFlow.Subject ORDER BY Time'); 159 159 while($Row = $DbResult->fetch_array()) 160 160 { … … 168 168 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 169 169 $Output .= '<tr><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>'; 170 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceClaimsLiabilities JOIN users ON users.id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation');170 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation'); 171 171 while($Row = $DbResult->fetch_array()) 172 172 { … … 179 179 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 180 180 $Output .= '<tr><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>'; 181 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceClaimsLiabilities JOIN users ON users.id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation');181 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation'); 182 182 while($Row = $DbResult->fetch_array()) 183 183 { … … 192 192 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 193 193 $Output .= '<tr><th>Subjekt</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas uzavření</th></tr>'; 194 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceAdvances JOIN users ON users.id = FinanceAdvances.Subject WHERE Direction = "In" ORDER BY TimeCreation');194 $DbResult = $this->Database->query('SELECT * FROM FinanceAdvances JOIN Subject ON Subject.Id = FinanceAdvances.Subject WHERE Direction = "In" ORDER BY TimeCreation'); 195 195 while($Row = $DbResult->fetch_array()) 196 196 { … … 203 203 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 204 204 $Output .= '<tr><th>Subjekt</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas uzavření</th></tr>'; 205 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceAdvances JOIN users ON users.id = FinanceAdvances.Subject WHERE Direction = "Out" ORDER BY TimeCreation');205 $DbResult = $this->Database->query('SELECT * FROM FinanceAdvances JOIN Subject ON Subject.Id = FinanceAdvances.Subject WHERE Direction = "Out" ORDER BY TimeCreation'); 206 206 while($Row = $DbResult->fetch_array()) 207 207 { … … 215 215 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 216 216 $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>Zálohy [Kč]</th><th>Stav účtu</th><th>Starý systém</th></tr>'; 217 $DbResult = $this->Database->query('SELECT id, CONCAT(users.second_name, " ", users.first_name) as Fullname, cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM users ORDER BY fullname');217 $DbResult = $this->Database->query('SELECT Id, Name, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject ORDER BY Name'); 218 218 while($Row = $DbResult->fetch_array()) 219 219 { 220 220 $Advances = ($Row['AdvancesIn'] - $Row['AdvancesOut']); 221 $Output .= '<tr><td><a href="?table=SubjectAccount&Id='.$Row[' id'].'">'.$Row['Fullname'].'</a></td><td>'.$Row['Liabilities'].'/'.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].'/'.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.$Advances.'</td><td>'.($Advances - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities'])).'</td><td>'.$Row['cash'].'</td></tr>';221 $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>'.$Advances.'</td><td>'.($Advances - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities'])).'</td><td>'.$Row['Cash'].'</td></tr>'; 222 222 } 223 223 $Output .= '</table>'; … … 265 265 $Output .= '</table>'; 266 266 267 $DbResult = $this->Database->query('SELECT id, CONCAT(users.second_name, " ", users.first_name) as Fullname, cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM users WHERE id='.$_GET['Id']);267 $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject WHERE Id='.$_GET['Id']); 268 268 $Row = $DbResult->fetch_array(); 269 269 $Output .= 'Stav placení: '.($Row['AdvancesIn'] - $Row['AdvancesOut'] - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
Note:
See TracChangeset
for help on using the changeset viewer.