Changeset 178 for trunk


Ignore:
Timestamp:
Mar 24, 2009, 9:00:06 PM (16 years ago)
Author:
george
Message:
  • Opraveno: Zobrazování stavu účetních operací pro subjekty namísto uživatelů.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/clenove.php

    r167 r178  
    3030      $Tarif = $Finance->Tarify[$Row['InternetTariffCurrentMonth']]['name'];
    3131      $PristiTarif = $Finance->Tarify[$Row['InternetTariffNextMonth']]['name'];
    32       $Output .= '<tr><td>'.$Row['FullName'].'</td><td><a href="user_state.php?userid='.$Row['Id'].'">'.$Row['Name'].'</a></td>';
     32      $Output .= '<tr><td>'.$Row['FullName'].'</td><td><a href="user_state.php?Subject='.$Row['Id'].'">'.$Row['Name'].'</a></td>';
    3333      //<td align="right">'.$Row['network_device'].'</td>
    3434      $Output .= '<td align="right">'.$Row['MonthlyTotal'].'</td><td align="right">'.$Row['Cash'].'</td><td align="center">'.$Tarif.'</td><td align="center">'.$PristiTarif.'</td></tr>';
  • trunk/finance/user_state.php

    r167 r178  
    1010  function Show()
    1111  {
     12          $Finance = &$this->System->Modules['Finance'];
     13          $this->System->Modules['Finance']->RecalculateTariffs(1);
     14
    1215    if(array_key_exists('old', $_GET))
    13         {
    14           $UserId = GetMemberByIP(GetRemoteAddress());
    15         } else
    16     if(array_key_exists('userid', $_GET))
    17         {
    18           if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
    19           $UserId = $_GET['userid'];
    20         } else
    21         {
    22           if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
     16          {
     17            $MemberId = GetMemberByIP(GetRemoteAddress());
     18      if($MemberId != '')
     19      {
     20        $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Member.Id='.$MemberId.')');
     21        $Subject = $DbResult->fetch_assoc();
     22      } else die('Nemáte oprávnění');
     23          } else
     24    if(array_key_exists('Subject', $_GET))
     25          {
     26            if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
     27      $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$_GET['Subject']);
     28      $Subject = $DbResult->fetch_assoc();
     29    } else
     30          {
     31            if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
    2332      $UserId = $this->System->Modules['User']->User['Id'];
    24         }
    25 
    26         $Finance = &$this->System->Modules['Finance'];
    27         $this->System->Modules['Finance']->RecalculateTariffs(1);
     33      $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))');
     34      $Subject = $DbResult->fetch_assoc();
     35          }
     36   
    2837    if(!array_key_exists('show', $_GET)) $_GET['show'] = '';
    29     $DbResult = $this->Database->query('SELECT Id FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))');
    30     $Subject = $DbResult->fetch_assoc();
    31     $DbResult = $this->Database->query('SELECT * FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Id=(SELECT Member FROM User WHERE User.Id='.$UserId.')');
     38    $DbResult = $this->Database->query('SELECT * FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Id='.$Subject['Id']);
    3239    $Member = $DbResult->fetch_assoc();
    3340    $TarifName = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['name'];
    34         $TarifPrice = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['price'];
     41          $TarifPrice = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['price'];
    3542    $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';
    3643
    3744    // Tabulka operaci
    38     $DbResult = $this->Database->query('SELECT CONCAT(SecondName, " ", FirstName) as Name FROM User WHERE Id='.$UserId);
    39     $User = $DbResult->fetch_assoc();
    40     $Output .= 'Výpis operací pro účastníka '.$User['Name'].':<br>';
     45    $Output .= 'Výpis operací pro subjekt '.$Subject['Name'].':<br>';
    4146    $Output .= '<table style="font-size: smaller;" class="WideTable"><tr><th>Datum</th><th>Popis</th><th>Částka</th><th>Doklad</th></tr>';
    4247    $Operations = array();
  • trunk/global.php

    r170 r178  
    190190  global $Database;
    191191 
    192   $DbResult = $Database->query('SELECT Id FROM User WHERE (SELECT user FROM hosts WHERE IP="'.$IP.'") = User.Id');
    193   $DbRow = $DbResult->fetch_assoc();
    194   return($DbRow['Id']);
     192  $DbResult = $Database->query('SELECT Id FROM Member WHERE (SELECT user FROM hosts WHERE IP="'.$IP.'") = Member.Id');
     193  if($DbResult->num_rows > 0)
     194  {
     195    $DbRow = $DbResult->fetch_assoc(); 
     196    return($DbRow['Id']);
     197  } else return('');
    195198}
    196199
Note: See TracChangeset for help on using the changeset viewer.