Changeset 634 for trunk/pages


Ignore:
Timestamp:
Sep 14, 2009, 7:53:21 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Stránka s výpisem dotací osamostatněna a doplněna o stránkování.
  • Přidáno: Zobrazení ročních příjmů a nákladů na stránce financí.
Location:
trunk/pages
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/dotation.php

    r627 r634  
    2323</p>';
    2424
    25 $operace = array(
    26   'buy' => 'Nákup',
    27   'sell' => 'Prodej',
    28   'consumption' => 'Spotřeba',
    29   'internet' => 'Internet',
    30   'contribution' => 'Příspěvek od',
    31 );
    32 
    3325$load_money = $db->query('SELECT SUM(`Money`) FROM `Finance`;')->fetch_row();
    3426
    3527$Output .= '<p><strong>Aktuální stav financí: '.$load_money[0].' Kč</strong></p>';
     28
     29$Output .= '<h4 class="Center">Roční přehledy financování</h4>';
    3630$Output .= '<table class="BaseTable">'.
    37   '<tr>'.
    38   '<th>Datum</th>'.
    39   '<th>Suma</th>'.
    40   '<th>Popis</th>'.
    41   '<th>Odměna</th>'.
    42   '</tr>';
     31  '<tr><th>Rok</th><th>Příjmy</th><th>Výdaje</th><th>Rozdíl</th></tr>';
     32$DbResult = $db->query('SELECT MAX(Time), MIN(Time) FROM Finance');
     33$TimeRange = $DbResult->fetch_array();
    4334
    44 $load_dotation = $db->query('SELECT * FROM `Finance` ORDER BY `Id` DESC');
    45 while($row = $load_dotation->fetch_assoc())
     35$StartDateTimeParts = explode(' ',$TimeRange['MIN(Time)']);
     36$StartDateParts = explode('-',$StartDateTimeParts[0]);
     37$EndDateTimeParts = explode(' ',$TimeRange['MAX(Time)']);
     38$EndDateParts = explode('-',$EndDateTimeParts[0]);
     39
     40$TotalIncome = 0;
     41$TotalExpense = 0;
     42for($Year = $EndDateParts[0]; $Year >= $StartDateParts[0]; $Year--)
    4643{
    47   $odmena = $row['Reward'];
    48  
    49   if($row['Time'] != '')
    50   {
    51     $date = $server->HumanDate($row['Time'], 0);
    52     //$date = $row['time'];
    53   } else $date = '';
    54   if($row['Money'] > 0) $plus = '+';
    55     else $plus = '';
    56   $Output .= '<tr>'.
    57     '<td>'.$date.'</td>'.
    58     '<td>'.$plus.$row['Money'].'</td>'.
    59     '<td>'.$operace[$row['Operation']].' '.$row['Description'].'</td>'.
    60     '<td>'.$odmena.'</td>'.
    61     '</tr>';
     44  $DbResult = $db->query('SELECT SUM(Money) AS Income FROM Finance WHERE (Money > 0) AND (Time >= "'.$Year.'-01-01") AND (Time < DATE_ADD("'.$Year.'-01-01", INTERVAL 1 YEAR))');
     45  $Income = $DbResult->fetch_assoc();
     46  $Income = $Income['Income'];
     47  $TotalIncome += $Income;
     48  $DbResult = $db->query('SELECT -SUM(Money) AS Expense FROM Finance WHERE (Money < 0) AND (Time >= "'.$Year.'-01-01") AND (Time < DATE_ADD("'.$Year.'-01-01", INTERVAL 1 YEAR))');
     49  $Expense = $DbResult->fetch_assoc();
     50  $Expense = $Expense['Expense'];
     51  $TotalExpense += $Expense;
     52  $Output .= '<tr><td>'.$Year.'</td><td>'.$Income.'</td><td>'.$Expense.'</td><td>'.($Income - $Expense).'</td></tr>';
    6253}
     54$Output .= '<tr><th>Celkem</th><th>'.$TotalIncome.'</th><th>'.$TotalExpense.'</th><th>'.($TotalIncome - $TotalExpense).'</th></tr>';
    6355$Output .= '</table>';
     56
     57$Output .= '<br/><div class="Center"><a href="?page=dotation_dump">Výpis jednotlivých příspěvků</a></div>';
    6458
    6559echo($Output);
  • trunk/pages/guilda.php

    r632 r634  
    4343      <td>'.$total_members.' (Online : '.$online_mem['online_mem'].')</td>
    4444    </tr>');
    45   $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$guild_id);
     45  $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$guild_id.' AND Realm='.$Realm->Id);
    4646  $DbRow = $DbResult->fetch_assoc();
    4747  $Homepage = $DbRow['Homepage'];
  • trunk/pages/guildy.php

    r632 r634  
    5252  $DbResult = $db2->query('SELECT COUNT(*) AS online_mem  FROM `guild_member`, `characters`, `guild` WHERE guild.guildid = '.$row['guildid'].' AND guild_member.guildid = guild.guildid AND guild_member.guid = characters.guid AND characters.online = 1');
    5353  $online_mem = $DbResult->fetch_assoc();
    54   $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$row['guildid']);
     54  $DbResult = $db->query('SELECT Homepage FROM GuildInfo WHERE Guild='.$row['guildid'].' AND Realm='.$Realm->Id);
    5555  $DbRow = $DbResult->fetch_assoc();
    5656  $Homepage = $DbRow['Homepage'];
Note: See TracChangeset for help on using the changeset viewer.