Changeset 74


Ignore:
Timestamp:
Apr 16, 2008, 7:08:25 PM (17 years ago)
Author:
george
Message:

Opraveno: Zobrazení stavu účtu účastníků sítě.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/finance/clenove.php

    r70 r74  
    135135    $TotalMonth = 0;
    136136    $TotalCash = 0;
    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');
     137    $DbResult = $Database->query('SELECT *, CONCAT(users.second_name, " ", users.first_name) as Fullname, ((SELECT COALESCE(SUM(Value), 0) FROM FinanceCashFlow WHERE Subject=users.id) + '.
     138      '(SELECT COALESCE(SUM(-Value), 0) FROM FinanceClaimsLiabilities WHERE Subject=users.id)) as Cash FROM users WHERE role=2 ORDER BY fullname');
    138139
    139140    //$DbResult = $Database->query("SELECT *,CONCAT(second_name, ' ', first_name) as fullname FROM users WHERE role=2 ORDER BY fullname");
     
    149150        }
    150151      }
    151       $Row['cash'] = $Row['AdvancesIn'] - $Row['AdvancesOut'] + $Row['OpenedLiabilities'] - $Row['OpenedClaims'];
    152       $TotalCash += $Row['cash'];
    153       if($Row['cash'] < 0) $Row['cash'] = '<span style="color: red;">'.$Row['cash'].'</span>';
     152      //$Row['cash'] = $Row['AdvancesIn'] - $Row['AdvancesOut'] + $Row['Liabilities'] - $Row['Claims'];
     153      $TotalCash += $Row['Cash'];
     154      if($Row['Cash'] < 0) $Row['Cash'] = '<span style="color: red;">'.$Row['Cash'].'</span>';
    154155      $Tarif = $Tarify[$Row['inet_tarif_now']]['name'];
    155156      $PristiTarif = $Tarify[$Row['inet_tarif_next']]['name'];
    156157      echo('<tr><td><a href="?show=user&amp;id='.$Row['id'].'">'.$Row['Fullname'].'</a></td>');
    157158//<td align="right">'.$Row['network_device'].'</td>
    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'].'&nbsp;</td></tr>');
     159      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'].'&nbsp;</td></tr>');
    159160      $TotalDevice += $Row['network_device'];
    160161      $TotalMonth += ($Row['monthly'] - $Row['plus']);
Note: See TracChangeset for help on using the changeset viewer.