Changeset 163 for www/finance/user_state.php
- Timestamp:
- Feb 20, 2009, 9:53:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/user_state.php
r157 r163 10 10 function Show() 11 11 { 12 global $Tarify, $Sprava; 12 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í'); 23 $UserId = $this->System->Modules['User']->User['Id']; 24 } 13 25 14 if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění'); 15 26 $Finance = &$this->System->Modules['Finance']; 16 27 $this->System->Modules['Finance']->RecalculateTariffs(1); 17 $UserId = $this->System->Modules['User']->User['Id'];18 28 if(!array_key_exists('show', $_GET)) $_GET['show'] = ''; 19 29 $DbResult = $this->Database->query('SELECT Id FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))'); 20 30 $Subject = $DbResult->fetch_assoc(); 21 $DbResult = $this->Database->query('SELECT InternetTariffCurrentMonth FROM Member WHERE Id=(SELECT Member FROM User WHEREId='.$UserId.')');31 $DbResult = $this->Database->query('SELECT * FROM Member JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Id=(SELECT Member FROM User WHERE User.Id='.$UserId.')'); 22 32 $Member = $DbResult->fetch_assoc(); 23 $TarifName = $ Tarify[$Member['InternetTariffCurrentMonth']]['name'];24 $TarifPrice = $ Tarify[$Member['InternetTariffCurrentMonth']]['price'];33 $TarifName = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['name']; 34 $TarifPrice = $Finance->Tarify[$Member['InternetTariffCurrentMonth']]['price']; 25 35 $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">'; 26 36 … … 53 63 $Output .= 'Variabilní symbol pro platby: <strong>'.$Subject['Id'].'</strong><br><br>'; 54 64 55 $DbResult = $this->Database->query('SELECT SUM(consumption) AS Total FROM network_devices WHERE user='.$UserId.' AND used=1');56 $ConsumptionBonus = $DbResult->fetch_assoc();57 $ConsumptionBonus = $this->System->Modules['Finance']->W2Kc($ConsumptionBonus['Total']);58 59 65 $Total = 0; 60 66 $Output .= 'Rozpis měsíčního poplatku:<br><table border="1" cellspacing="0" cellpadding="3">'. … … 62 68 '<tr><td>Internet - tarif '.$TarifName.'</td><td>'.$TarifPrice.'</td></tr>'; 63 69 $Total += $TarifPrice; 64 if($ ConsumptionBonus!= 0)65 $Output .= '<tr><td>Příjem za spotřebu</td><td>'.(-$ ConsumptionBonus) .'</td></tr>';66 $Total += -$ ConsumptionBonus;70 if($Member['MonthlyPlus'] != 0) 71 $Output .= '<tr><td>Příjem za spotřebu</td><td>'.(-$Member['MonthlyPlus']) .'</td></tr>'; 72 $Total += -$Member['MonthlyPlus']; 67 73 $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Total.'</strong></td></tr></table>'; 68 74 //echo('Tarif pro příští měsíc: '.$Tarify[$Row2['inet_tarif_next']]['name'].'<br><br>'); 69 75 $Output .= '<br />'; 70 76 71 if($ ConsumptionBonus!= 0)77 if($Member['MonthlyPlus'] != 0) 72 78 { 73 79 $Output .= 'Měsíční příjem za spotřebu zařízení umístěných u uživatele:<br>';
Note:
See TracChangeset
for help on using the changeset viewer.