bookyt_salary 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
data/app/models/salary.rb CHANGED
@@ -96,8 +96,9 @@ class Salary < Invoice
96
96
  line_item.set_booking_template(salary_item.salary_booking_template)
97
97
 
98
98
  # Overrides from salary_item
99
- line_item.times = salary_item.times if salary_item.times.present?
100
- line_item.price = salary_item.price if salary_item.price.present?
99
+ line_item.times = salary_item.times if salary_item.times.present?
100
+ line_item.price = salary_item.price if salary_item.price.present?
101
+ line_item.position = salary_item.position if salary_item.position.present?
101
102
  end
102
103
  end
103
104
 
@@ -1,6 +1,8 @@
1
1
  class SalaryItem < ActiveRecord::Base
2
+ # Ordering
3
+ default_scope order(:position)
4
+
5
+ # Associations
2
6
  belongs_to :salary_template
3
7
  belongs_to :salary_booking_template
4
-
5
- default_scope order(:position)
6
8
  end
@@ -1,4 +1,4 @@
1
- prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => Prawn::LetterDocument) do |pdf|
1
+ prawn_document(:filename => "#{resource.to_s}.pdf", :renderer => Prawn::Payslip) do |pdf|
2
2
  employer = resource.employer
3
3
  employee = resource.employee
4
4
  direct_account = Account.find_by_code("5000")
@@ -3,6 +3,8 @@ require 'rails'
3
3
 
4
4
  module BookytSalary
5
5
  class Railtie < Rails::Engine
6
+ config.autoload_paths << File.expand_path("../lib", __FILE__)
7
+
6
8
  engine_name "bookyt_salary"
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.1'
3
3
  end
@@ -0,0 +1,16 @@
1
+ module Prawn
2
+ class Payslip < LetterDocument
3
+ def salary_table(direct_balance, direct_account, direct_bookings)
4
+ content = direct_bookings.inject([]) do |out, item|
5
+ title = item.title if item
6
+ out << [title, nil, nil, nil, currency_fmt(item.accounted_amount(direct_account))] if item.contra_account(direct_account)
7
+
8
+ out
9
+ end
10
+
11
+ rows = content + [total_row(currency_fmt(direct_balance))]
12
+
13
+ items_table(rows)
14
+ end
15
+ end
16
+ 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: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 0
10
- version: 0.10.0
9
+ - 1
10
+ version: 0.10.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -147,6 +147,7 @@ files:
147
147
  - lib/bookyt_salary/navigation.rb
148
148
  - lib/bookyt_salary/railtie.rb
149
149
  - lib/bookyt_salary/version.rb
150
+ - lib/prawn/payslip.rb
150
151
  homepage: https://github.com/huerlisi/bookyt_salary
151
152
  licenses:
152
153
  - MIT
@@ -176,10 +177,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  requirements: []
177
178
 
178
179
  rubyforge_project:
179
- rubygems_version: 1.8.10
180
+ rubygems_version: 1.8.15
180
181
  signing_key:
181
182
  specification_version: 3
182
183
  summary: Salary plugin for bookyt
183
184
  test_files: []
184
185
 
185
- has_rdoc: