Ignore:
Timestamp:
Jan 3, 2015, 5:55:34 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Invoice negative values replaced by Direction column which is used to determine if invoice is in or out invoice.
File:
1 edited

Legend:

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

    r719 r720  
    186186    while($Member = $DbResult->fetch_assoc())
    187187    {
    188       $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(-Value*Direction), 0) FROM FinanceOperation '.
    189           'WHERE Subject='.$Member['Subject'].') + (SELECT COALESCE(SUM(-Value), 0) FROM FinanceInvoice '.
    190           'WHERE Subject='.$Member['Subject'].')) as Cash');
     188      $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(-SUM(Value*Direction), 0) FROM FinanceOperation '.
     189          'WHERE Subject='.$Member['Subject'].') + (SELECT COALESCE(-SUM(Value*Direction), 0) FROM FinanceInvoice '.
     190          'WHERE Subject='.$Member['Subject'].')) AS Cash');
    191191      $Cash = $DbResult2->fetch_row();
    192192      $Cash = $Cash[0];
     
    277277      'DefaultSortOrder' => 1,
    278278      'Items' => array(
    279         'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '1'),
     279        'Direction' => array('Type' => 'TFinanceOperationDirection', 'Caption' => 'Směr', 'Default' => '1'),
    280280        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    281281        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
     
    337337    $this->System->FormManager->Classes['FinanceAccountOut']['Items']['Treasury']['Hidden'] = true;
    338338   
    339     $this->System->FormManager->RegisterFormType('TFinanceDirection', array(
     339    $this->System->FormManager->RegisterFormType('TFinanceOperationDirection', array(
    340340      'Type' => 'Enumeration',
    341341      'States' => array(-1 => 'Výdej', 1 => 'Příjem'),
     
    347347      'DefaultSortOrder' => 1,
    348348      'Items' => array(
    349         'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
     349        'Direction' => array('Type' => 'TFinanceInvoiceDirection', 'Caption' => 'Směr', 'Default' => '1'),
     350        'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),
    350351        'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
    351352        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
     
    367368      'BeforeInsert' => array($this, 'BeforeInsertFinanceOperation'),
    368369    ));
     370    $this->System->FormManager->RegisterClass('FinanceInvoiceIn', $this->System->FormManager->Classes['FinanceInvoice']);
     371    $this->System->FormManager->Classes['FinanceInvoiceIn']['Title'] = 'Přijaté faktury';
     372    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Direction']['Default'] = -1;
     373    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Direction']['Hidden'] = true;
     374    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Direction']['Filter'] = true;
     375    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['DocumentLine']['Default'] = DOC_LINE_INVOICE_IN;
     376    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['DocumentLine']['Hidden'] = true;
     377    $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['DocumentLine']['Filter'] = true;
     378       
     379    $this->System->FormManager->RegisterClass('FinanceInvoiceOut', $this->System->FormManager->Classes['FinanceInvoice']);
     380    $this->System->FormManager->Classes['FinanceInvoiceOut']['Title'] = 'Vydané faktury';
     381    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Direction']['Default'] = 1;
     382    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Direction']['Hidden'] = true;
     383    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Direction']['Filter'] = true;
     384    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['DocumentLine']['Default'] = DOC_LINE_INVOICE_OUT;
     385    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['DocumentLine']['Hidden'] = true;
     386    $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['DocumentLine']['Filter'] = true;
     387
     388    $this->System->FormManager->RegisterFormType('TFinanceInvoiceDirection', array(
     389                'Type' => 'Enumeration',
     390                'States' => array(-1 => 'Příjem', 1 => 'Výdej'),
     391    ));
     392   
    369393    $this->System->FormManager->RegisterClass('Company', array(
    370394      'Title' => 'Firma',
Note: See TracChangeset for help on using the changeset viewer.