Ignore:
Timestamp:
Sep 30, 2015, 11:55:11 PM (9 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

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

    r747 r748  
    1717define('INVOICE_GROUP_OUT', 2);
    1818define('VAT_TYPE_BASE', 2);
    19 define('FINANCE_DIRECTION_OUT', 0);
    20 define('FINANCE_DIRECTION_IN', 1);
     19define('FINANCE_DIRECTION_OUT', 1);
     20define('FINANCE_DIRECTION_IN', 0);
    2121
    2222class Finance extends Model
     
    3939  var $BillingPeriods;
    4040  var $DirectoryId;
     41  var $Rounding;
    4142
    4243  function LoadMonthParameters($Period = 1) // 0 - now, 1 - next month
     
    7475    $this->TotalInternetPaid = $Row['MonthlyInternet'];
    7576    $this->TotalPaid = $Row['MonthlyTotal'];
     77    $this->Rounding = $this->System->Config['Finance']['Rounding'];
    7678  }
    7779
     
    293295        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => '0'),
    294296        'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'),
    295         'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'),
     297        'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'),
    296298      ),
    297299    ));
     
    325327        'Value' => array('Type' => 'Integer', 'Caption' => 'Částka absolutní', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true),
    326328        'ValueUser' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,
    327           'SQL' => 'SELECT SUM(CEIL(`Price`*`Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=#Id'),
     329          'SQL' => 'SELECT ROUND(SUM(`Price`*`Quantity`), '.$Config['Finance']['Rounding'].') FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=#Id'),
     330        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
    328331        'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''),
    329332        'PeriodFrom' => array('Type' => 'Date', 'Caption' => 'Období od', 'Default' => '', 'Null' => true),
     
    390393        'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '21', 'Suffix' => '%'),
    391394        'Total' => array('Type' => 'Integer', 'Caption' => 'Celkem', 'Default' => '', 'Suffix' => 'Kč',
    392           'ReadOnly' => true, 'SQL' => 'CEIL(`Price` * `Quantity`)'),
     395          'ReadOnly' => true, 'SQL' => 'ROUND(`Price` * `Quantity`, '.$Config['Finance']['Rounding'].')'),
    393396      ),
    394397      'AfterInsert' => array($this, 'AfterInsertFinanceInvoiceItem'),
Note: See TracChangeset for help on using the changeset viewer.