bookyt_salary 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/bookyt_salary.sass +6 -0
- data/app/controllers/salaries_controller.rb +3 -14
- data/app/models/salary.rb +16 -5
- data/app/views/salaries/_form.html.haml +1 -0
- data/app/views/salaries/show.html.haml +14 -28
- data/config/locales/bookyt_salary.de.yml +4 -13
- data/lib/bookyt_salary/version.rb +1 -1
- metadata +5 -5
@@ -29,9 +29,10 @@ class SalariesController < InvoicesController
|
|
29
29
|
|
30
30
|
def new
|
31
31
|
@salary = Salary.new(params[:salary])
|
32
|
-
@
|
32
|
+
@salary.state = 'booked'
|
33
33
|
|
34
|
-
unless @employee
|
34
|
+
unless @salary.employee
|
35
|
+
# Trigger validation to flag bad values in select form
|
35
36
|
@salary.valid?
|
36
37
|
|
37
38
|
render :action => 'select_employee' and return
|
@@ -52,18 +53,6 @@ class SalariesController < InvoicesController
|
|
52
53
|
new!
|
53
54
|
end
|
54
55
|
|
55
|
-
def create
|
56
|
-
@salary = Salary.new(params[:salary])
|
57
|
-
@salary.state = 'booked'
|
58
|
-
|
59
|
-
# Set @employee in case we redisplay the form partial
|
60
|
-
@employee = @salary.employee
|
61
|
-
|
62
|
-
@salary.build_booking
|
63
|
-
|
64
|
-
create!
|
65
|
-
end
|
66
|
-
|
67
56
|
def payslip
|
68
57
|
show! do |format|
|
69
58
|
format.html { redirect_to :action => :show }
|
data/app/models/salary.rb
CHANGED
@@ -75,12 +75,23 @@ class Salary < Invoice
|
|
75
75
|
self.due_date ||= date
|
76
76
|
end
|
77
77
|
|
78
|
+
# Get salary template
|
79
|
+
#
|
80
|
+
# Tries to get a personal salary template, falls back to templates with
|
81
|
+
# no assigned persons.
|
82
|
+
#
|
83
|
+
# If more than one template matches the criteria, it is unspecified which
|
84
|
+
# one will be returned.
|
85
|
+
def salary_template
|
86
|
+
template = SalaryTemplate.where(:person_id => employee.id).last
|
87
|
+
template ||= SalaryTemplate.where(:person_id => nil).last
|
88
|
+
end
|
89
|
+
|
78
90
|
# Line Items
|
79
91
|
def build_line_items
|
80
|
-
|
81
|
-
template.salary_booking_templates.each do |booking_template|
|
92
|
+
salary_template.salary_booking_templates.each do |booking_template|
|
82
93
|
line_item = line_items.build(:date => self.value_date)
|
83
|
-
line_item.booking_template
|
94
|
+
line_item.set_booking_template(booking_template)
|
84
95
|
end
|
85
96
|
end
|
86
97
|
|
@@ -97,7 +108,7 @@ class Salary < Invoice
|
|
97
108
|
end
|
98
109
|
|
99
110
|
def self.available_credit_accounts
|
100
|
-
Account.
|
111
|
+
Account.all
|
101
112
|
end
|
102
113
|
|
103
114
|
def self.default_credit_account
|
@@ -105,7 +116,7 @@ class Salary < Invoice
|
|
105
116
|
end
|
106
117
|
|
107
118
|
def self.available_debit_accounts
|
108
|
-
Account.
|
119
|
+
Account.all
|
109
120
|
end
|
110
121
|
|
111
122
|
def self.default_debit_account
|
@@ -1,35 +1,21 @@
|
|
1
1
|
.contextual
|
2
|
-
= icon_link_to :pdf, :format => :pdf
|
3
2
|
= icon_link_to(:payslip, {:action => :payslip, :format => :pdf}, :target => '_blank')
|
4
3
|
= contextual_links_for
|
5
4
|
|
6
|
-
|
7
|
-
.
|
8
|
-
%table{:style => "width: 100%"}
|
9
|
-
%tr
|
10
|
-
%th= t_attr(:customer)
|
11
|
-
%td= link_to(full_address(resource.customer.vcard, ', '), resource.customer)
|
12
|
-
%th= t_attr(:company)
|
13
|
-
%td= link_to(full_address(resource.company.vcard, ', '), resource.company)
|
14
|
-
%tr
|
15
|
-
%th= t_attr(:amount)
|
16
|
-
%td= currency_fmt(resource.amount)
|
17
|
-
%tr
|
18
|
-
%th= t_attr(:duration_from, Invoice)
|
19
|
-
%td= l(resource.duration_from) if resource.duration_from
|
20
|
-
%th= t_attr(:duration_to, Invoice)
|
21
|
-
%td= l(resource.duration_to) if resource.duration_to
|
5
|
+
.page-header
|
6
|
+
%h1= resource.title
|
22
7
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
8
|
+
- bookings = Booking.by_reference(resource)
|
9
|
+
- credit_accounts = bookings.select('credit_account_id').group('credit_account_id').map{|account| account.credit_account}
|
10
|
+
- debit_accounts = bookings.select('debit_account_id').group('debit_account_id').map{|account| account.debit_account}
|
11
|
+
- accounts = (credit_accounts + debit_accounts).uniq
|
27
12
|
|
28
|
-
.
|
29
|
-
=
|
30
|
-
|
31
|
-
=
|
13
|
+
%ul.tabs
|
14
|
+
%li.active= link_to t_model, '#tab-main'
|
15
|
+
- accounts.each do |account|
|
16
|
+
%li= link_to account.to_s, "#tab-account-#{account.id}"
|
32
17
|
|
33
|
-
|
34
|
-
= render
|
35
|
-
|
18
|
+
.tab-content
|
19
|
+
#tab-main.active= render "form"
|
20
|
+
- accounts.each do |account|
|
21
|
+
%div{:id => "tab-account-#{account.id}"}= render 'direct_bookings/show', :reference => resource, :direct_account => account
|
@@ -23,10 +23,10 @@ de:
|
|
23
23
|
salary_declaration_code: Lohnausweis
|
24
24
|
for_deduction_at_source: Quellensteuer
|
25
25
|
salary_template:
|
26
|
-
person:
|
27
|
-
|
28
|
-
title:
|
29
|
-
remarks:
|
26
|
+
person: Person
|
27
|
+
salary_booking_templates: Lohnarten
|
28
|
+
title: Titel
|
29
|
+
remarks: Bemerkungen
|
30
30
|
|
31
31
|
salaries:
|
32
32
|
select_employee:
|
@@ -37,12 +37,3 @@ de:
|
|
37
37
|
salary_templates:
|
38
38
|
index:
|
39
39
|
title: Lohnvorlagen
|
40
|
-
|
41
|
-
bookyt:
|
42
|
-
main_navigation:
|
43
|
-
days: Tagesabschlüsse
|
44
|
-
new_day: Tagesabschluss
|
45
|
-
|
46
|
-
tooltip:
|
47
|
-
new_day: Hier können Sie einen neuen Tagesabschluss gemäss Registrierkasse buchen
|
48
|
-
days: Hier finden Sie eine Liste aller Tagesabschlüsse
|
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:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.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-
|
18
|
+
date: 2012-01-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|