mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 10:16:01 +02:00
parent
0efd35516c
commit
0c30e8b8ee
1 changed files with 6 additions and 0 deletions
|
@ -25,10 +25,16 @@ class BankStatement < ApplicationRecord
|
||||||
bank_transactions.build(bt_params)
|
bank_transactions.build(bt_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepare_dir
|
||||||
self.import_file_path = "#{ENV['bank_statement_import_dir']}/#{Time.zone.now.to_formatted_s(:number)}.txt"
|
self.import_file_path = "#{ENV['bank_statement_import_dir']}/#{Time.zone.now.to_formatted_s(:number)}.txt"
|
||||||
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
|
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def prepare_dir
|
||||||
|
dirname = ENV['bank_statement_import_dir']
|
||||||
|
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
||||||
|
end
|
||||||
|
|
||||||
def parse_th6_row(row)
|
def parse_th6_row(row)
|
||||||
return parse_th6_header(row) if row[4, 3].strip == '000'
|
return parse_th6_header(row) if row[4, 3].strip == '000'
|
||||||
return if row[4, 3].strip == '999' # skip footer
|
return if row[4, 3].strip == '999' # skip footer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue