bookyt_salary 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,30 @@
1
1
  class PayslipDocument < LetterDocument
2
- def salary_table(direct_balance, direct_account, direct_bookings)
3
- content = direct_bookings.inject([]) do |out, item|
4
- title = item.title if item
5
- out << [title, nil, nil, nil, currency_fmt(item.accounted_amount(direct_account))] if item.contra_account(direct_account)
6
-
7
- out
2
+ def salary_table(salary)
3
+ head = [
4
+ t_attr(:code, LineItem),
5
+ t_attr(:title, LineItem),
6
+ t_attr(:price, LineItem),
7
+ t_attr(:times, LineItem),
8
+ t_attr(:accounted_amount, LineItem)
9
+ ]
10
+ content = salary.line_items.collect do |item|
11
+ [item.code, item.title, currency_fmt(item.price), item.times, currency_fmt(item.accounted_amount)]
8
12
  end
9
13
 
10
- rows = content + [total_row(currency_fmt(direct_balance))]
14
+ rows = [head] + content
15
+
16
+ table(rows, :width => bounds.width) do
17
+ # General cell styling
18
+ cells.valign = :top
19
+ cells.borders = []
20
+ cells.padding_bottom = 2
21
+ cells.padding_top = 2
11
22
 
12
- items_table(rows)
23
+ # Columns
24
+ columns(2..4).align = :right
25
+
26
+ # Footer styling
27
+ row(-1).font_style = :bold
28
+ end
13
29
  end
14
30
  end
@@ -1,9 +1,6 @@
1
1
  prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument) do |pdf|
2
2
  employer = resource.employer
3
3
  employee = resource.employee
4
- direct_account = Account.find_by_code("5000")
5
- direct_bookings = Booking.by_reference(resource)
6
- direct_balance = direct_bookings.empty? ? 0.0 : direct_bookings.direct_balance(direct_account)
7
4
 
8
5
  # Letter header
9
6
  pdf.letter_header(employer, employee, resource.to_s)
@@ -12,7 +9,7 @@ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => PayslipDocument
12
9
  pdf.free_text "#{t_attr(:social_security_nr, Employee)}: #{employee.social_security_nr}"
13
10
 
14
11
  # Line Items
15
- pdf.salary_table(direct_balance, direct_account, direct_bookings)
12
+ pdf.salary_table(resource)
16
13
 
17
14
  # Closing
18
15
  pdf.common_closing(employer)
@@ -38,6 +38,8 @@ de:
38
38
  title: Arbeitnehmer auswählen
39
39
  new:
40
40
  title: Lohn erfassen
41
+ index:
42
+ title: Löhne
41
43
  salary_booking_templates:
42
44
  index:
43
45
  title: Lohnarten
@@ -1,9 +1,9 @@
1
1
  module BookytSalary
2
2
  module Navigation
3
3
  def setup_bookyt_salary(navigation)
4
- navigation.item :salaries, t('bookyt.main_navigation.salaries'), salaries_path,
4
+ navigation.item :salaries, t_title(:index, Salary), salaries_path,
5
5
  :if => Proc.new { user_signed_in? } do |salaries|
6
- salaries.item :salaries, t('bookyt.main_navigation.salaries'), salaries_path, :highlights_on => /\/salaries($|\/[0-9]*($|\/.*))/
6
+ salaries.item :salaries, t_title(:index, Salary), salaries_path, :highlights_on => /\/salaries($|\/[0-9]*($|\/.*))/
7
7
  salaries.item :new_salary, t_title(:new, Salary), select_employee_salaries_path
8
8
  salaries.item :divider, "", :class => 'divider'
9
9
  salaries.item :salary_statistics, t_title(:statistics, Salary), statistics_salaries_path
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.14.0'
2
+ VERSION = '0.14.1'
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: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 14
9
- - 0
10
- version: 0.14.0
9
+ - 1
10
+ version: 0.14.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-27 00:00:00 Z
18
+ date: 2012-01-28 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rails
@@ -151,6 +152,7 @@ files:
151
152
  - lib/bookyt_salary/navigation.rb
152
153
  - lib/bookyt_salary/railtie.rb
153
154
  - lib/bookyt_salary/version.rb
155
+ has_rdoc: true
154
156
  homepage: https://github.com/huerlisi/bookyt_salary
155
157
  licenses:
156
158
  - MIT
@@ -180,10 +182,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
182
  requirements: []
181
183
 
182
184
  rubyforge_project:
183
- rubygems_version: 1.8.10
185
+ rubygems_version: 1.5.2
184
186
  signing_key:
185
187
  specification_version: 3
186
188
  summary: Salary plugin for bookyt
187
189
  test_files: []
188
190
 
189
- has_rdoc: