Changeset 719 for trunk/Modules/Finance/Import.php
- Timestamp:
- Jan 2, 2015, 11:16:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Import.php
r629 r719 120 120 } 121 121 122 function InsertMoney($Subject, $Value, $ Cash, $Taxable, $Time, $Text, $DocumentLine)122 function InsertMoney($Subject, $Value, $Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine) 123 123 { 124 124 $Year = date('Y', $Time); 125 125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); 126 // TODO: Fixed BankAccount=1 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, 128 'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction, 129 129 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode, 130 130 'BankAccount' => 1)); … … 139 139 for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--) 140 140 { 141 if($_POST['Money'.$I] < 0) $DocumentLine = 4; 142 else $DocumentLine = 3; 141 // TODO: Use links to database records instead of contants 142 if($_POST['Money'.$I] < 0) { 143 $DocumentLine = 4; 144 $Direction = -1; 145 } else { 146 $DocumentLine = 3; 147 $Direction = 1; 148 } 143 149 $Date = explode('-', $_POST['Date'.$I]); 144 150 $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]); 145 $this->InsertMoney($_POST['Subject'.$I], $_POST['Money'.$I], 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $DocumentLine);151 $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $Direction, 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $DocumentLine); 146 152 $Output .= $I.', '; 147 153 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');
Note:
See TracChangeset
for help on using the changeset viewer.