Changeset 740 for trunk/Modules/Finance/Import.php
- Timestamp:
- Jul 3, 2015, 11:36:07 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Import.php
r738 r740 120 120 } 121 121 122 function InsertMoney($Subject, $Value, $ Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine)122 function InsertMoney($Subject, $Value, $ValueSign, $Cash, $Taxable, $Time, $Text, $Group) 123 123 { 124 124 $Year = date('Y', $Time); 125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($ DocumentLine, $Year);125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($Group['DocumentLine'], $Year); 126 126 // TODO: Fixed BankAccount=1, allow to select bank account for import 127 127 $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, 129 129 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode, 130 'BankAccount' => 1 ));130 'BankAccount' => 1, 'Group' => $Group['Id'])); 131 131 } 132 132 … … 139 139 for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--) 140 140 { 141 // TODO: Use links to database records instead of contants142 141 if($_POST['Money'.$I] < 0) { 143 $DocumentLine = 4; 144 $Direction = -1; 142 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 145 143 } else { 146 $DocumentLine = 3; 147 $Direction = 1; 144 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 148 145 } 149 146 $Date = explode('-', $_POST['Date'.$I]); 150 147 $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); 152 150 $Output .= $I.', '; 153 151 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');
Note:
See TracChangeset
for help on using the changeset viewer.