Changeset 738 for trunk/Modules/Finance/Import.php
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Import.php
r719 r738 25 25 } 26 26 } 27 27 28 28 function Prepare() 29 { 29 { 30 30 $Finance = $this->System->Modules['Finance']; 31 31 $Finance->LoadMonthParameters(0); … … 39 39 { 40 40 if(substr($Data[$Key][$Key2], 0, 2) == '\"') 41 $Data[$Key][$Key2] = substr($Data[$Key][$Key2], 2, -2); 41 $Data[$Key][$Key2] = substr($Data[$Key][$Key2], 2, -2); 42 42 } 43 43 } 44 44 $Header = array( 45 0 => 'datum zaúčtování', 45 0 => 'datum zaúčtování', 46 46 1 => 'částka', 47 47 2 => 'měna', … … 60 60 //print_r($_POST['Source']); 61 61 //print_r($Data); 62 62 63 63 if($Header != $Data[0]) $Output = 'Nekompatibilní struktura CSV'; 64 else 64 else 65 65 { 66 66 array_shift($Data); … … 85 85 $Subject = '? ('.$Value[5].')'; 86 86 } 87 if(!is_numeric($Subject)) 87 if(!is_numeric($Subject)) 88 88 { 89 89 $Mode = 'Ručně'; 90 90 $Style = 'style="background-color: LightPink;" '; 91 } else 91 } else 92 92 { 93 93 $Mode = 'Automaticky'; 94 94 $Style = ''; 95 95 } 96 96 97 97 if($Money < 0) $Text = 'Platba převodem'; 98 98 else $Text = 'Přijatá platba'; … … 106 106 '<td><input type="text" name="Taxable'.$I.'" value="1"/></td>'. 107 107 '<td><input type="text" name="Network'.$I.'" value="1"/></td>'. 108 '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>'; 108 '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>'; 109 109 $I++; 110 110 } … … 114 114 '<th>Datum</th><th>Var. symbol</th><th>Protiúčet</th><th>Částka [Kč]</th><th>Text</th><th>Zdanitelné</th><th>Síť</th></tr>'; 115 115 $Output .= $Automatic.'</table>'; 116 $Output .= '<input type="hidden" name="ItemCount" value="'.$I.'"/>'; 117 $Output .= '<input type="submit" value="Zpracovat"/></form>'; 116 $Output .= '<input type="hidden" name="ItemCount" value="'.$I.'"/>'; 117 $Output .= '<input type="submit" value="Zpracovat"/></form>'; 118 118 } 119 119 return($Output); 120 120 } 121 121 122 122 function InsertMoney($Subject, $Value, $Direction, $Cash, $Taxable, $Time, $Text, $DocumentLine) 123 123 { … … 125 125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); 126 126 // TODO: Fixed BankAccount=1, allow to select bank account for import 127 $this->Database->insert('FinanceOperation', array('Text' => $Text, 128 'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction, 127 $this->Database->insert('FinanceOperation', array('Text' => $Text, 128 'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Direction' => $Direction, 129 129 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode, 130 130 'BankAccount' => 1)); … … 136 136 $Finance->LoadMonthParameters(0); 137 137 $Output = ''; 138 138 139 139 for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--) 140 140 { 141 141 // TODO: Use links to database records instead of contants 142 142 if($_POST['Money'.$I] < 0) { 143 144 143 $DocumentLine = 4; 144 $Direction = -1; 145 145 } else { 146 147 146 $DocumentLine = 3; 147 $Direction = 1; 148 148 } 149 149 $Date = explode('-', $_POST['Date'.$I]);
Note:
See TracChangeset
for help on using the changeset viewer.