Class: Hotfile::Record::BOT94

Inherits:
Hotfile::Record show all
Defined in:
lib/hotfile/record/BOT94.rb

Overview

Office Totals per Currency Type Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BOT94

Returns a new instance of BOT94.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hotfile/record/BOT94.rb', line 7

def initialize(line)
  super

  agent_code, remittance_end_date, gross, remittance, commission, tax, commission_tax, reserved, currency =
    line.scan(/
      (\d{8})
      (\d{6})
      (\d{14}.)
      (\d{14}.)
      (\d{14}.)
      (\d{14}.)
      (\d{14}.)
      (.{30})
      ([A-Z0-9]{4})
    /x).flatten

  @data = {
    currency: currency.strip,
    agent_code: agent_code.to_i,
    remittance_end_date: Hotfile::Date.new(remittance_end_date).to_date,
    gross: Hotfile::Integer.new(gross).to_i,
    remittance: Hotfile::Integer.new(remittance).to_i,
    commission: Hotfile::Integer.new(commission).to_i,
    tax: Hotfile::Integer.new(tax).to_i,
    commission_tax: Hotfile::Integer.new(commission_tax).to_i,
    reserved: reserved.strip
  }
end