sie 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTQzMmU0NGU3NmVhMDY1OWM0OWJmZWMxY2I3M2IyZDJjZTVmMDRiYQ==
5
- data.tar.gz: !binary |-
6
- MWNlN2E5OWE3ZGRmZmZkNmRiZmI0MGVkNGZmMThlMDI3M2EwZjE3Yw==
2
+ SHA1:
3
+ metadata.gz: 7d659e5fad2c490c75631273aaff1e3f2f324239
4
+ data.tar.gz: 58747c9efccbe20629db22c44a7e26828c7845d2
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NGY1ZTViZWQyNGUwMzVkNjhlMDI3ZTk4NDYyODg2MjZjYTY2M2Y5YzI0NzI1
10
- NTNhODYzZmEwMWQ1ZjExYmU3YTVlMzNmMzAxNDNkNTkzOWQzMThjNGY1OTE2
11
- YzQxM2Y1ZGJhZWQ5ZDhiMzljZDk4OWQ0MmVjYjliM2RjYWE0ZGQ=
12
- data.tar.gz: !binary |-
13
- MTUyMjk5NmMwYzZkZTEyZmU5YTM3MGMwYWQ5YzQ5YzQ1OGFmODU5MmY2ODI5
14
- NmVkNTE4ZjcwNDU4YjRjZmVkNTk3MDA3ZWYyOTY0NmEyMmE0OWI1NWQxMTMz
15
- NWU3YjhlNWEwMDY5OTNlNzQzYWU3ODYzZjdlN2NhNzY1YzVhOGQ=
6
+ metadata.gz: aadf37b3489120499c12b7fbb73866dc08912aa5414897709c7ed2af24e44e0c396a28bffd52bc9bba87b35032f0709bfae196f362ac92d165c8542a8fac752e
7
+ data.tar.gz: f85919e67613b3cabaed4b2e1139d90d6e0d32de24867473462bed7209c7c04b2ada714e511eda4fac663c0139d98cbbb9207342c436e6d08dea747e9539615b
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm ruby-1.9.3-p194-falcon@sie --create
1
+ rvm ruby-2.0.0-p643@sie --create
data/README.md CHANGED
@@ -159,6 +159,11 @@ Getting the latest code and gems:
159
159
 
160
160
  script/refresh
161
161
 
162
+ ## Resources
163
+
164
+ [SIE format specification rev 4B (swedish)](http://www.sie.se/wp-content/uploads/2014/01/SIE_filformat_ver_4B_080930.pdf)
165
+
166
+
162
167
  ## Contributing
163
168
 
164
169
  1. Fork it
data/lib/sie/document.rb CHANGED
@@ -63,6 +63,11 @@ module Sie
63
63
  def add_balance_rows(label, year_index, account_numbers, date, &block)
64
64
  account_numbers.each do |account_number|
65
65
  balance = balance_before(account_number, date)
66
+
67
+ # Accounts with no balance should not be in the SIE-file.
68
+ # See paragraph 5.17 in the SIE file format guide (Rev. 4B).
69
+ next unless balance
70
+
66
71
  add_line(label, year_index, account_number, balance)
67
72
  end
68
73
  end
data/lib/sie/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Sie
2
2
  # For versioning see: http://semver.org/
3
- VERSION = "3.0.0"
3
+ VERSION = "3.0.1"
4
4
  end
@@ -2,15 +2,16 @@ require "spec_helper"
2
2
  require "sie/parser/build_entry"
3
3
  require "sie/parser/tokenizer"
4
4
 
5
- describe Sie::Parser::BuildEntry, "call" do
5
+ describe Sie::Parser::BuildEntry, ".call" do
6
6
  context "with an unexpected token at start of array" do
7
7
  it "raises InvalidEntryError" do
8
8
  line = '#TRANS 2400 [] -200 20130101 "Foocorp expense"'
9
9
  tokens = Sie::Parser::Tokenizer.new(line).tokenize
10
10
  first_token = tokens.shift
11
- build_entry = Sie::Parser::BuildEntry.new(line, first_token, tokens, false)
12
11
 
13
- expect { build_entry.call }.to raise_error(Sie::Parser::BuildEntry::InvalidEntryError)
12
+ expect {
13
+ Sie::Parser::BuildEntry.call(line, first_token, tokens, false)
14
+ }.to raise_error(Sie::Parser::BuildEntry::InvalidEntryError)
14
15
  end
15
16
  end
16
17
  end
@@ -78,8 +78,13 @@ describe Sie::Document, "#render" do
78
78
  end
79
79
 
80
80
  def balance_before(account_number, date)
81
- # Faking a fetch based on date and number
82
- account_number.to_i + (date.mday * 100).to_f
81
+ if account_number == 9999
82
+ # So we can test empty balances.
83
+ nil
84
+ else
85
+ # Faking a fetch based on date and number.
86
+ account_number.to_i + (date.mday * 100).to_f
87
+ end
83
88
  end
84
89
  end
85
90
 
@@ -92,8 +97,8 @@ describe Sie::Document, "#render" do
92
97
  generated_on: generated_on,
93
98
  company_name: "Foocorp",
94
99
  financial_years: financial_years,
95
- balance_account_numbers: [ 1500, 2400 ],
96
- closing_account_numbers: [ 3100 ],
100
+ balance_account_numbers: [ 1500, 2400, 9999 ],
101
+ closing_account_numbers: [ 3100, 9999 ],
97
102
  dimensions: dimensions
98
103
  )
99
104
  Sie::Document.new(data_source)
@@ -136,27 +141,30 @@ describe Sie::Document, "#render" do
136
141
  end
137
142
 
138
143
  it "has balances brought forward (ingående balans)" do
139
- expect(indexed_entry_attributes("ib", 0)).to eq("arsnr" => "0", "konto" => "1500", "saldo" => "1600.0")
140
- expect(indexed_entry_attributes("ib", 1)).to eq("arsnr" => "0", "konto" => "2400", "saldo" => "2500.0")
141
- expect(indexed_entry_attributes("ib", 2)).to eq("arsnr" => "-1", "konto" => "1500", "saldo" => "1600.0")
142
- expect(indexed_entry_attributes("ib", 3)).to eq("arsnr" => "-1", "konto" => "2400", "saldo" => "2500.0")
143
- expect(indexed_entry_attributes("ib", 4)).to eq("arsnr" => "-2", "konto" => "1500", "saldo" => "1600.0")
144
- expect(indexed_entry_attributes("ib", 5)).to eq("arsnr" => "-2", "konto" => "2400", "saldo" => "2500.0")
144
+ expect(indexed_entry_attributes("ib", 0)).not_to eq("arsnr" => "0", "konto" => "9999", "saldo" => "")
145
+ expect(indexed_entry_attributes("ib", 0)).to eq("arsnr" => "0", "konto" => "1500", "saldo" => "1600.0")
146
+ expect(indexed_entry_attributes("ib", 1)).to eq("arsnr" => "0", "konto" => "2400", "saldo" => "2500.0")
147
+ expect(indexed_entry_attributes("ib", 2)).to eq("arsnr" => "-1", "konto" => "1500", "saldo" => "1600.0")
148
+ expect(indexed_entry_attributes("ib", 3)).to eq("arsnr" => "-1", "konto" => "2400", "saldo" => "2500.0")
149
+ expect(indexed_entry_attributes("ib", 4)).to eq("arsnr" => "-2", "konto" => "1500", "saldo" => "1600.0")
150
+ expect(indexed_entry_attributes("ib", 5)).to eq("arsnr" => "-2", "konto" => "2400", "saldo" => "2500.0")
145
151
  end
146
152
 
147
153
  it "has balances carried forward (utgående balans)" do
148
- expect(indexed_entry_attributes("ub", 0)).to eq("arsnr" => "0", "konto" => "1500", "saldo" => "4600.0")
149
- expect(indexed_entry_attributes("ub", 1)).to eq("arsnr" => "0", "konto" => "2400", "saldo" => "5500.0")
150
- expect(indexed_entry_attributes("ub", 2)).to eq("arsnr" => "-1", "konto" => "1500", "saldo" => "4600.0")
151
- expect(indexed_entry_attributes("ub", 3)).to eq("arsnr" => "-1", "konto" => "2400", "saldo" => "5500.0")
152
- expect(indexed_entry_attributes("ub", 4)).to eq("arsnr" => "-2", "konto" => "1500", "saldo" => "4600.0")
153
- expect(indexed_entry_attributes("ub", 5)).to eq("arsnr" => "-2", "konto" => "2400", "saldo" => "5500.0")
154
+ expect(indexed_entry_attributes("ub", 0)).not_to eq("arsnr" => "0", "konto" => "9999", "saldo" => "")
155
+ expect(indexed_entry_attributes("ub", 0)).to eq("arsnr" => "0", "konto" => "1500", "saldo" => "4600.0")
156
+ expect(indexed_entry_attributes("ub", 1)).to eq("arsnr" => "0", "konto" => "2400", "saldo" => "5500.0")
157
+ expect(indexed_entry_attributes("ub", 2)).to eq("arsnr" => "-1", "konto" => "1500", "saldo" => "4600.0")
158
+ expect(indexed_entry_attributes("ub", 3)).to eq("arsnr" => "-1", "konto" => "2400", "saldo" => "5500.0")
159
+ expect(indexed_entry_attributes("ub", 4)).to eq("arsnr" => "-2", "konto" => "1500", "saldo" => "4600.0")
160
+ expect(indexed_entry_attributes("ub", 5)).to eq("arsnr" => "-2", "konto" => "2400", "saldo" => "5500.0")
154
161
  end
155
162
 
156
163
  it "has closing account balances (saldo för resultatkonto)" do
157
- expect(indexed_entry_attributes("res", 0)).to eq("ars" => "0", "konto" => "3100", "saldo" => "6200.0")
158
- expect(indexed_entry_attributes("res", 1)).to eq("ars" => "-1", "konto" => "3100", "saldo" => "6200.0")
159
- expect(indexed_entry_attributes("res", 2)).to eq("ars" => "-2", "konto" => "3100", "saldo" => "6200.0")
164
+ expect(indexed_entry_attributes("res", 0)).not_to eq("ars" => "0", "konto" => "9999", "saldo" => "")
165
+ expect(indexed_entry_attributes("res", 0)).to eq("ars" => "0", "konto" => "3100", "saldo" => "6200.0")
166
+ expect(indexed_entry_attributes("res", 1)).to eq("ars" => "-1", "konto" => "3100", "saldo" => "6200.0")
167
+ expect(indexed_entry_attributes("res", 2)).to eq("ars" => "-2", "konto" => "3100", "saldo" => "6200.0")
160
168
  end
161
169
 
162
170
  it "has vouchers" do
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barsoom AB
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_extras
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
@@ -56,28 +56,28 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: SIE parser and generator
@@ -134,12 +134,12 @@ require_paths:
134
134
  - lib
135
135
  required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ! '>='
137
+ - - '>='
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ! '>='
142
+ - - '>='
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []