Ignore:
Timestamp:
Jul 3, 2015, 11:36:07 PM (9 years ago)
Author:
chronos
Message:

to group id instead of DocumentLine.

File:
1 edited

Legend:

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

    r738 r740  
    120120  }
    121121
    122   function InsertMoney($Subject, $Value, $Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine)
     122  function InsertMoney($Subject, $Value, $ValueSign, $Cash, $Taxable, $Time, $Text, $Group)
    123123  {
    124124    $Year = date('Y', $Time);
    125     $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year);
     125    $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($Group['DocumentLine'], $Year);
    126126    // TODO: Fixed BankAccount=1, allow to select bank account for import
    127127    $this->Database->insert('FinanceOperation', array('Text' => $Text,
    128       'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction,
     128      'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'ValueSign' => $ValueSign,
    129129      'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode,
    130       'BankAccount' => 1));
     130      'BankAccount' => 1, 'Group' => $Group['Id']));
    131131  }
    132132
     
    139139    for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--)
    140140    {
    141       // TODO: Use links to database records instead of contants
    142141      if($_POST['Money'.$I] < 0) {
    143         $DocumentLine = 4;
    144         $Direction = -1;
     142        $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
    145143      } else {
    146         $DocumentLine = 3;
    147         $Direction = 1;
     144        $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
    148145      }
    149146      $Date = explode('-', $_POST['Date'.$I]);
    150147      $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]);
    151       $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $Direction, 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $DocumentLine);
     148      $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $FinanceGroup['ValueSign'],
     149        0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $FinanceGroup);
    152150      $Output .= $I.', ';
    153151      $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');
Note: See TracChangeset for help on using the changeset viewer.