lohnausweis 0.1.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 +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/lohnausweis/daten.rb +142 -0
- data/lib/lohnausweis/daten_eintrag.rb +136 -0
- data/lib/lohnausweis/pdf_generator.rb +129 -0
- data/lib/lohnausweis/rohdaten.rb +92 -0
- data/lib/lohnausweis/version.rb +5 -0
- data/lib/lohnausweis.rb +25 -0
- data/locale/de.yml +133 -0
- data/lohnausweis.gemspec +26 -0
- data/mit_korrektur_januar.pdf +1089 -0
- data/sandbox/mit_korrektur_januar.pdf +168 -0
- data/sandbox/test_bounding_box.rb +69 -0
- data/spec/lohnausweis/daten_eintrag_spec.rb +74 -0
- data/spec/lohnausweis/daten_spec.rb +11 -0
- data/spec/lohnausweis/pdf_generator_spec.rb +35 -0
- data/spec/spec_helper.rb +8 -0
- metadata +111 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Catalog
|
10
|
+
/Pages 3 0 R
|
11
|
+
>>
|
12
|
+
endobj
|
13
|
+
3 0 obj
|
14
|
+
<< /Type /Pages
|
15
|
+
/Count 3
|
16
|
+
/Kids [5 0 R 8 0 R 10 0 R]
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 174
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
q
|
24
|
+
|
25
|
+
BT
|
26
|
+
36 747.384 Td
|
27
|
+
/F1.0 12 Tf
|
28
|
+
[<4469656e7374706c616e>] TJ
|
29
|
+
ET
|
30
|
+
|
31
|
+
|
32
|
+
BT
|
33
|
+
40 83.51199999999993 Td
|
34
|
+
/F1.0 12 Tf
|
35
|
+
[<31>] TJ
|
36
|
+
ET
|
37
|
+
|
38
|
+
|
39
|
+
BT
|
40
|
+
40 69.63999999999993 Td
|
41
|
+
/F1.0 12 Tf
|
42
|
+
[<31>] TJ
|
43
|
+
ET
|
44
|
+
|
45
|
+
Q
|
46
|
+
|
47
|
+
endstream
|
48
|
+
endobj
|
49
|
+
5 0 obj
|
50
|
+
<< /Type /Page
|
51
|
+
/Parent 3 0 R
|
52
|
+
/MediaBox [0 0 612.0 792.0]
|
53
|
+
/Contents 4 0 R
|
54
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
55
|
+
/Font << /F1.0 6 0 R
|
56
|
+
>>
|
57
|
+
>>
|
58
|
+
>>
|
59
|
+
endobj
|
60
|
+
6 0 obj
|
61
|
+
<< /Type /Font
|
62
|
+
/Subtype /Type1
|
63
|
+
/BaseFont /Helvetica
|
64
|
+
/Encoding /WinAnsiEncoding
|
65
|
+
>>
|
66
|
+
endobj
|
67
|
+
7 0 obj
|
68
|
+
<< /Length 112
|
69
|
+
>>
|
70
|
+
stream
|
71
|
+
q
|
72
|
+
|
73
|
+
BT
|
74
|
+
40 83.51199999999993 Td
|
75
|
+
/F1.0 12 Tf
|
76
|
+
[<31>] TJ
|
77
|
+
ET
|
78
|
+
|
79
|
+
|
80
|
+
BT
|
81
|
+
40 69.63999999999993 Td
|
82
|
+
/F1.0 12 Tf
|
83
|
+
[<31>] TJ
|
84
|
+
ET
|
85
|
+
|
86
|
+
Q
|
87
|
+
|
88
|
+
endstream
|
89
|
+
endobj
|
90
|
+
8 0 obj
|
91
|
+
<< /Type /Page
|
92
|
+
/Parent 3 0 R
|
93
|
+
/MediaBox [0 0 612.0 792.0]
|
94
|
+
/Contents 7 0 R
|
95
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
96
|
+
/Font << /F1.0 6 0 R
|
97
|
+
>>
|
98
|
+
>>
|
99
|
+
>>
|
100
|
+
endobj
|
101
|
+
9 0 obj
|
102
|
+
<< /Length 274
|
103
|
+
>>
|
104
|
+
stream
|
105
|
+
q
|
106
|
+
|
107
|
+
BT
|
108
|
+
40 83.51199999999993 Td
|
109
|
+
/F1.0 12 Tf
|
110
|
+
[<31>] TJ
|
111
|
+
ET
|
112
|
+
|
113
|
+
40.000 62.128 200.000 30.000 re
|
114
|
+
S
|
115
|
+
|
116
|
+
BT
|
117
|
+
266 83.51199999999993 Td
|
118
|
+
/F1.0 12 Tf
|
119
|
+
[<32>] TJ
|
120
|
+
ET
|
121
|
+
|
122
|
+
|
123
|
+
BT
|
124
|
+
266 69.63999999999993 Td
|
125
|
+
/F1.0 12 Tf
|
126
|
+
[<32>] TJ
|
127
|
+
ET
|
128
|
+
|
129
|
+
266.000 52.128 200.000 40.000 re
|
130
|
+
S
|
131
|
+
36.000 -107.872 450.000 200.000 re
|
132
|
+
S
|
133
|
+
Q
|
134
|
+
|
135
|
+
endstream
|
136
|
+
endobj
|
137
|
+
10 0 obj
|
138
|
+
<< /Type /Page
|
139
|
+
/Parent 3 0 R
|
140
|
+
/MediaBox [0 0 612.0 792.0]
|
141
|
+
/Contents 9 0 R
|
142
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
143
|
+
/Font << /F1.0 6 0 R
|
144
|
+
>>
|
145
|
+
>>
|
146
|
+
>>
|
147
|
+
endobj
|
148
|
+
xref
|
149
|
+
0 11
|
150
|
+
0000000000 65535 f
|
151
|
+
0000000015 00000 n
|
152
|
+
0000000109 00000 n
|
153
|
+
0000000158 00000 n
|
154
|
+
0000000228 00000 n
|
155
|
+
0000000453 00000 n
|
156
|
+
0000000631 00000 n
|
157
|
+
0000000728 00000 n
|
158
|
+
0000000891 00000 n
|
159
|
+
0000001069 00000 n
|
160
|
+
0000001394 00000 n
|
161
|
+
trailer
|
162
|
+
<< /Size 11
|
163
|
+
/Root 2 0 R
|
164
|
+
/Info 1 0 R
|
165
|
+
>>
|
166
|
+
startxref
|
167
|
+
1573
|
168
|
+
%%EOF
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "prawn"
|
2
|
+
|
3
|
+
class TestBoundingBox < Prawn::Document
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
text "Dienstplan"
|
7
|
+
|
8
|
+
move_down 650
|
9
|
+
#with_position
|
10
|
+
|
11
|
+
with_bounding_box
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def with_bounding_box
|
16
|
+
y = cursor
|
17
|
+
|
18
|
+
bounding_box([0, y], width: 450, height: 200) do
|
19
|
+
bounding_box([4, bounds.top], width: 200, height: 30) do
|
20
|
+
text "1"
|
21
|
+
text "1"
|
22
|
+
text "1"
|
23
|
+
text "1"
|
24
|
+
text "1"
|
25
|
+
#
|
26
|
+
# t = self.make_table([["x"],["b"],["c"]],
|
27
|
+
# header: true)
|
28
|
+
# t.draw
|
29
|
+
stroke_bounds
|
30
|
+
end
|
31
|
+
puts y
|
32
|
+
bounding_box([230, bounds.top], width: 200, height: 40) do
|
33
|
+
text "2"
|
34
|
+
text "2"
|
35
|
+
# text "2"
|
36
|
+
# text "2"
|
37
|
+
# text "2"
|
38
|
+
# text "2"
|
39
|
+
# t = self.make_table([["x"],["b"],["c"],["b"],["c"],["b"],["c"], ["c"],["b"],["c"]],
|
40
|
+
# header: true)
|
41
|
+
# t.draw
|
42
|
+
stroke_bounds
|
43
|
+
end
|
44
|
+
stroke_bounds
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def with_position
|
49
|
+
y = cursor
|
50
|
+
page = page_number
|
51
|
+
puts y
|
52
|
+
|
53
|
+
t = self.make_table([["x"], ["b"], ["c"], ["b"], ["c"], ["b"], ["c"], ["c"], ["b"], ["c"]],
|
54
|
+
header: true, position: :left)
|
55
|
+
t.draw
|
56
|
+
|
57
|
+
go_to_page page
|
58
|
+
move_cursor_to y
|
59
|
+
puts cursor
|
60
|
+
t = self.make_table([["x"], ["b"], ["c"], ["b"], ["c"], ["b"], ["c"], ["c"], ["b"], ["c"]],
|
61
|
+
header: true, position: 200)
|
62
|
+
t.draw
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
pdf = TestBoundingBox.new()
|
68
|
+
pdf.render_file "mit_korrektur_januar.pdf"
|
69
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Planik
|
3
|
+
module Lohnausweis
|
4
|
+
|
5
|
+
describe Eintrag do
|
6
|
+
|
7
|
+
class TestEintrag < Eintrag
|
8
|
+
attr_reader :betrag
|
9
|
+
|
10
|
+
def initialize betrag
|
11
|
+
@betrag = betrag
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#betrag_gerundet" do
|
17
|
+
it "rundet richtig" do
|
18
|
+
zulage = TestEintrag.new(1)
|
19
|
+
zulage.send(:betrag_gerundet, 10.774).should be 10.75
|
20
|
+
zulage.send(:betrag_gerundet, 10.775).should be 10.80
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#betrag_gerundet_to_s" do
|
25
|
+
it "stellt richtig dar" do
|
26
|
+
zulage = TestEintrag.new(25000)
|
27
|
+
zulage.betrag_gerundet_to_s.should eq "25'000.00"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe Zulage do
|
34
|
+
describe "#betrag" do
|
35
|
+
it "rechnet richtig" do
|
36
|
+
stunden = 2.36
|
37
|
+
ansatz = 4.3
|
38
|
+
zulage = Zulage.new("Zulage", stunden, ansatz)
|
39
|
+
zulage.betrag.should be(10.148)
|
40
|
+
stunden = 3.4
|
41
|
+
ansatz = 3.1688
|
42
|
+
zulage = Zulage.new("Zulage", stunden, ansatz)
|
43
|
+
zulage.betrag.should be(10.77392) #10.148, aufgerundet auf 15 Rappen
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe Abzug do
|
50
|
+
describe "#betrag" do
|
51
|
+
it "rechnet richtig" do
|
52
|
+
menge = 4955
|
53
|
+
prozent = 100
|
54
|
+
abzug = Abzug.new("Abzug", menge, prozent)
|
55
|
+
abzug.betrag.should be (4955)
|
56
|
+
abzug = Abzug.new("Abzug", menge, 5.15)
|
57
|
+
abzug.betrag.should be (255.18250000000003)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe Rechnung do
|
63
|
+
it "rechnet" do
|
64
|
+
positive = [Zulage.new("Zulage", 2, 3), Zulage.new("Zulage", 3, 4)]
|
65
|
+
negative = [Zulage.new("Zulage", 1, 2)]
|
66
|
+
|
67
|
+
|
68
|
+
Rechnung.new("Bruttolohn", positive, negative).betrag.should eq 16
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Planik
|
3
|
+
module Lohnausweis
|
4
|
+
|
5
|
+
describe PdfGenerator do
|
6
|
+
it 'works' do
|
7
|
+
|
8
|
+
rohdaten = Rohdaten.new do |r|
|
9
|
+
r.start_datum = Date.new(2014, 06, 01)
|
10
|
+
r.end_datum = Date.new(2014, 06, 30)
|
11
|
+
r.adresse = Rohdaten::Adresse.new("Margherita", "Giuba", "Mauerstrasse", "34E", "3456", "Oberutzwil")
|
12
|
+
r.monatslohn = 4500
|
13
|
+
r.arbeitszeit = Rohdaten::Arbeitszeit.new(-22.3, 150, 153.66)
|
14
|
+
r.zulage_nacht = Rohdaten::MengeAnsatz.new(3.56, 8)
|
15
|
+
r.zulage_wochenende = Rohdaten::MengeAnsatz.new(2.12, 8)
|
16
|
+
r.kinderzulage = Rohdaten::MengeAnsatz.new(2, 260)
|
17
|
+
r.add_lohn_freifeld(Rohdaten::Freifeld.new("Korrektur für Februar", nil, nil, 120))
|
18
|
+
r.add_lohn_freifeld(Rohdaten::Freifeld.new("13. Monatslohn, erste Hälfte", "Fr 4'500.00", "6 Monate", 2250))
|
19
|
+
r.add_lohn_freifeld(Rohdaten::Freifeld.new("Minusbetrag", "irgendwas", nil, -50.35))
|
20
|
+
r.funktionszulage = 234.45
|
21
|
+
r.ahv = 5.1
|
22
|
+
r.alv = 2.1
|
23
|
+
r.nbu = 3.1
|
24
|
+
r.krankentaggeld = 0
|
25
|
+
#r.pensionskasse = 204.45
|
26
|
+
r.add_abzug_freifeld(Rohdaten::Freifeld.new("Händischer Abzug", "irgendwas", "nochmals was", 12))
|
27
|
+
|
28
|
+
r.ferien = Rohdaten::Ferien.new(304, 22)
|
29
|
+
end
|
30
|
+
pdf = PdfGenerator.new(rohdaten).create_pdf
|
31
|
+
pdf.render_file "mit_korrektur_januar.pdf"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lohnausweis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christian Muehlethaler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- christian.muehlethaler@optor.ch
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/lohnausweis.rb
|
68
|
+
- lib/lohnausweis/daten.rb
|
69
|
+
- lib/lohnausweis/daten_eintrag.rb
|
70
|
+
- lib/lohnausweis/pdf_generator.rb
|
71
|
+
- lib/lohnausweis/rohdaten.rb
|
72
|
+
- lib/lohnausweis/version.rb
|
73
|
+
- locale/de.yml
|
74
|
+
- lohnausweis.gemspec
|
75
|
+
- mit_korrektur_januar.pdf
|
76
|
+
- sandbox/mit_korrektur_januar.pdf
|
77
|
+
- sandbox/test_bounding_box.rb
|
78
|
+
- spec/lohnausweis/daten_eintrag_spec.rb
|
79
|
+
- spec/lohnausweis/daten_spec.rb
|
80
|
+
- spec/lohnausweis/pdf_generator_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
homepage: http://www.planik.ch
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.2.2
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Lohnausweis generieren aus den Daten von Planik
|
106
|
+
test_files:
|
107
|
+
- spec/lohnausweis/daten_eintrag_spec.rb
|
108
|
+
- spec/lohnausweis/daten_spec.rb
|
109
|
+
- spec/lohnausweis/pdf_generator_spec.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
has_rdoc:
|