bookyt_salary 0.19.4 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,4 +9,16 @@ class SalaryReportsController < ApplicationController
9
9
 
10
10
  @employments = Employment.valid_during(@value_period).all
11
11
  end
12
+
13
+ def salary_declaration
14
+ @value_period = Date.parse(params[:by_value_period][:from] || Date.today.beginning_of_year)..Date.parse(params[:by_value_period][:to] || Date.today.end_of_year) if params[:by_value_period]
15
+ @value_period ||= Date.today.beginning_of_year..Date.today.end_of_year
16
+
17
+ @employee = Employee.find(params[:employee_id])
18
+ @salaries = @employee.salaries.where(:value_date => @value_period)
19
+ @line_items = @salaries.collect{|salary| salary.line_items}.flatten
20
+
21
+ # TODO: better sorting
22
+ @salary_declaration_codes = SalaryBookingTemplate.pluck(:salary_declaration_code).uniq.select{|code| code.present?}
23
+ end
12
24
  end
@@ -3,6 +3,9 @@ module BookytSalary
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
+ # Associations
7
+ has_many :salaries, :foreign_key => :company_id
8
+
6
9
  has_many :salary_templates, :foreign_key => :person_id
7
10
  end
8
11
  end
@@ -12,6 +12,7 @@
12
12
  %th.currency ALV-Lohn
13
13
  %th.currency ALVZ-Lohn
14
14
  %th M/F
15
+ %th.action-links
15
16
  %tbody
16
17
  - ahv_total = 0
17
18
  - for employment in @employments
@@ -27,6 +28,7 @@
27
28
  %td.currency= currency_fmt(ahv_amount)
28
29
  %td.currency= currency_fmt(0)
29
30
  %td= employment.employee.sex_to_s
31
+ %td.action-links= link_to t_action(:salary_declaration), salary_declaration_path(:employee_id => employment.employee, :by_value_period => params[:by_value_period])
30
32
 
31
33
  %tfoot
32
34
  %tr
@@ -36,6 +38,7 @@
36
38
  %th.currency= currency_fmt(ahv_total)
37
39
  %th.currency= currency_fmt(0)
38
40
  %th
41
+ %th.action-links
39
42
 
40
43
  - content_for :sidebar do
41
44
  .sub-tabs
@@ -48,9 +48,14 @@ de:
48
48
  salary_reports:
49
49
  yearly_ahv_statement:
50
50
  title: AHV Lohnbescheinigung
51
+ salary_declaration:
52
+ title: Lohnausweis
51
53
 
52
54
  overview:
53
55
  bookyt:
54
56
  overview:
55
57
  title:
56
- title: Übersicht
58
+ title: Übersicht
59
+ crud:
60
+ action:
61
+ salary_declaration: Lohnausweis
data/config/routes.rb CHANGED
@@ -38,4 +38,5 @@ Rails.application.routes.draw do
38
38
  end
39
39
 
40
40
  get 'salary_reports/:action', :controller => :salary_reports
41
+ get 'salary_reports/salary_declaration', :to => 'salary_reports#salary_declaration', :as => :salary_declaration
41
42
  end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.19.4'
2
+ VERSION = '0.20.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookyt_salary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.4
4
+ version: 0.20.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails