bookyt_salary 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ class SalaryTemplatesController < AuthorizedController
2
+ def copy
3
+ # Duplicate original record
4
+ template = resource.dup
5
+
6
+ # Rebuild positions
7
+ set_resource_ivar template
8
+
9
+ render 'edit'
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module SalaryBookingTemplateHelper
2
+ def obligation_collection
3
+ obligations = SalaryBookingTemplate::OBLIGATION_FLAGS.map{|obligation| [t_attr(obligation), obligation.to_s]}
4
+ end
5
+ end
@@ -1,3 +1,20 @@
1
1
  class SalaryBookingTemplate < BookingTemplate
2
2
  default_scope order(:code)
3
+
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
10
+ end
11
+
12
+ def obligation
13
+ result = []
14
+ OBLIGATION_FLAGS.each do |flag|
15
+ result << flag.to_s if self[flag]
16
+ end
17
+
18
+ result
19
+ end
3
20
  end
@@ -0,0 +1,4 @@
1
+ class SalaryTemplate < ActiveRecord::Base
2
+ belongs_to :person
3
+ has_and_belongs_to_many :salary_booking_template
4
+ end
@@ -3,20 +3,15 @@
3
3
  = f.inputs do
4
4
  = f.input :employee_id, :as => :hidden
5
5
  = f.input :employer_id, :as => :hidden
6
- = f.input :title
7
- = f.input :duration_from, :as => :date_field
8
- = f.input :duration_to, :as => :date_field
9
- = f.input :remarks, :input_html => {:rows => 4}
6
+ .row
7
+ .span16= f.input :title, :input_html => {:class => 'span12'}
8
+ .row
9
+ .span8= f.input :duration_from, :as => :date_field
10
+ .span8= f.input :duration_to, :as => :date_field
11
+ .row
12
+ .span16= f.input :remarks, :input_html => {:rows => 4, :class => 'span12'}
10
13
 
11
- = f.inputs t('title.line_items') do
12
- %table#line_items
13
- %thead
14
- = render 'line_items/list_header', :invoice => resource
15
- %tbody
16
- = f.fields_for :line_items do |line_item|
17
- = render 'line_items/form', :line_item => line_item
18
- %tfoot
19
- = render 'line_items/list_footer', :total_amount => resource.amount
14
+ = render 'line_items/list_form', :f => f, :invoice => resource
20
15
 
21
16
  = f.buttons do
22
17
  = f.commit_button
@@ -4,8 +4,10 @@
4
4
  = f.semantic_errors
5
5
 
6
6
  = f.inputs do
7
- = f.input :employee, :as => :combobox
8
- = f.input :duration_from, :discard_day => true, :start_year => Time.now.year - 2, :end_year => Time.now.year + 1, :include_blank => false
7
+ .row
8
+ .span8= f.input :employee, :as => :combobox
9
+ .row
10
+ .span8= f.input :duration_from, :as => :date_field
9
11
 
10
12
  = f.buttons do
11
13
  = f.commit_button
@@ -1,22 +1,23 @@
1
1
  = semantic_form_for @salary_booking_template do |f|
2
2
  = f.semantic_errors
3
3
  = f.inputs do
4
- = f.input :title, :input_html => {"data-autofocus" => true}
5
- = f.input :code, :input_html => {:style => 'width: 6em'}
6
- = f.input :credit_account, :as => :combobox, :collection => accounts_as_collection
7
- = f.input :debit_account, :as => :combobox, :collection => accounts_as_collection
8
- = f.input :amount, :input_html => {:style => 'width: 6em'}
9
- = f.input :amount_relates_to, :collection => amount_relations_as_collection
10
- = f.input :comments, :input_html => {:rows => 5}
4
+ .row
5
+ .span8= f.input :title, :input_html => {"data-autofocus" => true}
6
+ .span8= f.input :code
7
+ .row
8
+ .span8= f.input :credit_account, :as => :combobox, :collection => accounts_as_collection
9
+ .span8= f.input :debit_account, :as => :combobox, :collection => accounts_as_collection
10
+ .row
11
+ .span8= f.input :amount
12
+ .span8= f.input :amount_relates_to, :collection => amount_relations_as_collection
13
+ .row
14
+ .span16= f.input :comments, :input_html => {:rows => 2, :class => 'span12'}
11
15
 
12
- = f.inputs do
13
- = f.input :for_ahv, :wrapper_html => {:class => 'col1'}
14
- = f.input :for_ktg, :wrapper_html => {:class => 'col2'}
15
- = f.input :for_uvg, :wrapper_html => {:class => 'col1'}
16
- = f.input :for_uvgz, :wrapper_html => {:class => 'col2'}
17
- = f.input :for_gross_income, :wrapper_html => {:class => 'col1'}
18
- = f.input :for_deduction_at_source, :wrapper_html => {:class => 'col2'}
19
- = f.input :salary_declaration_code, :wrapper_html => {:class => 'col1'}
16
+ .row
17
+ .span8= f.input :obligation, :as => :check_boxes, :collection => obligation_collection
18
+
19
+ .row
20
+ .span8= f.input :salary_declaration_code
20
21
 
21
22
  = f.buttons do
22
23
  = f.commit_button
@@ -12,6 +12,5 @@
12
12
  %th= t_attr :for_uvgz, SalaryBookingTemplate
13
13
  %th= t_attr :for_deduction_at_source, SalaryBookingTemplate
14
14
  %th= t_attr :salary_declaration_code, SalaryBookingTemplate
15
- %th.action-links
16
15
 
17
16
  = render @salary_booking_templates
@@ -1,6 +1,6 @@
1
1
  %tr[salary_booking_template]
2
2
  %td
3
- = link_to "%s (%s)" % [salary_booking_template.title, salary_booking_template.code], salary_booking_template
3
+ = link_to salary_booking_template.title, salary_booking_template, 'data-href-container' => 'tr'
4
4
  - if salary_booking_template.comments.present?
5
5
  %hr{:style => "height: 1px; margin: 0"}/
6
6
  %i= salary_booking_template.comments
@@ -14,8 +14,4 @@
14
14
  %td= salary_booking_template.for_uvg
15
15
  %td= salary_booking_template.for_uvgz
16
16
  %td= salary_booking_template.for_deduction_at_source
17
- %td= salary_booking_template.salary_declaration_code
18
- %td.action-links
19
- = list_link_for(:edit, salary_booking_template)
20
- = list_link_for(:delete, salary_booking_template)
21
- = link_to image_tag('16x16/copy.png', :title => 'Copy'), copy_salary_booking_template_path(salary_booking_template)
17
+ %td.number= salary_booking_template.salary_declaration_code
@@ -0,0 +1,13 @@
1
+ = semantic_form_for @salary_template do |f|
2
+ = f.semantic_errors
3
+ = f.inputs do
4
+ .row
5
+ .span8= f.input :title, :input_html => {"data-autofocus" => true}
6
+ .span8= f.input :person
7
+ .row
8
+ .span16= f.input :salary_booking_template, :input_html => {:class => 'span12'}
9
+ .row
10
+ .span16= f.input :remarks, :input_html => {:rows => 2, :class => 'span12'}
11
+
12
+ = f.buttons do
13
+ = f.commit_button
@@ -0,0 +1,7 @@
1
+ %table.salary_template_list
2
+ %tr
3
+ %th= t_attr :title, SalaryTemplate
4
+ %th= t_attr :person, SalaryTemplate
5
+ %th= t_attr :remarks, SalaryTemplate
6
+
7
+ = render @salary_templates
@@ -0,0 +1,4 @@
1
+ %tr[salary_template]
2
+ %td= link_to salary_template.title, salary_template, 'data-href-container' => 'tr'
3
+ %td= salary_template.person
4
+ %td= salary_template.remarks
@@ -0,0 +1,19 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require *Rails.groups(:assets) if defined?(Bundler)
8
+
9
+ module BookytSalary
10
+ class Application < Rails::Application
11
+ # Configure generators values. Many other options are available, be sure to check the documentation.
12
+ config.generators do |g|
13
+ g.stylesheets false
14
+ g.test_framework :rspec
15
+ g.template_engine :haml
16
+ g.fixture_replacement :factory_girl
17
+ end
18
+ end
19
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -3,6 +3,7 @@ de:
3
3
  models:
