Changeset 916 for trunk/Modules/Finance


Ignore:
Timestamp:
Dec 7, 2021, 11:08:42 PM (3 years ago)
Author:
chronos
Message:
  • Added: Allow to switch Mail class into test mode.
  • Modified: Type checking related changes.
  • Modified: Replace global $Config references with $this->System->Config is possible.
Location:
trunk/Modules/Finance
Files:
3 edited

Legend:

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

    r901 r916  
    1616      $Subject['AddressStreet'].'<br>'.
    1717      $Subject['AddressPSC'].' '.$Subject['AddressTown'].'<br>';
    18     if ($Subject['IC'] != 0) $Output .= 'IČ: '.$Subject['IC'].'<br>';
     18    if (($Subject['IC'] != '') and ($Subject['IC'] != 0)) $Output .= 'IČ: '.$Subject['IC'].'<br>';
    1919    if ($Subject['DIC'] != '') $Output .= 'DIČ: '.$Subject['DIC'].'<br>';
    2020    if ($Subject['Account'] != '') $Output .= 'Účet: '.$Subject['Account'].'<br>';
  • trunk/Modules/Finance/Finance.php

    r910 r916  
    3636  function DoStart(): void
    3737  {
    38     global $Config;
    39 
    4038    $this->System->RegisterPage(['finance', 'sprava'], 'PageFinanceManage');
    4139    $this->System->RegisterPage(['finance', 'platby'], 'PageFinanceUserState');
     
    162160        'Value' => array('Type' => 'Integer', 'Caption' => 'Částka absolutní', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true),
    163161        'ValueUser' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,
    164           'SQL' => 'SELECT ROUND(SUM(`Price`*`Quantity`), '.$Config['Finance']['Rounding'].') FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=#Id'),
     162          'SQL' => 'SELECT ROUND(SUM(`Price`*`Quantity`), '.$this->System->Config['Finance']['Rounding'].') FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=#Id'),
    165163        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
    166164        'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''),
     
    244242        'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '21', 'Suffix' => '%'),
    245243        'Total' => array('Type' => 'Integer', 'Caption' => 'Celkem', 'Default' => '', 'Suffix' => 'Kč',
    246           'ReadOnly' => true, 'SQL' => 'ROUND(`Price` * `Quantity`, '.$Config['Finance']['Rounding'].')'),
     244          'ReadOnly' => true, 'SQL' => 'ROUND(`Price` * `Quantity`, '.$this->System->Config['Finance']['Rounding'].')'),
    247245      ),
    248246      'AfterInsert' => array($this, 'AfterInsertFinanceInvoiceItem'),
     
    259257        'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '',
    260258          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => 'IFNULL(ROUND((SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
    261           'WHERE `FinanceOperation`.`Treasury`=#Id), '.$Config['Finance']['Rounding'].'), 0)'),
     259          'WHERE `FinanceOperation`.`Treasury`=#Id), '.$this->System->Config['Finance']['Rounding'].'), 0)'),
    262260        'Operations' => array('Type' => 'TFinanceOperationListTreasury', 'Caption' => 'Operace', 'Default' => ''),
    263261        'Check' => array('Type' => 'TFinanceTreasuryCheckListTreasury', 'Caption' => 'Kontrola', 'Default' => ''),
     
    568566    ));
    569567
    570     $this->Finance->MainSubject = $Config['Finance']['MainSubjectId'];
    571     $this->Finance->DirectoryId = $Config['Finance']['DirectoryId'];
     568    $this->Finance->MainSubject = $this->System->Config['Finance']['MainSubjectId'];
     569    $this->Finance->DirectoryId = $this->System->Config['Finance']['DirectoryId'];
    572570
    573571    ModuleIS::Cast($this->System->GetModule('IS'))->RegisterDashboardItem('Finance', array($this, 'ShowDashboardItem'));
  • trunk/Modules/Finance/Manage.php

    r912 r916  
    4949
    5050  /* Get first day and last day of given billing period. Periods are aligned with year start/end. */
    51   function GetBillingPeriod($Period)
     51  function GetBillingPeriod(int $Period): array
    5252  {
    5353    $Time = time();
     
    7373  }
    7474
    75   function ShowMonthlyPayment()
     75  function ShowMonthlyPayment(): string
    7676  {
    7777    if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'Manage')) return 'Nemáte oprávnění';
     
    126126  }
    127127
    128   function InsertInvoice($Subject, $TimeCreation, $TimeDue, $Items,
    129     $Group, $PeriodFrom, $PeriodTo)
     128  function InsertInvoice(string $Subject, string $TimeCreation, string $TimeDue, array $Items,
     129    array $Group, float $PeriodFrom, float $PeriodTo): string
    130130  {
    131131    global $LastInsertTime;
     
    156156  }
    157157
    158   function ProduceInvoices()
     158  function ProduceInvoices(): string
    159159  {
    160160    $Output = '';
     
    224224  }
    225225
    226   function TableUpdateChanges($Table)
     226  function TableUpdateChanges(string $Table): void
    227227  {
    228228    $Time = time();
     
    256256  }
    257257
    258   function ProcessTableUpdates()
     258  function ProcessTableUpdates(): string
    259259  {
    260260    // Update customers
     
    277277  }
    278278
    279   function ProcessMonthlyPayment()
     279  function ProcessMonthlyPayment(): string
    280280  {
    281281    if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'Manage')) return 'Nemáte oprávnění';
     
    344344  }
    345345
    346   function SendPaymentEmail($MemberId, $FileId = '')
     346  function SendPaymentEmail(string $MemberId, string $FileId = ''): string
    347347  {
    348348    global $Config;
     
    418418  }
    419419
    420   function GenerateInvoice($Where)
     420  function GenerateInvoice(string $Where): string
    421421  {
    422422    $DirectoryId = ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance->DirectoryId;
     
    447447  }
    448448
    449   function GenerateOperation($Where)
     449  function GenerateOperation(string $Where): string
    450450  {
    451451    $DirectoryId = ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance->DirectoryId;
     
    476476  }
    477477
    478   function GenerateBills()
     478  function GenerateBills(): string
    479479  {
    480480    $Output = '';
Note: See TracChangeset for help on using the changeset viewer.