Changeset 167 for www/finance/zivnost.php
- Timestamp:
- Mar 24, 2009, 11:44:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/zivnost.php
r165 r167 33 33 { 34 34 $Balance = array(); 35 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceOperation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND ( SourceSubject = '.$this->ExternalSubject.')');35 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceOperation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (Value > 0)'); 36 36 $Row = $DbResult->fetch_array(); 37 37 $Balance['Income']['Start'] = $Row[0] + 0; 38 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceOperation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND ( SourceSubject = '.$this->ExternalSubject.')');38 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceOperation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (Value > 0)'); 39 39 //echo('SELECT SUM(Value) FROM FinanceCashFlow WHERE Time <= "'.TimeToMysqlDateTime($EndTime).'" AND Value > 0 AND Taxable = 1'.'<br />'); 40 40 $Row = $DbResult->fetch_array(); 41 41 $Balance['Income']['End'] = $Row[0] + 0; 42 42 43 $DbResult = $this->Database->query('SELECT SUM( Value) FROM FinanceOperation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (DestinationSubject = '.$this->ExternalSubject.')');43 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceOperation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (Value < 0)'); 44 44 $Row = $DbResult->fetch_array(); 45 45 $Balance['Spend']['Start'] = $Row[0] + 0; 46 $DbResult = $this->Database->query('SELECT SUM( Value) FROM FinanceOperation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (DestinationSubject = '.$this->ExternalSubject.')');46 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceOperation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (Value < 0)'); 47 47 //echo('SELECT -SUM(Value) FROM FinanceCashFlow WHERE Time <= "'.TimeToMysqlDateTime($EndTime).'" AND Value < 0 AND Taxable = 1'.'<br />'); 48 48 $Row = $DbResult->fetch_array(); 49 49 $Balance['Spend']['End'] = $Row[0] + 0; 50 50 51 $DbResult = $this->Database->query('SELECT SUM(Value) FROM Finance Operation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (DestinationSubject = '.$this->MainSubject.')');51 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceClaimsLiabilities WHERE (TimeCreation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)'); 52 52 $Row = $DbResult->fetch_array(); 53 53 $Balance['Claims']['Start'] = $Row[0] + 0; 54 $DbResult = $this->Database->query('SELECT SUM(Value) FROM Finance Operation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (DestinationSubject = '.$this->MainSubject.')');54 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceClaimsLiabilities WHERE (TimeCreation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)'); 55 55 $Row = $DbResult->fetch_array(); 56 56 $Balance['Claims']['End'] = $Row[0] + 0; 57 57 58 $DbResult = $this->Database->query('SELECT SUM( Value) FROM FinanceOperation WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (SourceSubject = '.$this->MainSubject.')');58 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceClaimsLiabilities WHERE (TimeCreation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)'); 59 59 $Row = $DbResult->fetch_array(); 60 60 $Balance['Liabilities']['Start'] = $Row[0] + 0; 61 $DbResult = $this->Database->query('SELECT SUM( Value) FROM FinanceOperation WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (SourceSubject = '.$this->MainSubject.')');61 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceClaimsLiabilities WHERE (TimeCreation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)'); 62 62 $Row = $DbResult->fetch_array(); 63 63 $Balance['Liabilities']['End'] = $Row[0] + 0; … … 71 71 $Row = $DbResult->fetch_array(); 72 72 $Balance['SmallAssets']['End'] = $Row[0] + 0; 73 return($Balance);73 return($Balance); 74 74 } 75 75 76 76 function Show() 77 77 { 78 if(!$this->System->Modules['User']->CheckPermission('Finance', 'TradingStatus')) return('Nemáte oprávnění'); 78 79 $this->System->Modules['Finance']->RecalculateTariffs(1); 79 80 //TransformFinance(); … … 157 158 case 'CashFlow': 158 159 $Table = array('Ne', 'Ano'); 159 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';160 $Output .= '<table style="font-size: smaller;" class="WideTable">'; 160 161 $Output .= '<tr><th>Čas</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>'; 161 $DbResult = $this->Database->query('SELECT * FROM FinanceCashFlow JOIN Subject ON Subject.Id = FinanceCashFlow.Subject ORDER BY Time'); 162 while($Row = $DbResult->fetch_array()) 163 { 162 $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject ORDER BY Time'); 163 while($Row = $DbResult->fetch_array()) 164 { 165 $Row['Time'] = explode(' ', $Row['Time']); 166 $Row['Time'] = $Row['Time'][0]; 164 167 $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Table[$Row['Taxable']].'</td><td>'.$Table[$Row['Cash']].'</td></tr>'; 165 168 } … … 169 172 $Output .= '<table width="100%"><tr><td valign="top">'; 170 173 $Output .= '<strong>Pohledávky</strong>'; 171 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';174 $Output .= '<table style="font-size: smaller;" class="WideTable">'; 172 175 $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>'; 173 176 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation'); … … 180 183 181 184 $Output .= '<strong>Závazky</strong>'; 182 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';185 $Output .= '<table style="font-size: smaller;" class="WideTable">'; 183 186 $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>'; 184 187 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation');
Note:
See TracChangeset
for help on using the changeset viewer.