datev 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/examples/EXTF_Kontenbeschriftungen.csv +5 -0
- data/lib/datev.rb +4 -1
- data/lib/datev/account.rb +21 -0
- data/lib/datev/account_export.rb +10 -0
- data/lib/datev/account_header.rb +16 -0
- data/lib/datev/base.rb +9 -4
- data/lib/datev/booking.rb +1 -1
- data/lib/datev/booking_export.rb +10 -0
- data/lib/datev/booking_header.rb +18 -0
- data/lib/datev/export.rb +7 -4
- data/lib/datev/field.rb +1 -1
- data/lib/datev/header.rb +0 -21
- data/lib/datev/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be98f6189b13517bf847be2bdddc9ce7f68eb65
|
4
|
+
data.tar.gz: 3e8ce045af515ed7d627a0e4ffca52b16b7e1059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a002ffda0f1be07af7bb3e17e188b61c449e571f638a097c4c7ac64bc67b977a45e629aa9cba19a5108e5fb0a594a2121d584cd43aa0d34d270a351da0f4cf
|
7
|
+
data.tar.gz: bbe6649cf4e9fa92e0e0ffb336b4617604939ab46467a2aa4fc2b3db4f0c77127b8b51226d72b757d7d8705838cdc4579fbe61713229d0e59875afaebfee4c3c
|
data/README.md
CHANGED
data/lib/datev.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'datev/base'
|
2
|
+
|
3
|
+
module Datev
|
4
|
+
class Account < Base
|
5
|
+
# http://www.datev.de/dnlexom/client/app/index.html#/document/1036228/D103622800011
|
6
|
+
|
7
|
+
# 1
|
8
|
+
field 'Konto', :integer, :limit => 8, :required => true
|
9
|
+
# Sachkontennummer (max. 8-stellig).
|
10
|
+
|
11
|
+
# 2
|
12
|
+
field 'Kontenbeschriftung', :string, :limit => 40
|
13
|
+
# Beschriftung des Sachkontos
|
14
|
+
|
15
|
+
# 3
|
16
|
+
field 'Sprach-ID', :string, :limit => 5
|
17
|
+
# Sprach-ID der Kontenbeschriftung
|
18
|
+
# de-DE = Deutsch
|
19
|
+
# en-GB = Englisch
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'datev/base'
|
2
|
+
|
3
|
+
module Datev
|
4
|
+
class AccountHeader < Header
|
5
|
+
self.default_attributes = {
|
6
|
+
'DATEV-Format-KZ' => 'EXTF',
|
7
|
+
'Versionsnummer' => 510,
|
8
|
+
'Datenkategorie' => 20,
|
9
|
+
'Formatname' => 'Kontenbeschriftungen',
|
10
|
+
'Formatversion' => 2,
|
11
|
+
'Erzeugt am' => Time.now.utc,
|
12
|
+
'Sachkontenlänge' => 4,
|
13
|
+
'Bezeichnung' => 'Kontenbeschriftungen'
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
data/lib/datev/base.rb
CHANGED
@@ -3,10 +3,13 @@ require 'datev/field'
|
|
3
3
|
module Datev
|
4
4
|
class Base
|
5
5
|
class << self
|
6
|
-
attr_accessor :fields
|
7
|
-
end
|
6
|
+
attr_accessor :fields, :default_attributes
|
8
7
|
|
9
|
-
|
8
|
+
def inherited(subclass)
|
9
|
+
subclass.fields = self.fields
|
10
|
+
subclass.default_attributes = self.default_attributes
|
11
|
+
end
|
12
|
+
end
|
10
13
|
|
11
14
|
def self.field(name, type, options={}, &block)
|
12
15
|
self.fields ||= []
|
@@ -23,8 +26,10 @@ module Datev
|
|
23
26
|
self.fields.find { |f| f.name == name }
|
24
27
|
end
|
25
28
|
|
29
|
+
attr_accessor :attributes
|
30
|
+
|
26
31
|
def initialize(attributes)
|
27
|
-
self.attributes = {}
|
32
|
+
self.attributes = self.class.default_attributes || {}
|
28
33
|
|
29
34
|
raise ArgumentError.new('Hash required') unless attributes.is_a?(Hash)
|
30
35
|
|
data/lib/datev/booking.rb
CHANGED
@@ -2,7 +2,7 @@ require 'datev/base'
|
|
2
2
|
|
3
3
|
module Datev
|
4
4
|
class Booking < Base
|
5
|
-
# http://www.datev.de/dnlexom/client/app/index.html#/document/1036228
|
5
|
+
# http://www.datev.de/dnlexom/client/app/index.html#/document/1036228/D103622800010
|
6
6
|
|
7
7
|
# 1
|
8
8
|
field 'Umsatz (ohne Soll/Haben-Kz)', :decimal, :precision => 12, :scale => 2, :required => true
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'datev/base'
|
2
|
+
|
3
|
+
module Datev
|
4
|
+
class BookingHeader < Header
|
5
|
+
self.default_attributes = {
|
6
|
+
'DATEV-Format-KZ' => 'EXTF',
|
7
|
+
'Versionsnummer' => 510,
|
8
|
+
'Datenkategorie' => 21,
|
9
|
+
'Formatname' => 'Buchungsstapel',
|
10
|
+
'Formatversion' => 7,
|
11
|
+
'Erzeugt am' => Time.now.utc,
|
12
|
+
'Sachkontenlänge' => 4,
|
13
|
+
'Bezeichnung' => 'Buchungen',
|
14
|
+
'Buchungstyp' => 1,
|
15
|
+
'WKZ' => 'EUR'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
data/lib/datev/export.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'csv'
|
2
2
|
require 'datev/header'
|
3
|
-
require 'datev/booking'
|
4
3
|
|
5
4
|
module Datev
|
6
5
|
class Export
|
7
6
|
CSV_OPTIONS = { :col_sep => ';', :encoding => 'windows-1252' }
|
8
7
|
|
8
|
+
class << self
|
9
|
+
attr_accessor :header_class, :row_class
|
10
|
+
end
|
11
|
+
|
9
12
|
def initialize(header_attributes)
|
10
|
-
@header =
|
13
|
+
@header = self.class.header_class.new(header_attributes)
|
11
14
|
@rows = []
|
12
15
|
end
|
13
16
|
|
14
17
|
def <<(attributes)
|
15
|
-
@rows <<
|
18
|
+
@rows << self.class.row_class.new(attributes)
|
16
19
|
end
|
17
20
|
|
18
21
|
def to_s
|
@@ -31,7 +34,7 @@ module Datev
|
|
31
34
|
|
32
35
|
def write(csv)
|
33
36
|
csv << @header.output
|
34
|
-
csv <<
|
37
|
+
csv << self.class.row_class.fields.map(&:name)
|
35
38
|
|
36
39
|
@rows.each do |row|
|
37
40
|
csv << row.output(@header)
|
data/lib/datev/field.rb
CHANGED
data/lib/datev/header.rb
CHANGED
@@ -2,24 +2,6 @@ require 'datev/base'
|
|
2
2
|
|
3
3
|
module Datev
|
4
4
|
class Header < Base
|
5
|
-
DEFAULT_ATTRIBUTES = {
|
6
|
-
'DATEV-Format-KZ' => 'EXTF',
|
7
|
-
'Versionsnummer' => 510,
|
8
|
-
'Datenkategorie' => 21,
|
9
|
-
'Formatname' => 'Buchungsstapel',
|
10
|
-
'Formatversion' => 7,
|
11
|
-
'Erzeugt am' => Time.now.utc,
|
12
|
-
'Sachkontenlänge' => 4,
|
13
|
-
'Bezeichnung' => 'Buchungen',
|
14
|
-
'Buchungstyp' => 1,
|
15
|
-
'WKZ' => 'EUR'
|
16
|
-
}
|
17
|
-
|
18
|
-
def initialize(attributes={})
|
19
|
-
raise ArgumentError.new('Hash required') unless attributes.is_a?(Hash)
|
20
|
-
super DEFAULT_ATTRIBUTES.merge(attributes)
|
21
|
-
end
|
22
|
-
|
23
5
|
# 1
|
24
6
|
field 'DATEV-Format-KZ', :string, :limit => 4
|
25
7
|
# vom Datev angegeben
|
@@ -32,17 +14,14 @@ module Datev
|
|
32
14
|
# 3
|
33
15
|
field 'Datenkategorie', :integer, :limit => 2
|
34
16
|
# vom Datev angegeben
|
35
|
-
# Buchungsstapel = 21
|
36
17
|
|
37
18
|
# 4
|
38
19
|
field 'Formatname', :string
|
39
20
|
# vom Datev angegeben
|
40
|
-
# 'Buchungsstapel'
|
41
21
|
|
42
22
|
# 5
|
43
23
|
field 'Formatversion', :integer, :limit => 3
|
44
24
|
# vom Datev angegeben
|
45
|
-
# Buchungsstapel = 2
|
46
25
|
|
47
26
|
# 6
|
48
27
|
field 'Erzeugt am', :date, :format => '%Y%m%d%H%M%S%L'
|
data/lib/datev/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,9 +100,15 @@ files:
|
|
100
100
|
- bin/setup
|
101
101
|
- datev.gemspec
|
102
102
|
- examples/EXTF_Buchungsstapel.csv
|
103
|
+
- examples/EXTF_Kontenbeschriftungen.csv
|
103
104
|
- lib/datev.rb
|
105
|
+
- lib/datev/account.rb
|
106
|
+
- lib/datev/account_export.rb
|
107
|
+
- lib/datev/account_header.rb
|
104
108
|
- lib/datev/base.rb
|
105
109
|
- lib/datev/booking.rb
|
110
|
+
- lib/datev/booking_export.rb
|
111
|
+
- lib/datev/booking_header.rb
|
106
112
|
- lib/datev/export.rb
|
107
113
|
- lib/datev/field.rb
|
108
114
|
- lib/datev/header.rb
|