bookyt_salary 0.20.4 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/salary_booking_templates_controller.rb +0 -11
- data/app/controllers/salary_reports_controller.rb +14 -8
- data/app/views/salary_items/_list_form.html.haml +1 -1
- data/app/views/salary_reports/salary_declaration.html.haml +3 -0
- data/app/views/salary_reports/statistics.html.haml +31 -0
- data/app/views/salary_reports/yearly_ahv_statement.html.haml +2 -8
- data/config/locales/bookyt_salary.de.yml +4 -1
- data/config/routes.rb +0 -3
- data/lib/bookyt_salary/navigation.rb +2 -2
- data/lib/bookyt_salary/version.rb +1 -1
- metadata +3 -3
- data/app/views/salary_booking_templates/statistics.html.haml +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3deb668d13d35a6fd748f57b475037b07bc8b33b
|
4
|
+
data.tar.gz: 5b96723ac942ffd73e800e0a809c7e9659aec329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb54ed03025868ecc32fc0f0b00c90035b3da46e8116b537f76efdc3467031e0cd5d2fa6e4eef40c4d6d004e6b1e79204506ce9760ba8ab919383c97c1754447
|
7
|
+
data.tar.gz: 204c8b96120b3bb4819b6f6ce92394d649c7a069ff23b14a35919ef8efb1cb0f783126eb890897e3678a86bcc1c0e08278de45b956db32b000bac5be9d828f9a
|
@@ -10,15 +10,4 @@ class SalaryBookingTemplatesController < BookingTemplatesController
|
|
10
10
|
|
11
11
|
render 'edit'
|
12
12
|
end
|
13
|
-
|
14
|
-
def statistics
|
15
|
-
if params['date']
|
16
|
-
date = Date.parse(params['date'])
|
17
|
-
else
|
18
|
-
date = Date.today
|
19
|
-
end
|
20
|
-
|
21
|
-
@duration = date.beginning_of_month..date.end_of_month
|
22
|
-
@salary_booking_templates = SalaryBookingTemplate.all
|
23
|
-
end
|
24
13
|
end
|
@@ -1,24 +1,30 @@
|
|
1
1
|
class SalaryReportsController < ApplicationController
|
2
2
|
respond_to :html, :pdf
|
3
|
-
|
4
|
-
|
5
|
-
# =======
|
6
|
-
def yearly_ahv_statement
|
3
|
+
|
4
|
+
before_filter do
|
7
5
|
@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]
|
8
6
|
@value_period ||= Date.today.beginning_of_year..Date.today.end_of_year
|
9
7
|
|
8
|
+
if employee_id = params[:by_employee]
|
9
|
+
@employee = Employee.find(employee_id)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def yearly_ahv_statement
|
10
14
|
@employments = Employment.valid_during(@value_period).all
|
11
15
|
end
|
12
16
|
|
13
17
|
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
18
|
@salaries = @employee.salaries.where(:value_date => @value_period)
|
19
19
|
@line_items = @salaries.collect{|salary| salary.line_items}.flatten
|
20
20
|
|
21
21
|
# TODO: better sorting
|
22
22
|
@salary_declaration_codes = SalaryBookingTemplate.pluck(:salary_declaration_code).uniq.select{|code| code.present?}
|
23
23
|
end
|
24
|
+
|
25
|
+
def statistics
|
26
|
+
@year = @value_period.first.year
|
27
|
+
|
28
|
+
@salary_booking_templates = SalaryBookingTemplate.all
|
29
|
+
end
|
24
30
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
= contextual_links
|
2
|
+
|
3
|
+
= boot_page_title
|
4
|
+
|
5
|
+
%table.table.table-striped.collection
|
6
|
+
%thead
|
7
|
+
%tr
|
8
|
+
%th= t_attr :code, SalaryBookingTemplate
|
9
|
+
%th= t_attr :title, SalaryBookingTemplate
|
10
|
+
- (1..12).each do |month|
|
11
|
+
%th.currency= '%02i/%i' % [month, @year]
|
12
|
+
%th.right= t_attr :amount, SalaryBookingTemplate
|
13
|
+
%tbody
|
14
|
+
- @salary_booking_templates.each do |template|
|
15
|
+
- line_items = template.line_items.where(:date => @value_period)
|
16
|
+
- line_items = line_items.includes(:invoice).where(invoices: {company_id: @employee.id}) if @employee
|
17
|
+
- total_amount = line_items.sum(&:accounted_amount)
|
18
|
+
- next if total_amount == 0
|
19
|
+
%tr
|
20
|
+
%td= template.code
|
21
|
+
%td= template.title
|
22
|
+
- (1..12).each do |month|
|
23
|
+
- duration_from = Date.new(@year, month, 1)
|
24
|
+
- duration_to = duration_from.end_of_month
|
25
|
+
- duration = duration_from..duration_to
|
26
|
+
- amount = line_items.where(:date => duration).sum(&:accounted_amount)
|
27
|
+
%td.currency= currency_fmt(amount)
|
28
|
+
%td.currency= currency_fmt(total_amount)
|
29
|
+
|
30
|
+
= render 'filters/by_calendar_year'
|
31
|
+
= render 'filters/by_employee'
|
@@ -28,7 +28,7 @@
|
|
28
28
|
%td.currency= currency_fmt(ahv_amount)
|
29
29
|
%td.currency= currency_fmt(0)
|
30
30
|
%td= employment.employee.sex_to_s
|
31
|
-
%td.action-links= link_to t_action(:salary_declaration), salary_declaration_path(:
|
31
|
+
%td.action-links= link_to t_action(:salary_declaration), salary_declaration_path(:by_employee => employment.employee, :by_value_period => params[:by_value_period])
|
32
32
|
|
33
33
|
%tfoot
|
34
34
|
%tr
|
@@ -40,10 +40,4 @@
|
|
40
40
|
%th
|
41
41
|
%th.action-links
|
42
42
|
|
43
|
-
|
44
|
-
.sub-tabs
|
45
|
-
%h3 Filter
|
46
|
-
%ul
|
47
|
-
- years = current_tenant.incorporated_on.year..Date.today.year
|
48
|
-
- for year in years
|
49
|
-
%li= link_to year, url_for(params.merge({:by_value_period => {:from => Date.new(year, 1, 1).to_s(:db), :to => Date.new(year, 12, 31).to_s(:db)}}))
|
43
|
+
= render 'filters/by_calendar_year'
|
@@ -18,6 +18,8 @@ de:
|
|
18
18
|
salary_booking_template:
|
19
19
|
include_in_saldo_list: Pflichtigkeit
|
20
20
|
salary_declaration_code: Lohnausweis
|
21
|
+
code: Lohnart
|
22
|
+
title: Buchungstext
|
21
23
|
salary_template:
|
22
24
|
person: Person
|
23
25
|
salary_booking_templates: Lohnarten
|
@@ -38,7 +40,6 @@ de:
|
|
38
40
|
salary_booking_templates:
|
39
41
|
index:
|
40
42
|
title: Lohnarten
|
41
|
-
statistics: Rekapitulation
|
42
43
|
salary_templates:
|
43
44
|
index:
|
44
45
|
title: Lohnvorlagen
|
@@ -50,6 +51,8 @@ de:
|
|
50
51
|
title: AHV Lohnbescheinigung
|
51
52
|
salary_declaration:
|
52
53
|
title: Lohnausweis
|
54
|
+
statistics:
|
55
|
+
title: Rekapitulation
|
53
56
|
|
54
57
|
overview:
|
55
58
|
bookyt:
|
data/config/routes.rb
CHANGED
@@ -6,8 +6,8 @@ module BookytSalary
|
|
6
6
|
salaries.item :salary_list, t_title(:index, Salary), salaries_path, :highlights_on => /\/salaries($|\/[0-9]*($|\/.*))/
|
7
7
|
salaries.item :new_salary, t_title(:new, Salary), select_employee_salaries_path
|
8
8
|
salaries.item :divider, "", :class => 'divider'
|
9
|
-
salaries.item :
|
10
|
-
salaries.item :yearly_ahv_statement,
|
9
|
+
salaries.item :statistics, t('salary_reports.statistics.title'), url_for('/salary_reports/statistics')
|
10
|
+
salaries.item :yearly_ahv_statement, t('salary_reports.yearly_ahv_statement.title'), url_for("/salary_reports/yearly_ahv_statement")
|
11
11
|
salaries.item :divider, "", :class => 'divider'
|
12
12
|
salaries.item :salary_booking_templates, t_title(:index, SalaryBookingTemplate), salary_booking_templates_path
|
13
13
|
salaries.item :salary_templates, t_title(:index, SalaryTemplate), salary_templates_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookyt_salary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hürlimann (CyT)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -112,12 +112,12 @@ files:
|
|
112
112
|
- app/views/salary_booking_templates/_form.html.haml
|
113
113
|
- app/views/salary_booking_templates/_list.html.haml
|
114
114
|
- app/views/salary_booking_templates/_salary_booking_template.html.haml
|
115
|
-
- app/views/salary_booking_templates/statistics.html.haml
|
116
115
|
- app/views/salary_items/_form.html.haml
|
117
116
|
- app/views/salary_items/_line_item.html.haml
|
118
117
|
- app/views/salary_items/_list_form.html.haml
|
119
118
|
- app/views/salary_items/_list_header.html.haml
|
120
119
|
- app/views/salary_reports/salary_declaration.html.haml
|
120
|
+
- app/views/salary_reports/statistics.html.haml
|
121
121
|
- app/views/salary_reports/yearly_ahv_statement.html.haml
|
122
122
|
- app/views/salary_templates/_form.html.haml
|
123
123
|
- app/views/salary_templates/_list.html.haml
|
@@ -1,25 +0,0 @@
|
|
1
|
-
= contextual_links
|
2
|
-
|
3
|
-
= boot_page_title
|
4
|
-
|
5
|
-
%table.table.table-striped.collection
|
6
|
-
%thead
|
7
|
-
%tr
|
8
|
-
%th= t_attr :code
|
9
|
-
%th= t_attr :title
|
10
|
-
%th.right= t_attr :amount
|
11
|
-
%tbody
|
12
|
-
- for template in @salary_booking_templates
|
13
|
-
- amount = template.line_items.where(:date => @duration).sum(&:accounted_amount)
|
14
|
-
- next if amount == 0
|
15
|
-
%tr
|
16
|
-
%td= template.code
|
17
|
-
%td= template.title
|
18
|
-
%td.currency= currency_fmt(amount)
|
19
|
-
|
20
|
-
- content_for :sidebar do
|
21
|
-
.sub-tabs
|
22
|
-
%ul.pager
|
23
|
-
- for month in 1..12
|
24
|
-
- date = Date.new(Date.today.year, month, 1)
|
25
|
-
%li= link_to t('date.month_names')[date.month], url_for(:date => date.to_s(:db))
|