Changeset 397


Ignore:
Timestamp:
Mar 11, 2012, 9:53:42 AM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Rozdělení příjmů, výdajů, pohledávek a závazků do samostatných tabulek rozlišených dle roků.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/zivnost.php

    r338 r397  
    156156        $Output .= '</table>';
    157157        break;
    158       case 'CashFlow':
     158      case 'Incomes':
    159159        $Table = array('Ne', 'Ano');
    160         $Output .= '<table style="font-size: smaller;" class="WideTable">';
    161         $Output .= '<tr><th>Čas</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';
    162         $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject ORDER BY Time');
     160        $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$_GET['year']);
     161        $Year = $DbResult->fetch_assoc();
     162       
     163        $Output .= '<strong>Příjmy za rok '.$Year['Year'].'</strong>';
     164        $Output .= '<table style="font-size: smaller;" class="WideTable">';
     165        $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';       
     166        $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject '.
     167          'WHERE (Value > 0) AND (FinanceOperation.Time >= "'.$Year['DateStart'].'") AND (FinanceOperation.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
    163168        while($Row = $DbResult->fetch_array())
    164169        {
    165170          $Row['Time'] = explode(' ', $Row['Time']);
    166171          $Row['Time'] = $Row['Time'][0];
    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>';
    168         }
    169         $Output .= '</table>';
    170         break;
    171       case 'ClaimsLiabilities':
    172         $Output .= '<table width="100%"><tr><td valign="top">';
    173         $Output .= '<strong>Pohledávky</strong>';
    174         $Output .= '<table style="font-size: smaller;" class="WideTable">';
    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>';
    176         $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation');
     172          $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Table[$Row['Taxable']].'</td><td>'.$Table[$Row['Cash']].'</td></tr>';
     173        }
     174        $Output .= '</table>';
     175        break;
     176      case 'Expenses':
     177        $Table = array('Ne', 'Ano');
     178        $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$_GET['year']);
     179        $Year = $DbResult->fetch_assoc();
     180       
     181        $Output .= '<strong>Výdaje za rok '.$Year['Year'].'</strong>';
     182        $Output .= '<table style="font-size: smaller;" class="WideTable">';
     183        $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';       
     184        $DbResult = $this->Database->query('SELECT * FROM FinanceOperation LEFT JOIN Subject ON Subject.Id = FinanceOperation.Subject '.
     185          'WHERE (Value < 0) AND (FinanceOperation.Time >= "'.$Year['DateStart'].'") AND (FinanceOperation.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
     186        while($Row = $DbResult->fetch_array())
     187        {
     188          $Row['Time'] = explode(' ', $Row['Time']);
     189          $Row['Time'] = $Row['Time'][0];
     190          $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Table[$Row['Taxable']].'</td><td>'.$Table[$Row['Cash']].'</td></tr>';
     191        }
     192        $Output .= '</table>';
     193        break;
     194      case 'Claims':
     195        $Table = array('Ne', 'Ano');
     196        $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$_GET['year']);
     197        $Year = $DbResult->fetch_assoc();
     198       
     199        $Output .= '<strong>Pohledávky za rok '.$Year['Year'].'</strong>';
     200        $Output .= '<table style="font-size: smaller;" class="WideTable">';
     201        $Output .= '<tr><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>';
     202        $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject '.
     203          'WHERE (Value > 0) AND (FinanceClaimsLiabilities.TimeCreation >= "'.$Year['DateStart'].'") AND (FinanceClaimsLiabilities.TimeCreation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');
    177204        while($Row = $DbResult->fetch_array())
    178205        {
    179206          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    180           $Output .= '<tr><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimeDue'].'</td><td>'.$Row['TimePayment'].'</td></tr>';
    181         }
    182         $Output .= '</table></td><td valign="top">';
    183 
    184         $Output .= '<strong>Závazky</strong>';
    185         $Output .= '<table style="font-size: smaller;" class="WideTable">';
    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>';
    187         $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation');
     207          $Output .= '<tr><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimeDue'].'</td><td>'.$Row['TimePayment'].'</td></tr>';
     208        }
     209        $Output .= '</table>';
     210        break;
     211     case 'Liabilities':
     212        $Table = array('Ne', 'Ano');
     213        $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$_GET['year']);
     214        $Year = $DbResult->fetch_assoc();
     215
     216        $Output .= '<strong>Závazky za rok '.$Year['Year'].'</strong>';
     217        $Output .= '<table style="font-size: smaller;" class="WideTable">';
     218        $Output .= '<tr><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>';
     219        $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject '.
     220          'WHERE (Value < 0) AND (FinanceClaimsLiabilities.TimeCreation >= "'.$Year['DateStart'].'") AND (FinanceClaimsLiabilities.TimeCreation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');
    188221        while($Row = $DbResult->fetch_array())
    189222        {
    190223          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    191           $Output .= '<tr><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimeDue'].'</td><td>'.$Row['TimePayment'].'</td></tr>';
    192         }
    193         $Output .= '</table></td></tr></table>';
     224          $Output .= '<tr><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimeDue'].'</td><td>'.$Row['TimePayment'].'</td></tr>';
     225        }
     226        $Output .= '</table>';
    194227        break;
    195228      case 'SubjectList':
     
    265298        break;
    266299      default:
     300        $Output .= '<strong>Celkové přehledy</strong><br/>';
    267301        $Output .= '<a href="?table=AnnualBalance">Účetní závěrka</a><br />';
    268302        $Output .= '<a href="?table=MonthlyBalance">Měsíční přehledy</a><br />';
    269         $Output .= '<a href="?table=CashFlow">Příjmy a výdaje</a><br />';
    270         $Output .= '<a href="?table=ClaimsLiabilities">Závazky a pohledávky</a><br />';
    271         $Output .= '<a href="?table=Advantages">Zálohy</a><br />';
     303        $Output .= '<a href="?table=SubjectList">Seznam subjektů</a><br />';
    272304        $Output .= '<a href="?table=SmallAssets">Drobný majetek</a><br />';
    273         $Output .= '<a href="?table=SubjectList">Seznam subjektů</a><br />';
     305        $Output .= '<br/>';
     306        $Output .= '<strong>Roční přehledy</strong><br/>';
     307        $Output .= $this->ShowFinanceYears();
     308        $Year = $_GET['year'] * 1;
     309        $Output .= '<a href="?table=Incomes&amp;year='.$Year.'">Příjmy</a><br />';
     310        $Output .= '<a href="?table=Expenses&amp;year='.$Year.'">Výdaje</a><br />';
     311        $Output .= '<a href="?table=Claims&amp;year='.$Year.'">Pohledávky</a><br />';
     312        $Output .= '<a href="?table=Liabilities&amp;year='.$Year.'">Závazky</a><br />';
     313        $Output .= '<a href="?table=Advantages&amp;year='.$Year.'">Zálohy</a><br />';
    274314    }
    275315    return($Output);
    276316  }
     317 
     318  function ShowFinanceYears()
     319  {
     320    $Output = 'Roky: ';
     321    $DbRows = $this->Database->select('FinanceYear', '*');
     322    while($DbRow = $DbRows->fetch_assoc())
     323      $Output .= '<a href="?year='.$DbRow['Id'].'">'.$DbRow['Year'].'</a> ';
     324    $Output .= '<br/>';
     325    return($Output);
     326  }
    277327
    278328  function AddMoney($Subject, $Value, $Text, $Time)
Note: See TracChangeset for help on using the changeset viewer.