Changeset 873 for trunk/Modules/FinanceBankAPI/ImportPS.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/FinanceBankAPI/ImportPS.php
r738 r873 5 5 function ImportFile($Content, $Ext) 6 6 { 7 if ($Ext == 'txt') $this->ImportTxt($Content);8 else if ($Ext == 'cvs') $this->ImportCVS($Content);7 if ($Ext == 'txt') $this->ImportTxt($Content); 8 else if ($Ext == 'cvs') $this->ImportCVS($Content); 9 9 } 10 10 … … 20 20 21 21 $Data = explode("\n", $Content); 22 foreach ($Data as $Key => $Value)22 foreach ($Data as $Key => $Value) 23 23 { 24 24 $Value = str_replace('\"', '"', $Value); 25 25 $Data[$Key] = str_getcsv($Value, ',', '"', "\\"); 26 26 //print_r($Data[$Key]); 27 foreach ($Data[$Key] as $Key2 => $Value2)27 foreach ($Data[$Key] as $Key2 => $Value2) 28 28 { 29 if (substr($Data[$Key][$Key2], 0, 2) == '\"')29 if (substr($Data[$Key][$Key2], 0, 2) == '\"') 30 30 $Data[$Key][$Key2] = substr($Data[$Key][$Key2], 2, -2); 31 31 } … … 46 46 ); 47 47 48 if ($Header != $Data[0]) $Output = 'Nekompatibilní struktura CSV';48 if ($Header != $Data[0]) $Output = 'Nekompatibilní struktura CSV'; 49 49 else 50 50 { … … 54 54 $Output = '<form action="?Operation=insert" method="post">'; 55 55 $I = 0; 56 foreach ($Data as $Key => $Value)56 foreach ($Data as $Key => $Value) 57 57 { 58 if (count($Value) <= 1) continue;59 if ($Value[9] == '') $Value[5] = 128; // Žádný účet => Poštovní spořitelna58 if (count($Value) <= 1) continue; 59 if ($Value[9] == '') $Value[5] = 128; // Žádný účet => Poštovní spořitelna 60 60 $Time = explode('.', $Value[0]); 61 61 $Time = $Time[2].'-'.$Time[1].'-'.$Time[0]; 62 62 $Money = $Value[1]; 63 if (is_numeric($Value[5]))63 if (is_numeric($Value[5])) 64 64 { 65 65 $Subject = $Value[5] * 1; 66 66 $DbResult = $this->Database->query('SELECT Id FROM Subject WHERE Id='.$this->Database->real_escape_string($Subject)); 67 if ($DbResult->num_rows == 0) $Subject = '? ('.($Value[5] * 1).')';67 if ($DbResult->num_rows == 0) $Subject = '? ('.($Value[5] * 1).')'; 68 68 } else 69 69 { 70 70 $Subject = '? ('.$Value[5].')'; 71 71 } 72 if (!is_numeric($Subject))72 if (!is_numeric($Subject)) 73 73 { 74 74 $Mode = 'Ručně'; … … 80 80 } 81 81 82 if ($Money < 0) $Text = 'Platba převodem';82 if ($Money < 0) $Text = 'Platba převodem'; 83 83 else $Text = 'Přijatá platba'; 84 84 $Automatic .= '<tr>'.
Note:
See TracChangeset
for help on using the changeset viewer.