Changeset 293 for trunk/finance
- Timestamp:
- Oct 2, 2010, 5:19:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/user_state.php
r272 r293 44 44 if(array_key_exists('year', $_GET)) 45 45 { 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)); 47 47 } else 48 48 { … … 52 52 $YearWhere = ' WHERE (Time >= "'.$FinanceYearSelected['DateStart'].'") AND (Time <= "'.$FinanceYearSelected['DateEnd'].'")'; 53 53 54 55 56 // Year list 57 if(array_key_exists('Subject', $_GET)) $SubjectParam = '&Subject='.($_GET['Subject'] * 1); 58 else $SubjectParam = ''; 54 59 $Output .= 'Roky: '; 55 60 $DbResult = $this->Database->query('SELECT * FROM FinanceYear'); 56 61 while($FinanceYear = $DbResult->fetch_assoc()) 57 62 { 58 $Year = '<a href="?year='.$FinanceYear['Id']. '">'.$FinanceYear['Year'].'</a> ';63 $Year = '<a href="?year='.$FinanceYear['Id'].$SubjectParam.'">'.$FinanceYear['Year'].'</a> '; 59 64 if($FinanceYear['Id'] == $FinanceYearSelected['Id']) $Output .= '<strong>'.$Year.'</strong>'; 60 65 else $Output .= $Year; … … 62 67 $Output .= '<br/><br/>'; 63 68 69 // Account state 64 70 $UserOperationTableQuery = '((SELECT Text, Time, Value AS Value, Bill FROM FinanceOperation WHERE (Subject='.$Subject['Id'].')) UNION ALL '. 65 71 '(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); 67 73 $DbRow = $DbResult->fetch_array(); 68 74 $Total = $DbRow['Total']; … … 77 83 while($DbRow = $DbResult->fetch_array()) 78 84 $Operations[] = $DbRow; 85 $SumValue = 0; 79 86 foreach($Operations as $Row) 80 87 { … … 83 90 if($Row['Bill'] > 0) $Invoice = '<a href="bill.php?Id='.$Row['Bill'].'">PDF</a>'; else $Invoice = ' '; 84 91 $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']; 85 93 } 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;"> </td></tr>'; 95 96 86 97 //echo('<tr><td> </td><td>-'.$Row2['network_device'].'</td><td>Proměnná cena za zařízení</td></tr> 87 98 $Output .= '</table>';
Note:
See TracChangeset
for help on using the changeset viewer.