bookyt_salary 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,9 @@ 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
44
+ @salary.used_leave_days = 0
45
+
43
46
  # Prebuild line items
44
47
  @salary.build_line_items
45
48
 
data/app/models/salary.rb CHANGED
@@ -37,6 +37,11 @@ class Salary < Invoice
37
37
  end
38
38
  end
39
39
 
40
+ # Helpers
41
+ def previous
42
+ employee.salaries.order("duration_to DESC").where("duration_to < ?", duration_to).first
43
+ end
44
+
40
45
  # Calculations
41
46
  def ahv_amount
42
47
  amount_of('AHV')
@@ -0,0 +1,4 @@
1
+ - filter_name = :invoice_state
2
+ - define_filter filter_name do
3
+ - params[filter_name] ||= 'all'
4
+ = boot_nav_filter(filter_name, ['all'] + Salary::STATES)
@@ -7,6 +7,9 @@
7
7
  .row-fluid
8
8
  .span6= f.input :duration_from, :as => :date_field
9
9
  .span6= f.input :duration_to, :as => :date_field
10
+ .row-fluid
11
+ .span6= f.input :used_leave_days, :as => :string
12
+ .span6= f.input :leave_days_balance, :as => :string
10
13
  .row-fluid
11
14
  .span12= f.input :text, :input_html => {:rows => 4}
12
15
  .row-fluid
@@ -1,4 +1 @@
1
- - filter_name = :invoice_state
2
- - params[filter_name] ||= 'all'
3
- - content_for :sidebar do
4
- = boot_nav_filter(filter_name, ['all'] + Salary::STATES)
1
+ = render 'filters/salary_state'
@@ -25,6 +25,8 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
25
25
 
26
26
  unless resource.employment.hourly_paid
27
27
  pdf.move_down 20
28
+
29
+ top_y = pdf.y
28
30
  pdf.text "Stundenabrechnung", :style => :bold
29
31
 
30
32
  month_name = t('date.month_names')[@salary.duration_from.month]
@@ -35,7 +37,7 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
35
37
  ["Aktueller Stundensaldo", "%0.2f" % @hours_saldo],
36
38
  ]
37
39
 
38
- pdf.table rows, :width => (pdf.bounds.width * 0.4) do
40
+ pdf.table rows, :width => 8.cm do
39
41
  cells.valign = :top
40
42
  cells.borders = []
41
43
  cells.padding_bottom = 2
@@ -47,6 +49,33 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
47
49
 
48
50
  rows(3).font_style = :bold
49
51
  end
52
+ bottom_y = pdf.y
53
+
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
75
+ end
76
+ end
77
+
78
+ pdf.y = bottom_y
50
79
  end
51
80
 
52
81
  # Free text with the socical security number
@@ -12,6 +12,8 @@ de:
12
12
  employer: Arbeitgeber
13
13
  employee: Arbeitnehmer
14
14
  text: Text auf Lohnabrechnung
15
+ leave_days_balance: Restliche Ferientage
16
+ used_leave_days: Bezogene Ferientage
15
17
 
16
18
  salary_booking_template:
17
19
  include_in_saldo_list: Pflichtigkeit
@@ -0,0 +1,5 @@
1
+ class AddLeaveDayColumnsToSalaries < ActiveRecord::Migration
2
+ def change
3
+ add_column :invoices, :unused_leave_days, :decimal
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
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: 87
4
+ hash: 83
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 18
8
+ - 19
9
9
  - 0
10
- version: 0.18.0
10
+ version: 0.19.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -111,6 +111,7 @@ files:
111
111
  - app/models/salary_template.rb
112
112
  - app/prawn/payslip_document.rb
113
113
  - app/views/employees/_show_salaries.html.haml
114
+ - app/views/filters/_salary_state.html.haml
114
115
  - app/views/salaries/_form.html.haml
115
116
  - app/views/salaries/_list.html.haml
116
117
  - app/views/salaries/_salary.html.haml
@@ -150,6 +151,7 @@ files:
150
151
  - db/migrate/20120119223948_port_obligation_flags_to_tags.rb
151
152
  - db/migrate/20120201104444_switch_to_translated_saldo_inclusion_flags.rb
152
153
  - db/migrate/20120201125113_switch_line_items_to_translated_saldo_inclusion_flags.rb
154
+ - db/migrate/20120503120833_add_unused_leave_days_to_debit_invoices.rb
153
155
  - db/seeds.rb
154
156
  - db/seeds/locales/de-CH.rb
155
157
  - lib/bookyt_salary.rb