Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (9 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/Manage.php

    r727 r738  
    109109    $SumValue = 0;
    110110    foreach($Items as $Item)
    111       $SumValue = $SumValue + ceil($Item['Price'] * $Item['Quantity']);   
     111      $SumValue = $SumValue + ceil($Item['Price'] * $Item['Quantity']);
    112112    $this->Database->insert('FinanceInvoice', array(
    113113      'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation),
    114       'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue, 
    115         'Direction' => $Direction, 'BillCode' => $BillCode,
     114      'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue,
     115      'Direction' => $Direction, 'BillCode' => $BillCode,
    116116      'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo),
    117117      'Generate' => 1, 'DocumentLine' => $DocumentLine));
     
    163163          $MonthlyTotal += $Service['Price'];
    164164        }
    165         $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];               
     165        $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];
    166166        // We can't produce negative invoice except storno invoice.
    167         // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction 
    168         // Other subject should invoice only possitive items. Negative items should be somehow removed. 
     167        // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction
     168        // Other subject should invoice only possitive items. Negative items should be somehow removed.
    169169        if($MonthlyTotal >= 0) {
    170                 $DocumentLine = DOC_LINE_INVOICE_OUT;       
    171                 $Direction = 1; // Standard out invoice
     170          $DocumentLine = DOC_LINE_INVOICE_OUT;
     171          $Direction = 1; // Standard out invoice
    172172        } else {
    173                 $DocumentLine = DOC_LINE_INVOICE_IN;
     173          $DocumentLine = DOC_LINE_INVOICE_IN;
    174174          $Direction = -1; // In case of negative total value generate reverse invoice for other subject
    175175          foreach($InvoiceItems as $Index => $Item)
    176                 $InvoiceItems[$Index]['Price'] = -$Item['Price'];
    177         }       
    178        
     176          $InvoiceItems[$Index]['Price'] = -$Item['Price'];
     177        }
     178
    179179        if($PayPerPeriod != 0)
    180180        {
     
    195195  function TableUpdateChanges($Table)
    196196  {
    197         $Time = time();
     197    $Time = time();
    198198    $DbResult = $this->Database->select($Table, '*', '(`ChangeAction` IS NOT NULL) AND '.
    199         '(`ChangeTime` <= "'.TimeToMysqlDateTime($Time).'") ORDER BY `ChangeTime` ASC');
     199      '(`ChangeTime` <= "'.TimeToMysqlDateTime($Time).'") ORDER BY `ChangeTime` ASC');
    200200    while($Service = $DbResult->fetch_array())
    201201    {
     
    225225  function ProcessTableUpdates()
    226226  {
    227         // Update finance charge
    228         $Output = 'Měním aktuální parametry sítě...<br>';
    229         $this->TableUpdateChanges('FinanceCharge');
    230        
    231         // Update services
    232         $Output .= 'Aktualizuji služby....<br>';
    233         $this->TableUpdateChanges('Service');
    234        
    235         // Update customer service selections
    236         $Output .= 'Aktualizuji výběr služeb zákazníků....<br>';
    237         $this->TableUpdateChanges('ServiceCustomerRel');
    238 
    239         return($Output);
    240   }
    241  
     227    // Update finance charge
     228    $Output = 'Měním aktuální parametry sítě...<br>';
     229    $this->TableUpdateChanges('FinanceCharge');
     230
     231    // Update services
     232    $Output .= 'Aktualizuji služby....<br>';
     233    $this->TableUpdateChanges('Service');
     234
     235    // Update customer service selections
     236    $Output .= 'Aktualizuji výběr služeb zákazníků....<br>';
     237    $this->TableUpdateChanges('ServiceCustomerRel');
     238
     239    return($Output);
     240  }
     241
    242242  function ProcessMonthlyPayment()
    243243  {
     
    246246
    247247    $Output .= $this->ProcessTableUpdates();
    248    
     248
    249249    $Finance = &$this->System->Modules['Finance'];
    250250    $Finance->LoadMonthParameters(0);
     
    282282      $Output .= 'Odečítám měsíční poplatek...<br />';
    283283      $Output .= $this->ProduceInvoices();
    284      
     284
    285285      $Output .= 'Přidávám měsíční přehled...<br />';
    286286      $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE (`ChangeAction` IS NULL) LIMIT 1');
     
    327327
    328328    $DbResult = $this->Database->query('SELECT `FinanceBankAccount`.*, '.
    329                 'CONCAT(`FinanceBankAccount`.`Number`, "/", `FinanceBank`.`Code`) AS `NumberFull` FROM `FinanceBankAccount` '.
     329      'CONCAT(`FinanceBankAccount`.`Number`, "/", `FinanceBank`.`Code`) AS `NumberFull` FROM `FinanceBankAccount` '.
    330330      'JOIN `FinanceBank` ON `FinanceBank`.`Id`=`FinanceBankAccount`.`Bank` '.
    331331      'WHERE (`FinanceBankAccount`.`Subject`='.$Config['Finance']['MainSubjectId'].') '.
    332         'AND (`FinanceBankAccount`.`Use`=1)');
     332      'AND (`FinanceBankAccount`.`Use`=1)');
    333333    $MainSubjectAccount = $DbResult->fetch_assoc();
    334334
     
    356356      $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, (`Value`*`Direction`) AS `Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '.
    357357        '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ", ") FROM `FinanceInvoiceItem` '.
    358         'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '.
    359         '`Time`, -(`Value`*`Direction`) AS `Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.
     358        'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '.
     359        '`Time`, -(`Value`*`Direction`) AS `Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.
    360360        $Member['Subject'].')) ORDER BY `Time` DESC) AS `T1` WHERE (`T1`.`Time` > "'.$Member['BillingPeriodLastDate'].'")');
    361361      while($DbRow = $DbResult->fetch_assoc())
Note: See TracChangeset for help on using the changeset viewer.