Ignore:
Timestamp:
Oct 2, 2010, 5:19:22 PM (14 years ago)
Author:
george
Message:
  • Opraveno: Zachování výběru člena při přepínání roků ve výpisu operací.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/user_state.php

    r272 r293  
    4444    if(array_key_exists('year', $_GET))
    4545    {
    46       $DbResult = $this->Database->query('SELECT * FROM FinanceYear WHERE Id='.$_GET['year']);
     46      $DbResult = $this->Database->query('SELECT * FROM FinanceYear WHERE Id='.addslashes($_GET['year'] * 1));
    4747    } else
    4848    {
     
    5252    $YearWhere = ' WHERE (Time >= "'.$FinanceYearSelected['DateStart'].'") AND (Time <= "'.$FinanceYearSelected['DateEnd'].'")';
    5353
     54   
     55   
     56    // Year list
     57    if(array_key_exists('Subject', $_GET)) $SubjectParam = '&amp;Subject='.($_GET['Subject'] * 1);
     58      else $SubjectParam = '';
    5459    $Output .= 'Roky: ';
    5560    $DbResult = $this->Database->query('SELECT * FROM FinanceYear');
    5661    while($FinanceYear = $DbResult->fetch_assoc())
    5762    {
    58       $Year = '<a href="?year='.$FinanceYear['Id'].'">'.$FinanceYear['Year'].'</a> ';
     63      $Year = '<a href="?year='.$FinanceYear['Id'].$SubjectParam.'">'.$FinanceYear['Year'].'</a> ';
    5964      if($FinanceYear['Id'] == $FinanceYearSelected['Id']) $Output .= '<strong>'.$Year.'</strong>';
    6065        else $Output .= $Year;
     
    6267    $Output .= '<br/><br/>';   
    6368   
     69    // Account state   
    6470    $UserOperationTableQuery = '((SELECT Text, Time, Value AS Value, Bill FROM FinanceOperation WHERE (Subject='.$Subject['Id'].')) UNION ALL '.
    6571      '(SELECT Text, TimeCreation as Time, -Value as Value, Bill FROM FinanceClaimsLiabilities WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1';
    66     $DbResult = $this->Database->query('SELECT SUM(T1.Value) AS Total FROM '.$UserOperationTableQuery.$YearWhere);
     72    $DbResult = $this->Database->query('SELECT SUM(T1.Value) AS Total FROM '.$UserOperationTableQuery);
    6773    $DbRow = $DbResult->fetch_array();
    6874    $Total = $DbRow['Total'];
     
    7783    while($DbRow = $DbResult->fetch_array())
    7884      $Operations[] = $DbRow;
     85    $SumValue = 0;
    7986    foreach($Operations as $Row)
    8087    {
     
    8390      if($Row['Bill'] > 0) $Invoice = '<a href="bill.php?Id='.$Row['Bill'].'">PDF</a>'; else $Invoice = '&nbsp;';
    8491      $Output .= '<tr><td style="text-align: right;">'.HumanDate($Row['Time']).'</td><td style="text-align: left;">'.$Row['Text'].'</td><td style="text-align: right;">'.$Row['Value'].'</td><td style="text-align: center;">'.$Invoice.'</td></tr>';
     92      $SumValue = $SumValue + $Row['Value'];
    8593    }
     94      $Output .= '<tr><td style="text-align: right;" colspan="2"><strong>Celkem za rok</strong></td><td style="text-align: right;"><strong>'.$SumValue.'</strong></td><td style="text-align: center;">&nbsp;</td></tr>';
     95   
     96   
    8697    //echo('<tr><td>&nbsp;</td><td>-'.$Row2['network_device'].'</td><td>Proměnná cena za zařízení</td></tr>
    8798    $Output .= '</table>';
Note: See TracChangeset for help on using the changeset viewer.