Changeset 721 for trunk/Modules/Finance/UserState.php
- Timestamp:
- Jan 3, 2015, 7:34:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/UserState.php
r720 r721 70 70 $this->System->Modules['Finance']->LoadTariffs(1); 71 71 72 if(array_key_exists('Subject', $_GET)) 72 // Determine which customer should be displayed 73 if(array_key_exists('i', $_GET)) 73 74 { 74 75 if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění'); 75 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$_GET['Subject']); 76 if($DbResult->num_rows > 0) 77 $Subject = $DbResult->fetch_assoc(); 78 else return($this->SystemMessage('Chyba', 'Subjekt nenalezen')); 76 $CustomerId = $_GET['i']; 79 77 } else 80 78 { … … 85 83 { 86 84 $CustomerUserRel = $DbResult->fetch_assoc(); 87 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id='.$CustomerUserRel['Customer'].')'); 88 $Subject = $DbResult->fetch_assoc(); 85 $CustomerId = $CustomerUserRel['Customer']; 89 86 } else return($this->SystemMessage('Chyba', 'Nejste zákazníkem')); 90 87 } 91 92 if(!array_key_exists('show', $_GET)) $_GET['show'] = ''; 93 $DbResult = $this->Database->query('SELECT Member.* '. 94 'FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Subject='.$Subject['Id']); 95 if($DbResult->num_rows == 0) 88 89 // Load customer info 90 $DbResult = $this->Database->query('SELECT * FROM Member WHERE Id='.$CustomerId); 91 if($DbResult->num_rows == 1) 96 92 { 97 return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen')); 98 } 99 $Member = $DbResult->fetch_assoc(); 100 $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">'; 93 $Customer = $DbResult->fetch_assoc(); 94 } else return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen')); 95 96 97 // Load subject info 98 $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$Customer['Subject']); 99 if($DbResult->num_rows == 1) 100 { 101 $Subject = $DbResult->fetch_assoc(); 102 } else return($this->SystemMessage('Položka nenalezena', 'Subjekt nenalezen')); 103 104 105 $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">'; 101 106 102 107 // Account state … … 131 136 $DbResult = $this->Database->query('SELECT Service.Name, Service.Price FROM ServiceCustomerRel '. 132 137 'LEFT JOIN Service ON Service.Id=ServiceCustomerRel.Service '. 133 'WHERE (ServiceCustomerRel.Customer='.$ Member['Id'].') AND (ServiceCustomerRel.Action IS NULL)');138 'WHERE (ServiceCustomerRel.Customer='.$Customer['Id'].') AND (ServiceCustomerRel.Action IS NULL)'); 134 139 while($DbRow = $DbResult->fetch_assoc()) 135 140 { 136 $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';141 $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>'; 137 142 $Total += $DbRow['Price']; 138 143 }
Note:
See TracChangeset
for help on using the changeset viewer.