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.
File:
1 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'];
Note: See TracChangeset for help on using the changeset viewer.