bookyt_salary 0.17.3 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,6 +52,7 @@ class SalariesController < InvoicesController
52
52
  def payslip
53
53
  @salary = Salary.find(params[:id])
54
54
 
55
+ @hours_carry = @salary.hours_carry
55
56
  @hours_due = @salary.work_days.sum(:hours_due)
56
57
  @hours_worked = @salary.work_days.sum(:hours_worked)
57
58
  @hours_saldo = @salary.work_days.last.overall_overtime
data/app/models/salary.rb CHANGED
@@ -114,6 +114,15 @@ class Salary < Invoice
114
114
  end
115
115
 
116
116
  # bookyt_projects
117
+ def hours_carry
118
+ WorkDay.create_or_update_upto(employee, duration_to)
119
+ last_day = employee.work_days.where(:date => duration_from.ago(1.day)).last
120
+
121
+ return 0 unless last_day
122
+
123
+ return last_day.overall_overtime
124
+ end
125
+
117
126
  def work_days
118
127
  WorkDay.create_or_update_upto(employee, duration_to)
119
128
  employee.work_days.where(:date => duration_from..duration_to)
@@ -5,25 +5,53 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
5
5
  # Letter header
6
6
  pdf.letter_header(employer, employee, resource.to_s)
7
7
 
8
- # Free text with the socical security number
9
- pdf.free_text(resource.text)
10
-
11
8
  # Line Items
12
9
  pdf.salary_table(resource)
13
10
 
14
11
  pdf.move_down 20
15
- pdf.text "#{t_attr(:social_security_nr, Employee)}: #{employee.social_security_nr}"
16
- pdf.text "#{t_attr(:payment_to, Employment)}: #{resource.employment.payment_to}"
12
+ rows = [
13
+ [t_attr(:social_security_nr, Employee), employee.social_security_nr],
14
+ [t_attr(:payment_to, Employment), resource.employment.payment_to]
15
+ ]
16
+ pdf.table rows, :width => pdf.bounds.width do
17
+ cells.valign = :top
18
+ cells.borders = []
19
+ cells.padding_bottom = 2
20
+ cells.padding_top = 2
21
+
22
+ columns(0).padding_left = 0
23
+ columns(0).width = 5.cm
24
+ end
17
25
 
18
26
  unless resource.employment.hourly_paid
19
27
  pdf.move_down 20
20
28
  pdf.text "Stundenabrechnung", :style => :bold
21
- pdf.text "#{t_attr(:hours_due, Activity)}: #{@hours_due}"
22
- pdf.text "#{t_attr(:hours_worked, Activity)}: #{@hours_worked}"
23
- pdf.text " "
24
- pdf.text "Aktueller Stundensaldo: #{@hours_saldo}"
29
+
30
+ month_name = t('date.month_names')[@salary.duration_from.month]
31
+ rows = [
32
+ ["Übertrag Vormonat", "%0.2f" % @hours_carry],
33
+ ["#{t_attr(:hours_due, Activity)} #{month_name}", "%0.2f" % @hours_due],
34
+ ["#{t_attr(:hours_worked, Activity)} #{month_name}", "%0.2f" % @hours_worked],
35
+ ["Aktueller Stundensaldo", "%0.2f" % @hours_saldo],
36
+ ]
37
+
38
+ pdf.table rows, :width => (pdf.bounds.width * 0.4) do
39
+ cells.valign = :top
40
+ cells.borders = []
41
+ cells.padding_bottom = 2
42
+ cells.padding_top = 2
43
+
44
+ columns(0).padding_left = 0
45
+ columns(0).width = 5.cm
46
+ columns(1).align = :right
47
+
48
+ rows(3).font_style = :bold
49
+ end
25
50
  end
26
51
 
52
+ # Free text with the socical security number
53
+ pdf.free_text(resource.text)
54
+
27
55
  # Closing
28
56
  pdf.common_closing(employer)
29
57
  end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.17.3'
2
+ VERSION = '0.18.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: 93
4
+ hash: 87
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 17
9
- - 3
10
- version: 0.17.3
8
+ - 18
9
+ - 0
10
+ version: 0.18.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-04 00:00:00 Z
18
+ date: 2012-05-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -185,9 +185,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  requirements: []
186
186
 
187
187
  rubyforge_project:
188
- rubygems_version: 1.8.16
188
+ rubygems_version: 1.8.10
189
189
  signing_key:
190
190
  specification_version: 3
191
191
  summary: Salary plugin for bookyt
192
192
  test_files: []
193
193
 
194
+ has_rdoc: