Ignore:
Timestamp:
Feb 21, 2009, 11:04:42 AM (16 years ago)
Author:
george
Message:
  • Opraveno: Mazání položek ze seznamu online uživatelů.
  • Upraveno: Zobrazování členů sítě správcům financí.
  • Opraveno: Další menší opravy v souvislosti s předěláváním tabulky users.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/finance/zivnost.php

    r157 r164  
    77  var $ShortTitle = 'Daňová evidence';
    88
    9   function TransformFinance()
     9  /*function TransformFinance()
    1010  {
    1111    //$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"');
     
    2626      }
    2727    }
    28   }
     28  }*/
    2929
    3030  function Show()
     
    156156        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    157157        $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');
    159159        while($Row = $DbResult->fetch_array())
    160160        {
     
    168168        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    169169        $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');
    171171        while($Row = $DbResult->fetch_array())
    172172        {
     
    179179        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    180180        $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');
    182182        while($Row = $DbResult->fetch_array())
    183183        {
     
    192192        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    193193        $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');
    195195        while($Row = $DbResult->fetch_array())
    196196        {
     
    203203        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    204204        $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');
    206206        while($Row = $DbResult->fetch_array())
    207207        {
     
    215215        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    216216        $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');
    218218        while($Row = $DbResult->fetch_array())
    219219        {
    220220          $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>';
    222222        }
    223223        $Output .= '</table>';
     
    265265        $Output .= '</table>';
    266266
    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']);
    268268        $Row = $DbResult->fetch_array();
    269269        $Output .= 'Stav placení: '.($Row['AdvancesIn'] - $Row['AdvancesOut'] - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
Note: See TracChangeset for help on using the changeset viewer.