bookyt_salary 0.14.2 → 0.14.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,12 @@
1
1
  module SalaryBookingTemplateHelper
2
2
  def saldo_inclusion_flag_collection
3
- SalaryBookingTemplate.saldo_inclusion_flags.map{|flag| [t_attr('saldo_inclusion_flags.' + flag), flag]}
3
+ SalaryBookingTemplate.saldo_inclusion_flags.map{|flag| [t('activerecord.attributes.salary_booking_template.saldo_inclusion_flags.' + flag), flag]}
4
+ end
5
+
6
+ def amount_relates_to_collection
7
+ saldo_inclusion_flags = SalaryBookingTemplate.saldo_inclusion_flags.map{|flag| [t('activerecord.attributes.salary_booking_template.saldo_inclusion_flags.' + flag), flag]}
8
+ booking_templates = SalaryBookingTemplate.all.map{|template| [template.title, template.id]}
9
+
10
+ return saldo_inclusion_flags + booking_templates
4
11
  end
5
12
  end
data/app/models/salary.rb CHANGED
@@ -39,29 +39,21 @@ class Salary < Invoice
39
39
 
40
40
  # Calculations
41
41
  def net_amount
42
- salary_invoice_booking = bookings.where(:debit_account_id => Account.find_by_code('2050').id).first
43
- return 0.0 unless salary_invoice_booking
42
+ # TODO: hardcoded salary_booking_template
43
+ line_item = line_items.where(:code => '6500').first
44
44
 
45
- salary_invoice_booking.amount
46
- end
45
+ return 0.0 unless line_item
47
46
 
48
- def bvg_amount
49
- bookings.by_text("BVG").sum(:amount)
47
+ line_item.accounted_amount
50
48
  end
51
49
 
52
- def social_amount
53
- result = bookings.by_text("AHV/IV/EO Arbeitnehmer").sum(:amount)
54
- result += bookings.by_text("ALV Arbeitnehmer").sum(:amount)
55
- result += bookings.by_text("NBU Arbeitnehmer").sum(:amount)
56
-
57
- result
58
- end
50
+ def gross_amount
51
+ # TODO: hardcoded salary_booking_template
52
+ line_item = line_items.where(:code => '5000').first
59
53
 
60
- def ahv_amount
61
- result = amount
62
- result += bookings.where(:title => "Kinderzulage").sum(:amount)
54
+ return 0.0 unless line_item
63
55
 
64
- result
56
+ line_item.accounted_amount
65
57
  end
66
58
 
67
59
  # Assignment proxies
@@ -1,7 +1,7 @@
1
1
  class SalaryBookingTemplate < BookingTemplate
2
2
  # Obligation flags
3
3
  def self.saldo_inclusion_flags
4
- ['gross_income', 'net_income', 'ahv', 'uvg', 'uvgz', 'ktg', 'deduction_at_source']
4
+ ['gross_income', 'net_income', 'payment', 'ahv', 'uvg', 'uvgz', 'ktg', 'deduction_at_source']
5
5
  end
6
6
 
7
7
  def to_s
@@ -27,6 +27,7 @@ class PayslipDocument < LetterDocument
27
27
  cells.borders = []
28
28
  cells.padding_bottom = 2
29
29
  cells.padding_top = 2
30
+ columns(0).padding_left = 0
30
31
 
31
32
  # Columns
32
33
  columns(2..4).align = :right
@@ -34,7 +35,7 @@ class PayslipDocument < LetterDocument
34
35
  # Saldo styling
35
36
  saldo_rows.each do |index|
36
37
  row(index).font_style = :bold
37
- row(index).padding_bottom = 8
38
+ row(index).padding_bottom = 10
38
39
  end
39
40
 
40
41
  # Header styling
@@ -6,7 +6,7 @@
6
6
  %th= t_attr :company, Invoice
7
7
  %th= t_attr :title, Invoice
8
8
  %th= t_attr :due_date, Invoice
9
- %th.currency= t_attr :amount, Salary
9
+ %th.currency= t_attr :gross_amount, Salary
10
10
  %th.currency= t_attr :net_amount, Salary
11
11
  %th.currency= t_attr :balance, Invoice
12
12
  %th.action-links
@@ -3,8 +3,8 @@
3
3
  %td= link_to salary.company, salary.company
4
4
  %td= link_to salary.title, salary, {'data-href-container' => 'tr'}
5
5
  %td= salary.due_date
6
- %td.currency= currency_fmt(salary.amount)
6
+ %td.currency= currency_fmt(salary.gross_amount)
7
7
  %td.currency= currency_fmt(salary.net_amount)
8
- %td.currency= currency_fmt(salary.balance(Date.today, Account.find_by_code('2050')))
8
+ %td.currency= currency_fmt(salary.balance(nil, Account.find_by_code('2050')))
9
9
  %td.action-links
10
10
  = list_link_for(:edit, salary)
@@ -9,7 +9,7 @@
9
9
  .span8= f.input :debit_account, :as => :combobox, :collection => accounts_as_collection
10
10
  .row
11
11
  .span8= f.input :amount
12
- .span8= f.input :amount_relates_to
12
+ .span8= f.input :amount_relates_to, :collection => amount_relates_to_collection
13
13
  .row
14
14
  .span16= f.input :comments, :input_html => {:rows => 2, :class => 'span12'}
15
15
 
@@ -7,7 +7,7 @@
7
7
  %th.currency= t_attr 'amount', SalaryBookingTemplate
8
8
  %th= t_attr :amount_relates_to, SalaryBookingTemplate
9
9
  - SalaryBookingTemplate.saldo_inclusion_flags.each do |flag|
10
- %th= t_attr('saldo_inclusion_flags.' + flag, SalaryBookingTemplate)
10
+ %th= t('activerecord.attributes.salary_booking_template.saldo_inclusion_flags.' + flag)
11
11
  %th.right= t_attr :salary_declaration_code, SalaryBookingTemplate
12
12
 
13
13
  = render @salary_booking_templates
@@ -8,7 +8,7 @@
8
8
  %td= link_to salary_booking_template.credit_account.code, account_path(salary_booking_template.credit_account), :title => salary_booking_template.credit_account.title unless salary_booking_template.credit_account.nil?
9
9
  %td= link_to salary_booking_template.debit_account.code, account_path(salary_booking_template.debit_account), :title => salary_booking_template.debit_account.title unless salary_booking_template.debit_account.nil?
10
10
  %td.currency= salary_booking_template.amount
11
- %td= t_attr('saldo_inclusion_flags.' + salary_booking_template.amount_relates_to) if salary_booking_template.amount_relates_to.present?
11
+ %td= t('activerecord.attributes.salary_booking_template.saldo_inclusion_flags.' + salary_booking_template.amount_relates_to) if salary_booking_template.amount_relates_to.present?
12
12
  - SalaryBookingTemplate.saldo_inclusion_flags.each do |flag|
13
13
  %td= salary_booking_template.include_in_saldo_list.include?(flag) ? '<span class="label success">Ja</span>'.html_safe : ""
14
14
  %td.right= salary_booking_template.salary_declaration_code
@@ -1,5 +1,5 @@
1
1
  = f.inputs t_title(:list, SalaryItem) do
2
- %table#salary_items
2
+ %table#salary_items.nested-form-container
3
3
  %thead
4
4
  = render 'salary_items/list_header', :template => f.object
5
5
  %tbody.sortable
@@ -7,19 +7,19 @@ de:
7
7
 
8
8
  attributes:
9
9
  salary:
10
- amount: Bruttolohn
10
+ gross_amount: Bruttolohn
11
11
  net_amount: Nettolohn
12
- bvg_amount: BVG
13
- social_amount: AHV/IV/EO/ALV/NBU
14
12
  employer: Arbeitgeber
15
13
  employee: Arbeitnehmer
16
14
  salary_booking_template:
17
15
  saldo_inclusion_flags:
18
- ahv: AHV/ALV/IV/EO
19
- ktg: Krankentaggeld-Versicherung (KTG)
16
+ ahv: AHV
17
+ ktg: KTG
20
18
  gross_income: Bruttolohn
21
- uvg: Unfall-Versicherung (UVG)
22
- uvgz: Unfallzusatz-Versicherung (UVGZ)
19
+ net_income: Nettolohn
20
+ payment: Auszahlung
21
+ uvg: UVG
22
+ uvgz: UVGZ
23
23
  deduction_at_source: Quellensteuer
24
24
  include_in_saldo_list: Pflichtigkeit
25
25
  salary_declaration_code: Lohnausweis
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.14.2'
2
+ VERSION = '0.14.3'
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: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 14
9
- - 2
10
- version: 0.14.2
9
+ - 3
10
+ version: 0.14.3
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-01-28 00:00:00 +01:00
18
+ date: 2012-01-30 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency