Ignore:
Timestamp:
Sep 21, 2015, 12:12:26 AM (9 years ago)
Author:
chronos
Message:

This solves problem with inconsistency between invoice and invoice items values and inconsistency between selected document line and incorrect positive or negative values.

File:
1 edited

Legend:

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

    r740 r747  
    120120  }
    121121
    122   function InsertMoney($Subject, $Value, $ValueSign, $Cash, $Taxable, $Time, $Text, $Group)
     122  function InsertMoney($Subject, $Value, $Cash, $Taxable, $Time, $Text, $Group)
    123123  {
    124124    $Year = date('Y', $Time);
    125     $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($Group['DocumentLine'], $Year);
     125    $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($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, 'ValueSign' => $ValueSign,
     128      'Subject' => $Subject, 'Cash' => $Cash, 'ValueUser' => $Value, 'Value' => $Value * $Group['ValueSign'],
    129129      'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode,
    130130      'BankAccount' => 1, 'Group' => $Group['Id']));
     131    // TODO: Update Value
    131132  }
    132133
     
    146147      $Date = explode('-', $_POST['Date'.$I]);
    147148      $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]);
    148       $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $FinanceGroup['ValueSign'],
     149      $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]),
    149150        0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $FinanceGroup);
    150151      $Output .= $I.', ';
Note: See TracChangeset for help on using the changeset viewer.