bookyt_salary 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module SalaryBookingTemplateHelper
2
- def obligation_collection
3
- obligations = SalaryBookingTemplate::OBLIGATION_FLAGS.map{|obligation| [t_attr(obligation), obligation.to_s]}
2
+ def saldo_inclusion_flag_collection
3
+ SalaryBookingTemplate.saldo_inclusion_flags.map{|flag| [t_attr('saldo_inclusion_flags.' + flag), flag]}
4
4
  end
5
5
  end
@@ -2,19 +2,11 @@ class SalaryBookingTemplate < BookingTemplate
2
2
  default_scope order(:code)
3
3
 
4
4
  # Obligation flags
5
- OBLIGATION_FLAGS = [:for_gross_income, :for_ahv, :for_uvg, :for_uvgz, :for_ktg, :for_deduction_at_source]
6
- def obligation=(value)
7
- OBLIGATION_FLAGS.each do |flag|
8
- self[flag] = value.include?(flag.to_s)
9
- end
5
+ def self.saldo_inclusion_flags
6
+ ['gross_income', 'ahv', 'uvg', 'uvgz', 'ktg', 'deduction_at_source']
10
7
  end
11
8
 
12
- def obligation
13
- result = []
14
- OBLIGATION_FLAGS.each do |flag|
15
- result << flag.to_s if self[flag]
16
- end
17
-
18
- result
9
+ def to_s
10
+ title
19
11
  end
20
12
  end
@@ -3,4 +3,4 @@
3
3
  %h2= t_model SalaryTemplate
4
4
 
5
5
  - @salary_template = @employee.salary_templates.first
6
- = render 'salary_templates/form'
6
+ = render 'salary_templates/form' if @salary_template
@@ -9,12 +9,12 @@
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, :collection => amount_relations_as_collection
12
+ .span8= f.input :amount_relates_to, :collection => saldo_inclusion_flag_collection
13
13
  .row
14
14
  .span16= f.input :comments, :input_html => {:rows => 2, :class => 'span12'}
15
15
 
16
16
  .row
17
- .span8= f.input :obligation, :as => :check_boxes, :collection => obligation_collection
17
+ .span8= f.input :include_in_saldo_list, :as => :check_boxes, :collection => saldo_inclusion_flag_collection
18
18
 
19
19
  .row
20
20
  .span8= f.input :salary_declaration_code
@@ -5,12 +5,8 @@
5
5
  %th= t_attr :debit_account, SalaryBookingTemplate
6
6
  %th.currency= t_attr 'amount', SalaryBookingTemplate
7
7
  %th= t_attr :amount_relates_to, SalaryBookingTemplate
8
- %th= t_attr :for_gross_income, SalaryBookingTemplate
9
- %th= t_attr :for_ahv, SalaryBookingTemplate
10
- %th= t_attr :for_ktg, SalaryBookingTemplate
11
- %th= t_attr :for_uvg, SalaryBookingTemplate
12
- %th= t_attr :for_uvgz, SalaryBookingTemplate
13
- %th= t_attr :for_deduction_at_source, SalaryBookingTemplate
8
+ - SalaryBookingTemplate.saldo_inclusion_flags.each do |flag|
9
+ %th= t_attr('saldo_inclusion_flags.' + flag, SalaryBookingTemplate)
14
10
  %th= t_attr :salary_declaration_code, SalaryBookingTemplate
15
11
 
16
12
  = render @salary_booking_templates
@@ -6,12 +6,8 @@
6
6
  %i= salary_booking_template.comments
7
7
  %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?
8
8
  %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?
9
- %td.currency= amount_to_s(salary_booking_template)
10
- %td= t(salary_booking_template.amount_relates_to, :scope => 'salary_booking_template.relation') if salary_booking_template.amount_relates_to.present?
11
- %td= salary_booking_template.for_gross_income
12
- %td= salary_booking_template.for_ahv
13
- %td= salary_booking_template.for_ktg
14
- %td= salary_booking_template.for_uvg
15
- %td= salary_booking_template.for_uvgz
16
- %td= salary_booking_template.for_deduction_at_source
9
+ %td.currency= salary_booking_template.amount
10
+ %td= t_attr('saldo_inclusion_flags.' + salary_booking_template.amount_relates_to) if salary_booking_template.amount_relates_to.present?
11
+ - SalaryBookingTemplate.saldo_inclusion_flags.each do |flag|
12
+ %td= salary_booking_template.include_in_saldo_list.include? flag
17
13
  %td.number= salary_booking_template.salary_declaration_code