4
4
  salary: Lohn
5
5
  salary_booking_template: Lohnart
6
+ salary_template: Lohnvorlage
6
7
 
7
8
  attributes:
8
9
  salary:
@@ -13,17 +14,29 @@ de:
13
14
  employer: Arbeitgeber
14
15
  employee: Arbeitnehmer
15
16
  salary_booking_template:
16
- for_ahv: AHV/ALV
17
- for_ktg: KTG
17
+ for_ahv: AHV/ALV/IV/EO
18
+ for_ktg: Krankentaggeld-Versicherung (KTG)
18
19
  for_gross_income: Bruttolohn
19
- for_uvg: UVG
20
- for_uvgz: UVGZ
20
+ for_uvg: Unfall-Versicherung (UVG)
21
+ for_uvgz: Unfallzusatz-Versicherung (UVGZ)
22
+ obligation: Pflichtigkeit
21
23
  salary_declaration_code: Lohnausweis
22
24
  for_deduction_at_source: Quellensteuer
25
+ salary_template:
26
+ person: Person
27
+ salary_booking_template: Lohnarten
28
+ title: Titel
29
+ remarks: Bemerkungen
23
30
 
24
31
  salaries:
25
32
  select_employee:
26
33
  title: Arbeitnehmer auswählen
34
+ salary_booking_templates:
35
+ index:
36
+ title: Lohnarten
37
+ salary_templates:
38
+ index:
39
+ title: Lohnvorlagen
27
40
 
28
41
  bookyt:
29
42
  main_navigation:
data/config/routes.rb CHANGED
@@ -6,6 +6,8 @@ Rails.application.routes.draw do
6
6
  end
7
7
  end
8
8
 
9
+ resources :salary_templates
10
+
9
11
  resources :salaries do
10
12
  collection do
11
13
  get :select_employee
@@ -0,0 +1,9 @@
1
+ class CreateSalaryTemplates < ActiveRecord::Migration
2
+ def change
3
+ create_table :salary_templates do |t|
4
+ t.integer :person_id
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSalaryTemplateHabtmTable < ActiveRecord::Migration
2
+ def up
3
+ create_table "salary_templates_salary_booking_templates", :id => false do |t|
4
+ t.integer "salary_template_id"
5
+ t.integer "salary_booking_template_id"
6
+ end
7
+ end
8
+
9
+ def down
10
+ drop_table "salary_templates_salary_booking_templates"
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class RenameSalaryBookingTemplateHabtmTable < ActiveRecord::Migration
2
+ def up
3
+ rename_table :salary_templates_salary_booking_templates, :salary_booking_templates_salary_templates
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddTitleAndRemarksToSalaryTemplates < ActiveRecord::Migration
2
+ def change
3
+ add_column :salary_templates, :title, :string
4
+ add_column :salary_templates, :remarks, :text
5
+ end
6
+ end
@@ -5,10 +5,11 @@ module BookytSalary
5
5
  :if => Proc.new { user_signed_in? } do |salaries|
6
6
  salaries.item :salaries, t('bookyt.main_navigation.salaries'), salaries_path, :highlights_on => /\/salaries($|\/[0-9]*($|\/.*))/
7
7
  salaries.item :new_salary, t_title(:new, Salary), select_employee_salaries_path
8
- salaries.item :employees, t_title(:index, Employee), employees_path
9
- salaries.item :employments, t_title(:index, Employment), employments_path, :highlights_on => /\/employments($|\/[0-9]*($|\/.*))/
10
- salaries.item :salary_statistics, t_title(:statistics, Salary), statistics_salaries_path, :highlights_on => /\/salaries\/statistics($|\?)/
11
- account_item(salaries, '5000')
8
+ salaries.item :divider, "", :class => 'divider'
9
+ salaries.item :salary_statistics, t_title(:statistics, Salary), statistics_salaries_path
10
+ salaries.item :divider, "", :class => 'divider'
11
+ salaries.item :salary_booking_templates, t_title(:index, SalaryBookingTemplate), salary_booking_templates_path
12
+ salaries.item :salary_templates, t_title(:index, SalaryTemplate), salary_templates_path
12
13
  end
13
14
  end
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.5.1'
2
+ VERSION = '0.6.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: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 1
10
- version: 0.5.1
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -15,9 +15,80 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-13 00:00:00 Z
19
- dependencies: []
20
-
18
+ date: 2012-01-17 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 3
31
+ - 1
32
+ - 0
33
+ version: 3.1.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: recurrence
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: shoulda
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rcov
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-rails
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id005
21
92
  description: This plugin extends bookyt with Salary functionality.
22
93
  email: simon.huerlimann@cyt.ch
23
94
  executables: []
@@ -30,8 +101,11 @@ files:
30
101
  - app/assets/stylesheets/bookyt_salary.sass
31
102
  - app/controllers/salaries_controller.rb
32
103
  - app/controllers/salary_booking_templates_controller.rb
104
+ - app/controllers/salary_templates_controller.rb
105
+ - app/helpers/salary_booking_template_helper.rb
33
106
  - app/models/salary.rb
34
107
  - app/models/salary_booking_template.rb
108
+ - app/models/salary_template.rb
35
109
  - app/views/salaries/_form.html.haml
36
110
  - app/views/salaries/_list.html.haml
37
111
  - app/views/salaries/_salary.html.haml
@@ -45,18 +119,27 @@ files:
45
119
  - app/views/salary_booking_templates/_form.html.haml
46
120
  - app/views/salary_booking_templates/_list.html.haml
47
121
  - app/views/salary_booking_templates/_salary_booking_template.html.haml
122
+ - app/views/salary_templates/_form.html.haml
123
+ - app/views/salary_templates/_list.html.haml
124
+ - app/views/salary_templates/_salary_template.html.haml
125
+ - config/application.rb
126
+ - config/boot.rb
48
127
  - config/locales/bookyt_salary.de.yml
49
128
  - config/routes.rb
50
129
  - db/migrate/20111223162759_add_salary_specific_flags_to_booking_templates.rb
51
130
  - db/migrate/20111227093619_use_string_for_salary_declaration_code.rb
131
+ - db/migrate/20120117112030_create_salary_templates.rb
132
+ - db/migrate/20120117113315_create_salary_template_habtm_table.rb
133
+ - db/migrate/20120117120044_rename_salary_booking_template_habtm_table.rb
134
+ - db/migrate/20120117122025_add_title_and_remarks_to_salary_templates.rb
52
135
  - db/seeds.rb
53
136
  - lib/bookyt_salary.rb
54
137
  - lib/bookyt_salary/navigation.rb
55
138
  - lib/bookyt_salary/railtie.rb
56
139
  - lib/bookyt_salary/version.rb
57
140
  homepage: https://github.com/huerlisi/bookyt_salary
58
- licenses: []
59
-
141
+ licenses:
142
+ - MIT
60
143
  post_install_message:
61
144
  rdoc_options: []
62
145
 
@@ -83,9 +166,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
166
  requirements: []
84
167
 
85
168
  rubyforge_project:
86
- rubygems_version: 1.8.12
169
+ rubygems_version: 1.8.10
87
170
  signing_key:
88
171
  specification_version: 3
89
172
  summary: Salary plugin for bookyt
90
173
  test_files: []
91
174
 
175
+ has_rdoc: