Changeset 70 for www/finance
- Timestamp:
- Apr 16, 2008, 6:17:48 PM (17 years ago)
- Location:
- www/finance
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/bills.php
r61 r70 39 39 $User['street'].'<br>'. 40 40 $User['psc'].' '.$User['town'].'<br>'; 41 if($User['ico'] != 0) $Output .= 'IČ O: '.$User['ico'].'<br>';41 if($User['ico'] != 0) $Output .= 'IČ: '.$User['ico'].'<br>'; 42 42 if($User['dic'] != '') $Output .= 'DIČ: '.$User['dic'].'<br>'; 43 43 $Output .= -
www/finance/clenove.php
r60 r70 10 10 { 11 11 case 'user': 12 ShowHeader('Seznam členů sítě', 'Seznam členů');12 ShowHeader('Seznam účastníků sítě', 'Seznam účastníků'); 13 13 $DbResult = $Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE id=".$UserID); 14 14 $Row2 = $DbResult->fetch_array(); … … 18 18 // Tabulka operaci 19 19 echo('Výpis operací pro účastníka '.$Row2['fullname'].':<br>'); 20 echo('<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Datum</th><th>Změna</th><th>Doklad</th><th>Komentář</th></tr>'); 21 $DbResult = $Database->query("SELECT * FROM finance_operations WHERE user=".$_GET['id'].' ORDER BY date DESC'); 22 while($Row = $DbResult->fetch_array()) 20 echo('<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3"><tr><th>Datum</th><th>Popis</th><th>Doklad</th><th>Komentář</th></tr>'); 21 $Operations = array(); 22 $DbResult = $Database->query('(SELECT Time, Value, Text, Bill FROM FinanceCashFlow WHERE Subject='.$_GET['id'].') UNION ALL '. 23 '(SELECT TimeCreation as Time, (-Value) as Value, Text, Bill FROM FinanceClaimsLiabilities WHERE Subject='.$_GET['id'].') ORDER BY Time'); 24 while($DbRow = $DbResult->fetch_array()) 25 $Operations[] = $DbRow; 26 foreach($Operations as $Row) 23 27 { 24 if($Row[' money'] > 0) $Row['money'] = '+'.$Row['money'];25 if($Row[' bill_id'] > 0) $Invoice = '<a href="?show=bill&id='.$Row['bill_id'].'">PDF</a>'; else $Invoice = ' ';26 echo('<tr><td align="right">'.HumanDate($Row[' date']).'</td><td>'.$Row['money'].'</td><td>'.$Invoice.'</td><td>'.$Row['comment'].' </td></tr>');28 if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value']; 29 if($Row['Bill'] > 0) $Invoice = '<a href="?show=bill&id='.$Row['Bill'].'">PDF</a>'; else $Invoice = ' '; 30 echo('<tr><td align="right">'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Invoice.'</td></tr>'); 27 31 } 28 32 //echo('<tr><td> </td><td>-'.$Row2['network_device'].'</td><td>Proměnná cena za zařízení</td></tr> 29 33 echo('</table>'); 30 echo('<h3><strong>Stav účtu: </strong>'.$Row2['cash'].' Kč</h3><br>'); 34 $DbResult = $Database->query('SELECT ((SELECT COALESCE(SUM(Value), 0) FROM FinanceCashFlow WHERE Subject='.$_GET['id'].') + '. 35 '(SELECT COALESCE(SUM(-Value), 0) FROM FinanceClaimsLiabilities WHERE Subject='.$_GET['id'].')) as Total'); 36 $DbRow = $DbResult->fetch_array(); 37 $Total = $DbRow['Total']; 38 echo('<h3><strong>Stav účtu: </strong>'.$Total.' Kč</h3><br>'); 31 39 echo('</td><td valign="top">'); 32 40 … … 117 125 break; 118 126 default: 119 ShowHeader('Seznam členů sítě', 'Seznam členů');127 ShowHeader('Seznam účastníků sítě', 'Seznam účastníků'); 120 128 // Seznam členů 121 echo('Seznam členů:<br>'.129 echo('Seznam účastníků:<br>'. 122 130 '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'. 123 131 '<tr><th>Jméno</th>'); … … 127 135 $TotalMonth = 0; 128 136 $TotalCash = 0; 129 $DbResult = $Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE role=2 ORDER BY fullname"); 137 $DbResult = $Database->query('SELECT *, CONCAT(users.second_name, " ", users.first_name) as Fullname, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM users WHERE role=2 ORDER BY fullname'); 138 139 //$DbResult = $Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE role=2 ORDER BY fullname"); 130 140 while($Row = $DbResult->fetch_array()) 131 141 { … … 139 149 } 140 150 } 151 $Row['cash'] = $Row['AdvancesIn'] - $Row['AdvancesOut'] + $Row['OpenedLiabilities'] - $Row['OpenedClaims']; 141 152 $TotalCash += $Row['cash']; 142 153 if($Row['cash'] < 0) $Row['cash'] = '<span style="color: red;">'.$Row['cash'].'</span>'; 143 154 $Tarif = $Tarify[$Row['inet_tarif_now']]['name']; 144 155 $PristiTarif = $Tarify[$Row['inet_tarif_next']]['name']; 145 echo('<tr><td><a href="?show=user&id='.$Row['id'].'">'.$Row[' fullname'].'</a></td>');156 echo('<tr><td><a href="?show=user&id='.$Row['id'].'">'.$Row['Fullname'].'</a></td>'); 146 157 //<td align="right">'.$Row['network_device'].'</td> 147 158 echo('<td align="right">'.$Monthly.'</td><td align="right">'.$Row['cash'].'</td><td align="center">'.$Tarif.'</td><td align="center">'.$PristiTarif.'</td><td>'.$Row['notice'].' </td></tr>');
Note:
See TracChangeset
for help on using the changeset viewer.