@@ -1,6 +1,6 @@
1
1
  %tr.salary_item.nested-form-item
2
2
  %td= salary_item.text_field :position, :required => true, :style => 'width: 3em', :autocomplete => "off"
3
- %td= salary_item.select :salary_booking_template_id, SalaryBookingTemplate.all.map{|template| [template.title, template.id]}, :required => true, :style => 'width: 30em'
3
+ %td= salary_item.select :salary_booking_template_id, SalaryBookingTemplate.all.map{|template| [template.title, template.id]}, :include_blank => true, :required => true, :style => 'width: 30em'
4
4
  %td= salary_item.text_field :times, :required => true, :style => 'width: 3em', :autocomplete => "off"
5
5
  %td= salary_item.text_field :price, :required => true, :style => 'width: 5em', :autocomplete => "off"
6
6
  %td.action_links
@@ -14,14 +14,15 @@ de:
14
14
  employer: Arbeitgeber
15
15
  employee: Arbeitnehmer
16
16
  salary_booking_template:
17
- for_ahv: AHV/ALV/IV/EO
18
- for_ktg: Krankentaggeld-Versicherung (KTG)
19
- for_gross_income: Bruttolohn
20
- for_uvg: Unfall-Versicherung (UVG)
21
- for_uvgz: Unfallzusatz-Versicherung (UVGZ)
22
- obligation: Pflichtigkeit
17
+ saldo_inclusion_flags:
18
+ ahv: AHV/ALV/IV/EO
19
+ ktg: Krankentaggeld-Versicherung (KTG)
20
+ gross_income: Bruttolohn
21
+ uvg: Unfall-Versicherung (UVG)
22
+ uvgz: Unfallzusatz-Versicherung (UVGZ)
23
+ deduction_at_source: Quellensteuer
24
+ include_in_saldo_list: Pflichtigkeit
23
25
  salary_declaration_code: Lohnausweis
24
- for_deduction_at_source: Quellensteuer
25
26
  salary_template:
26
27
  person: Person
27
28
  salary_booking_templates: Lohnarten
@@ -0,0 +1,19 @@
1
+ class PortObligationFlagsToTags < ActiveRecord::Migration
2
+ def up
3
+ # Setup tags based on db flags
4
+ SalaryBookingTemplate.find_each do |template|
5
+ template.include_in_saldo_list = SalaryBookingTemplate.saldo_inclusion_flags.collect do |flag|
6
+ flag if template["for_#{flag}"]
7
+ end
8
+
9
+ template.save
10
+ end
11
+
12
+ remove_column :booking_templates, :for_gross_income
13
+ remove_column :booking_templates, :for_ahv
14
+ remove_column :booking_templates, :for_uvg
15
+ remove_column :booking_templates, :for_uvgz
16
+ remove_column :booking_templates, :for_ktg
17
+ remove_column :booking_templates, :for_deduction_at_source
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.11.0'
2
+ VERSION = '0.12.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: 51
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 11
8
+ - 12
9
9
  - 0
10
- version: 0.11.0
10
+ version: 0.12.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-01-19 00:00:00 Z
18
+ date: 2012-01-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -145,6 +145,7 @@ files:
145
145
  - db/migrate/20120118121223_create_salary_items.rb
146
146
  - db/migrate/20120118155137_add_position_to_salary_item.rb
147
147
  - db/migrate/20120119081622_add_missing_salary_indices.rb
148
+ - db/migrate/20120119223948_port_obligation_flags_to_tags.rb
148
149
  - db/seeds.rb
149
150
  - lib/bookyt_salary.rb
150
151
  - lib/bookyt_salary/navigation.rb
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  requirements: []
181
182
 
182
183
  rubyforge_project:
183
- rubygems_version: 1.8.10
184
+ rubygems_version: 1.8.15
184
185
  signing_key:
185
186
  specification_version: 3
186
187
  summary: Salary plugin for bookyt