bookyt_salary 0.19.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ class SalariesController < InvoicesController
40
40
  @salary.title = "Lohn #{month_name} #{@salary.duration_from.year} - #{@salary.employee.vcard.full_name}"
41
41
  @salary.duration_to = @salary.duration_from.end_of_month
42
42
 
43
- @salary.leave_days_balance = @salary.previous.leave_days_balance || 0
43
+ @salary.leave_days_balance = @salary.previous.try(:leave_days_balance) || 0
44
44
  @salary.used_leave_days = 0
45
45
 
46
46
  # Prebuild line items
@@ -52,26 +52,28 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
52
52
  bottom_y = pdf.y
53
53
 
54
54
  pdf.y = top_y
55
- pdf.indent 10.cm do
56
- pdf.text "Ferienabrechnung", :style => :bold
57
-
58
- month_name = t('date.month_names')[@salary.duration_from.month]
59
- rows = [
60
- ["#{t_attr(:used_leave_days)} #{month_name}", "%0.1f" % resource.used_leave_days],
61
- [t_attr(:leave_days_balance), "%0.1f" % resource.leave_days_balance],
62
- ]
63
-
64
- pdf.table rows, :width => 8.cm do
65
- cells.valign = :top
66
- cells.borders = []
67
- cells.padding_bottom = 2
68
- cells.padding_top = 2
69
-
70
- columns(0).padding_left = 0
71
- columns(0).width = 5.cm
72
- columns(1).align = :right
73
-
74
- rows(3).font_style = :bold
55
+ if resource.used_leave_days and resource.leave_days_balance
56
+ pdf.indent 10.cm do
57
+ pdf.text "Ferienabrechnung", :style => :bold
58
+
59
+ month_name = t('date.month_names')[@salary.duration_from.month]
60
+ rows = [
61
+ ["#{t_attr(:used_leave_days)} #{month_name}", "%0.1f" % resource.used_leave_days],
62
+ [t_attr(:leave_days_balance), "%0.1f" % resource.leave_days_balance],
63
+ ]
64
+
65
+ pdf.table rows, :width => 8.cm do
66
+ cells.valign = :top
67
+ cells.borders = []
68
+ cells.padding_bottom = 2
69
+ cells.padding_top = 2
70
+
71
+ columns(0).padding_left = 0
72
+ columns(0).width = 5.cm
73
+ columns(1).align = :right
74
+
75
+ rows(3).font_style = :bold
76
+ end
75
77
  end
76
78
  end
77
79
 
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.19.1'
2
+ VERSION = '0.19.2'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookyt_salary
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 87
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 19
9
- - 1
10
- version: 0.19.1
9
+ - 2
10
+ version: 0.19.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"