lohnausweis 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 952d70419c392f4f0898b0ab3968ac26506eff8e
4
- data.tar.gz: 86ab5e9cf36ec2fee4a7108f3f5991515606ceea
3
+ metadata.gz: cbae455707f8739303c8c831adaa348b3bb26059
4
+ data.tar.gz: 14c2472b821667bd404b066c56c7ac456a5d1408
5
5
  SHA512:
6
- metadata.gz: 54f391d995ae3152d9899783e71ada01b520af5cd6d4bebad43d18613581325f5bd818a3aec939dfea727eb8a44b99ea34b9c66e4d199610c11d81b11c5688ea
7
- data.tar.gz: 7d15fbcd0a1aca7064dc733040de442ed320a75e7217e593af33e0139705eb7fbc17cc4c30facee978eabac5b7b771cecb3b5a260c81f9cb6b742a9608bbed62
6
+ metadata.gz: c4f4f6af6f99ba4ac8c3577d19ea50337a38848cdb7d534f3942bec4bcddfa319ffceb14fc8838492f2ec16bc96c93c6ce6f46547add9524091ec61701c860e5
7
+ data.tar.gz: 72c569d4f04d174c05f418fe8920d608175073c71b8b90947274761e54f55f107c338cfaf0d4a995e0341b117301f9bf5e00d7382b2e6d247e819bda13558128
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lohnausweis (0.2.6)
4
+ lohnausweis (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,12 +32,27 @@ module Planik
32
32
  def initialize(rohdaten)
33
33
  @rohdaten = rohdaten
34
34
  bruttolohn_eintrag = create_lohn_block
35
+ create_zulagen_block
35
36
  create_abzuege_block(bruttolohn_eintrag)
36
37
  create_ferien_block
37
38
  create_arbeitszeit_block
38
39
  create_arbeitsliste
39
40
  end
40
41
 
42
+ # Neu
43
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
44
+ def create_zulagen_block
45
+ zulagen = []
46
+ zulagen << Zulage.new("Zulage Nacht (#{monat_arbeit} #{jahr_arbeit})", @rohdaten.zulage_nacht.menge, @rohdaten.zulage_nacht.ansatz)
47
+ zulagen << Zulage.new("Zulage Wochenende (#{monat_arbeit} #{jahr_arbeit})", @rohdaten.zulage_wochenende.menge, @rohdaten.zulage_wochenende.ansatz)
48
+ summe = Rechnung.new("Summe", zulagen, [])
49
+
50
+ zulagen = zulagen + [summe]
51
+
52
+ @zulagen_block = Block.new(zulagen, ["Zulagen", "Menge", "Ansatz / %", "Betrag"])
53
+ end
54
+
55
+
41
56
  def create_lohn_block
42
57
  lohn_positiv = []
43
58
  lohn_positiv << Fakt.new("Monatslohn", nil, nil, @rohdaten.monatslohn)
@@ -134,6 +149,12 @@ module Planik
134
149
  @rohdaten.adresse
135
150
  end
136
151
 
152
+ # Neu
153
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
154
+ def zulagen_daten
155
+ @zulagen_block.daten
156
+ end
157
+
137
158
  def lohn_daten
138
159
  @lohnblock.daten
139
160
  end
@@ -14,8 +14,31 @@ module Planik
14
14
  @daten = daten
15
15
  end
16
16
 
17
- # Erstellt das PDF und liefert es zurück
17
+
18
+ # Neues Layout.
19
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
18
20
  def create_pdf
21
+ @pdf = Prawn::Document.new(page_size: "A4")
22
+ #@pdf.stroke_axis # Die Masse auf den Achsen
23
+ @pdf.font("Helvetica", size: 8) #Default Font and size
24
+ @pdf.default_leading = 0
25
+ next_y = 750
26
+ next_y = header_new(next_y)
27
+ next_y -= 50
28
+ next_y = arbeitsliste_new(next_y)
29
+ next_y -= 50
30
+ next_y = arbeitszeit_block(next_y)
31
+
32
+ next_y -= 50
33
+ zulagen_block(next_y)
34
+
35
+ footer()
36
+ @pdf
37
+ end
38
+
39
+
40
+ # Erstellt das PDF und liefert es zurück
41
+ def create_pdf_old
19
42
  @pdf = Prawn::Document.new(page_size: "A4")
20
43
  #@pdf.stroke_axis # Die Masse auf den Achsen
21
44
  @pdf.font("Helvetica", size: 8) #Default Font and size
@@ -38,6 +61,33 @@ module Planik
38
61
 
39
62
  private
40
63
 
64
+
65
+ # Neu
66
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
67
+ def header_new(ypos)
68
+
69
+ bb = @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
70
+ @pdf.font("Helvetica", size: 12) do
71
+ parent = @pdf.bounds
72
+ xpos = parent.top_left[0] + 350
73
+ ypos = parent.height - 70
74
+ width = parent.top_right[0] - xpos
75
+
76
+ @pdf.bounding_box([350, ypos], width: width, height: 70) do
77
+ @pdf.text "#{@daten.adresse.voller_name}"
78
+ @pdf.text @daten.adresse.strasse_nr
79
+ @pdf.text "#{@daten.adresse.plz} <u>#{@daten.adresse.ort}</u>", inline_format: true
80
+ #@pdf.stroke_bounds
81
+ end
82
+ @pdf.move_down(50)
83
+ @pdf.text("Arbeitszeiten #{@daten.monat} #{@daten.jahr}", style: :bold)
84
+ end
85
+ #@pdf.stroke_bounds
86
+ end
87
+ bb.absolute_bottom
88
+ end
89
+
90
+
41
91
  def header(ypos)
42
92
 
43
93
  bb = @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
@@ -61,6 +111,19 @@ module Planik
61
111
  bb.absolute_bottom
62
112
  end
63
113
 
114
+
115
+ # Neu
116
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
117
+ def zulagen_block(ypos)
118
+ bb = @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
119
+ inner_ypos = 0
120
+ make_table(XPOS, inner_ypos, @daten.zulagen_daten, true)
121
+ @pdf.stroke_bounds
122
+ end
123
+ bb.absolute_bottom
124
+ end
125
+
126
+
64
127
  def lohn_block(ypos)
65
128
  bb = @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
66
129
  inner_ypos = 0
@@ -82,11 +145,12 @@ module Planik
82
145
  end
83
146
 
84
147
  def arbeitszeit_block(ypos)
85
- @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
148
+ pp = @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
86
149
  ypos = 0
87
150
  make_table(XPOS, ypos, @daten.arbeitszeit_daten, true)
88
151
  @pdf.stroke_bounds
89
152
  end
153
+ pp.absolute_bottom
90
154
  end
91
155
 
92
156
  def footer
@@ -94,7 +158,9 @@ module Planik
94
158
  @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
95
159
  @pdf.font("Helvetica", size: 8) do
96
160
  @pdf.text("Wir bitten Sie, die Lohnabrechnung sofort zu prüfen und Unstimmigkeiten unverzüglich mitzuteilen.")
97
- @pdf.text("Anhang: Arbeitszeit von #{@daten.start_datum_for_arbeit} bis #{@daten.end_datum_for_arbeit}.")
161
+ # Neu
162
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
163
+ #@pdf.text("Anhang: Arbeitszeit von #{@daten.start_datum_for_arbeit} bis #{@daten.end_datum_for_arbeit}.")
98
164
  @pdf.text("Generiert von Planik am #{Time.now.strftime("%d.%m.%Y um %H:%M Uhr")}", align: :right)
99
165
  end
100
166
  end
@@ -113,10 +179,31 @@ module Planik
113
179
  end
114
180
  end
115
181
 
182
+ #
183
+ # Neu
184
+ # Aenderung für MEDPHONE März 2015: Nur Arbeitsliste, Arbeitszeit und Zulagen
185
+ #
186
+ def arbeitsliste_new(ypos)
187
+ bb = @pdf.bounding_box([XPOS, ypos], width: WIDTH+30) do
188
+ #@pdf.start_new_page
189
+ @pdf.text("Arbeitszeit von #{@daten.start_datum_for_arbeit} bis #{@daten.end_datum_for_arbeit}", style: :bold)
190
+ arbeitsliste = @daten.arbeitsliste
191
+ inner_ypos = 10
192
+ make_arbeitsliste_table(XPOS, inner_ypos, arbeitsliste, true)
193
+ # ypos = 18
194
+ # @pdf.bounding_box([XPOS, ypos], width: WIDTH) do
195
+ # @pdf.font("Helvetica", size: 8) do
196
+ # @pdf.text("Generiert von Planik am #{Time.now.strftime("%d.%m.%Y um %H:%M Uhr")}", align: :right)
197
+ # end
198
+ # end
199
+ end
200
+ bb.absolute_bottom
201
+
202
+ end
116
203
 
117
204
 
118
205
  def make_arbeitsliste_table(xpos, ypos, daten, title = false)
119
- @pdf.bounding_box([xpos, ypos], width: WIDTH) do #height dynmaisch
206
+ @pdf.bounding_box([xpos, ypos], width: WIDTH+30) do #height dynamisch
120
207
  p_width = @pdf.bounds.width
121
208
  r1 = Rational(1, 6)
122
209
  r2 = r1 * Rational(1, 2)
@@ -127,7 +214,7 @@ module Planik
127
214
  @pdf.table(daten, column_widths: column_width,
128
215
  cell_style: {
129
216
  borders: [], #keine Ränder
130
- padding_top: 3, padding_bottom: 3
217
+ padding_top: 3, padding_bottom: 3
131
218
 
132
219
  }
133
220
  ) do |t|
@@ -153,7 +240,7 @@ module Planik
153
240
  @pdf.table(daten, column_widths: column_width,
154
241
  cell_style: {
155
242
  borders: [], #keine Ränder
156
- padding_top: 3, padding_bottom: 3
243
+ padding_top: 3, padding_bottom: 3
157
244
 
158
245
  }
159
246
  ) do |t|
@@ -5,6 +5,10 @@ module Planik
5
5
  # Die Rohdaten um einen Lohnausweis zu generieren
6
6
  class Rohdaten
7
7
 
8
+ #
9
+ # Entspricht einer lohnrelevanten Zeile im PDF,
10
+ # z.B. Kinderzulage: menge: 2, Ansatz: 260 Betrag wird ausgerechnet
11
+ #
8
12
  class MengeAnsatz
9
13
  attr_accessor :menge, :ansatz
10
14
 
@@ -13,6 +17,8 @@ module Planik
13
17
  end
14
18
  end
15
19
 
20
+
21
+ # Die Arbeitszeit in der Zeitspanne rohdaten#start_datum_for_arbeit bis rohdaten#end_datum_for_arbeit
16
22
  class Arbeitszeit
17
23
  attr_accessor :gleitzeit_vor, :soll_stunden, :ist_stunden
18
24
 
@@ -52,6 +58,10 @@ module Planik
52
58
  end
53
59
  end
54
60
 
61
+ #
62
+ # Entspricht einer Zeile im PDF.
63
+ # Z.B 13. Monatslohn: Freilfeld.new("13. Monatslohn, erste Hälfte", "Fr 4'500.00", "6 Monate", 2250)
64
+ # Ist entweder Lohnrelevant oder Abzugsrelevant, je nachdem zu welchem Array es hinzugefügt wurde.
55
65
  class Freifeld
56
66
  attr_accessor :name, :menge, :ansatz, :betrag
57
67
 
@@ -60,6 +70,9 @@ module Planik
60
70
  end
61
71
  end
62
72
 
73
+ #
74
+ # Ein Dienst, Termine mit Arbeitszeit oder "andere Arbeit". Erscheinen im Anhang des PDFs
75
+ #
63
76
  class ArbeitsItem
64
77
  attr_accessor :datum, :name, :typ, :zeit_von, :zeit_bis, :arbeitszeit
65
78
 
@@ -68,6 +81,7 @@ module Planik
68
81
  end
69
82
  end
70
83
 
84
+
71
85
  attr_accessor :start_datum, :end_datum
72
86
  attr_accessor :start_datum_for_arbeit, :end_datum_for_arbeit
73
87
  attr_accessor :monatslohn
@@ -1,5 +1,5 @@
1
1
  module Planik
2
2
  module Lohnausweis
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end