Commit 4873a32c authored by phil's avatar phil

cleanup

parent 416b2cd2
......@@ -3,11 +3,9 @@
require 'active_support/core_ext/hash/conversions'
# Referenznummer (kann mehrfach auftauchen)
# 20141403006005542300012
# 000020141403006005542300012
# BkToCstmrDbtCdtNtfctn.Ntfctn.Ntry.NtryDtls
# .TxDtls.RmtInf.Strd.CdtrRefInf.ref
# NtryRef 010809651
# NtryRef
module CamtToV11
......@@ -17,12 +15,13 @@ module CamtToV11
doc = Hash.from_xml(data)
entries = doc['Document']['BkToCstmrDbtCdtNtfctn']['Ntfctn']['Ntry']
result = []
entries.each do |entry| # 4
entries.each do |entry|
entry_ref = entry['NtryRef']
book_date = entry['BookgDt']['Dt'].tr_s('-', '').slice(2,6)
value_date = entry['ValDt']['Dt'].tr_s('-', '').slice(2,6)
details = entry['NtryDtls']['TxDtls']
details.each do |detail| # 86
details.each do |detail|
tp = detail['Refs']['Prtry']['Tp']
ref = detail['RmtInf']['Strd']['CdtrRefInf']['Ref']
amount = (detail['Amt'].to_f * 100).to_i
......@@ -34,7 +33,6 @@ module CamtToV11
if tp == '01'
dat1 = detail['RltdDts']['AccptncDtTm'].tr_s('-', '').slice(2,6)
ref2 = '0000 0000'
#dat1 = '_' * 6
end
reject_code = detail['RmtInf']['Strd']['AddtlRmtInf'].slice(-1)
......@@ -43,8 +41,7 @@ module CamtToV11
cost = (charges['TtlChrgsAndTaxAmt'].to_f * 100).to_i
end
result <<
"%1s%2s%9s%27s%010d%10s%6s%6s%6s%9s%1s%9s%04d" %
result << "%1s%2s%9s%27s%010d%10s%6s%6s%6s%9s%1s%9s%04d" %
[0,
tp,
entry_ref,
......@@ -60,6 +57,7 @@ module CamtToV11
cost]
end
end
result * "\n"
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment