Changeset 419


Ignore:
Timestamp:
Oct 8, 2012, 11:17:43 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Propočty financí a počtu skutečně platících členů a vybraných pěněz.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r410 r419  
    4848    foreach($this->Tariffs as $Index => $Tariff)
    4949    {
    50       $DbResult = $this->Database->select('Member', 'COUNT(*)', 'InternetTariffCurrentMonth='.$Index.' AND (BillingPeriod > 1)');
     50      $DbResult = $this->Database->select('Member', 'COUNT(*)', '(InternetTariffCurrentMonth='.$Index.') AND (BillingPeriod > 1) AND (Blocked=0)');
    5151      $Row = $DbResult->fetch_row();
    5252      $this->Tariffs[$Index]['MemberCount'] = $Row[0];
     
    111111    $Row = $DbResult->fetch_row();
    112112    $this->InternetUsers = $Row[0];
    113    
    114     $this->SpravaUsers = $this->InternetUsers;
     113    $DbResult = $this->Database->query('SELECT COUNT(*) FROM Member WHERE (Blocked=0) AND (BillingPeriod > 1)');
     114    $Row = $DbResult->fetch_row();
     115    $this->PayingUsers = $Row[0];
     116   
     117    $this->SpravaUsers = $this->PayingUsers;
     118   
    115119    $DbResult = $this->Database->query('SELECT SUM(Consumption) FROM NetworkSegment');
    116120    $TotalConsumption = $DbResult->fetch_array();
    117121    $this->TotalConsumption = $TotalConsumption[0];
    118122
    119     $DbResult = $this->Database->query('SELECT SUM(`MonthlyInternet`) AS `MonthlyInternet`, SUM(`MonthlyTotal`) AS `MonthlyTotal` FROM MemberPayment');
     123    $DbResult = $this->Database->query('SELECT SUM(`MemberPayment`.`MonthlyInternet`) AS `MonthlyInternet`, SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '.
     124      'FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member WHERE Member.Blocked=0');
    120125    $Row = $DbResult->fetch_assoc();
    121126    $this->TotalInternetPaid = $Row['MonthlyInternet'];
  • trunk/finance/index.php

    r409 r419  
    2626    $Row = $DbResult->fetch_array();
    2727    $Output .= 'Platba za internetovou linku ('.$Finance->RealMaxSpeed.'/'.$Finance->RealMaxSpeed.' kbit/s): <strong>'.$Finance->Internet.' Kč</strong><br />';
    28 
    29     $DbResult = $this->Database->query('SELECT COUNT(*) FROM Member');
    30     $Row2 = $DbResult->fetch_array();
    31     $Output .= 'Počet registrovaných klientů: <strong>'.$Row2[0].'</strong><br />';
    32    
    33     $DbResult = $this->Database->query('SELECT COUNT(*) FROM Member WHERE (BillingPeriod > 1) AND (InternetTariffCurrentMonth > 0)');
    34     $Row2 = $DbResult->fetch_array();
    35     $Output .= 'Počet platících klientů: <strong>'.$Row2[0].'</strong><br />';
     28    $Output .= 'Počet registrovaných klientů: <strong>'.$Finance->InternetUsers.'</strong><br />';
     29    $Output .= 'Počet platících klientů: <strong>'.$Finance->PayingUsers.'</strong><br />';
    3630
    3731    //$DbResult = $this->Database->query('SELECT SUM(Price) FROM Product WHERE Used=1');
     
    3933    //$Output .= 'Celková cena zařízení sítě: <strong>'.$Row4[0].' Kč</strong><br />';
    4034
    41     $DbResult = $this->Database->query('SELECT SUM(Cash) as Cash FROM MemberPayment');
     35    //$DbResult = $this->Database->query('SELECT SUM(MemberPayment.Cash) AS Cash FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member WHERE Member.Blocked=0');
     36    $DbResult = $this->Database->query('SELECT SUM(Cash) AS Cash FROM MemberPayment');
    4237    $Row4 = $DbResult->fetch_array();
    43     $Output .= 'Celkem peněz na účtech: <strong>'.$Row4[0].' Kč</strong><br />';
     38    $Output .= 'Celkem peněz na účtech: <strong>'.round($Row4[0]).' Kč</strong><br />';
    4439    $Output .= 'Stanovená cena jedné kWh: <strong>'.$Finance->kWh.' Kč</strong><br />';
    4540    //echo('Komunitou stanovený poplatek za správu sítě pro jednoho uživatele: <strong>'.$Sprava.' Kč</strong><br />');
    4641    $DbResult = $this->Database->query('SELECT SUM(FamilyMemberCount) AS Family FROM Member');
    4742    $Family = $DbResult->fetch_assoc();
    48   $Family = $Family['Family'];
     43    $Family = $Family['Family'];
    4944    $TotalFamily = 600;
    5045    $Output .= 'V připojených domácnostech celkem <strong>'.$Family.'</strong> občanů ze všech <strong>'.$TotalFamily.'</strong> ('.round($Family / $TotalFamily * 100).' %)<br />';
    5146    $Output .= 'IČ: <strong>75904535</strong><br />'.
    5247    'DIČ: <strong>CZ8303255884</strong><br />'.
    53     'Bankovní účet: <strong>218098370 / 0300</strong><br />'.
     48    'Bankovní spojení pro platby v CZK v ČR: <strong>2600134781 / 2010</strong><br/>'.
     49    'Bankovní spojení pro platby v EUR v SR: <strong>2600134781 / 8330</strong><br/>'.
    5450    '<br />';
    5551
     
    8076    $Output .= '<tr><td colspan="2">&nbsp;</td></tr>';
    8177    $Output .= '<tr><td><strong>Rozdíl</strong></td><td align="right"><strong>'.($TotalGain - $TotalExpense).'</strong></td></tr>';
    82     $Output .= '<tr><td>Převod do dalšího měsíce</td><td align="right">'.($TotalGain - $TotalExpense).'</td></tr>';
     78    $Output .= '<tr><td>Investice</td><td align="right">'.($TotalGain - $TotalExpense).'</td></tr>';
    8379    $Output .= '</table><br />';
    8480    /* $DbResult = $this->Database->select('', 'cash', 'id='.$Finance->UserIdNetwork);
  • trunk/finance/tarify.php

    r221 r419  
    2525      $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['SpeedMin'] / 1024).'</td><td align="center" style="color: blue;">'.round($Tariff['SpeedMax'] / 1024).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['MemberCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['MemberCount'] * $Tariff['Price'].'</td></tr>';
    2626      $TotalPrice = $TotalPrice + $Tariff['Price'] * $Tariff['MemberCount'];
     27      $TotalMemberCount = $TotalMemberCount + $Tariff['MemberCount'];
    2728    }
    28     $Output .= '<tr><td>Součty</td><td colspan="3">&nbsp;</td><td align="center">'.$Finance->InternetUsers.'</td><td>&nbsp;</td><td align="center">'.$TotalPrice.'</td></tr>';
     29    $Output .= '<tr><td>Součty</td><td colspan="3">&nbsp;</td><td align="center">'.$TotalMemberCount.'</td><td>&nbsp;</td><td align="center">'.$TotalPrice.'</td></tr>';
    2930    $Output .= '</table>';
    3031    return($Output);
     
    3435  {
    3536        $Finance = &$this->System->Modules['Finance'];
    36     $Output = 'Počet členů s internetovým připojením: <strong>'.$Finance->InternetUsers.'</strong><br /><br />';
     37    $Output = 'Počet platících členů s internetovým připojením: <strong>'.$Finance->PayingUsers.'</strong><br /><br />';
    3738/*
    3839    $Output .= '<table><tr><td valign="top">';
  • trunk/index.php

    r417 r419  
    274274    // Show pannels
    275275    //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
    276     $Output .= $this->InfoBar();
     276    //$Output .= $this->InfoBar();
    277277    $Output .= '<table id="MainTable"><tr>';
    278278    $DbResult = $Database->select('PanelColumn', '*');
Note: See TracChangeset for help on using the changeset viewer.