bookyt_salary 0.23.0 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00f477bc47705bfdc14e876b3d51cdea9e35b625
4
- data.tar.gz: dc9bb2024b0c4278e97a683d63652724e70b7efe
3
+ metadata.gz: 97609cf6b41e8e8b41c48d27f145b004951bb53a
4
+ data.tar.gz: 748bf97554b2b9fcc68e15826ac05b82d8249012
5
5
  SHA512:
6
- metadata.gz: 3bb921fd4a879f74422b4bc4ec8389897a5e7ea987f27930e71d9171688ebe0734778e10f72bf9cfa0e1b0320ba65b4147d543c0d682b78ec1d5f6ed3c99bf8c
7
- data.tar.gz: c5f93a1b0fb6f580f03e556da788b53b50e466484f04c52bb4651112fd79b74ffa7d05c2debfdb81421a7a1e065c23730fde8384871cd84e3452cf9c65ac0481
6
+ metadata.gz: f3feeda68bacf62355c6f51bd6ba256a482c4fa36efcb9dc1bec6d8963396f223ab0618c8195f0115dbf13d5c02143eeda000240f04316264744066cbd0c186c
7
+ data.tar.gz: 594921d94accd4194253a15e7c8f363b561b81fc41b21781c3b3a62f46e67f2c359f5ed278b89d32a571ba15ebb37ad7d2e0723a2d05d87d26f799904ab17b59
@@ -5,8 +5,7 @@ class SalariesController < InvoicesController
5
5
 
6
6
  # Filter/Search
7
7
  # =============
8
- has_scope :invoice_state, :default => nil
9
- has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
8
+ has_scope :by_date, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
10
9
  has_scope :by_employee
11
10
 
12
11
  # Actions
@@ -1,9 +1,11 @@
1
1
  class SalaryReportsController < ApplicationController
2
2
  respond_to :html, :pdf
3
3
 
4
+ # Filter/Search
5
+ # =============
4
6
  before_filter do
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]
6
- @value_period ||= Date.today.beginning_of_year..Date.today.end_of_year
7
+ @by_date = Date.parse(params[:by_date][:from] || Date.today.beginning_of_year)..Date.parse(params[:by_date][:to] || Date.today.end_of_year) if params[:by_date]
8
+ @by_date ||= Date.today.beginning_of_year..Date.today.end_of_year
7
9
 
8
10
  if employee_id = params[:by_employee]
9
11
  @employee = Employee.find(employee_id)
@@ -11,11 +13,11 @@ class SalaryReportsController < ApplicationController
11
13
  end
12
14
 
13
15
  def yearly_ahv_statement
14
- @employments = Employment.valid_during(@value_period).all
16
+ @employments = Employment.valid_during(@by_date).all
15
17
  end
16
18
 
17
19
  def salary_declaration
18
- @salaries = @employee.salaries.where(:value_date => @value_period)
20
+ @salaries = @employee.salaries.where(:value_date => @by_date)
19
21
  @line_items = @salaries.collect{|salary| salary.line_items}.flatten
20
22
 
21
23
  # TODO: better sorting
@@ -23,7 +25,7 @@ class SalaryReportsController < ApplicationController
23
25
  end
24
26
 
25
27
  def statistics
26
- @year = @value_period.first.year
28
+ @year = @by_date.first.year
27
29
 
28
30
  @salary_booking_templates = SalaryBookingTemplate.all
29
31
  end
data/app/models/salary.rb CHANGED
@@ -128,7 +128,7 @@ class Salary < Invoice
128
128
 
129
129
  # Filter/Search
130
130
  # =============
131
- scope :by_value_period, lambda {|from, to| where("date(value_date) BETWEEN ? AND ?", from, to) }
131
+ scope :by_date, lambda {|from, to| where("date(value_date) BETWEEN ? AND ?", from, to) }
132
132
  scope :by_employee, lambda {|value| where(:company_id => value)}
133
133
 
134
134
  # Accounts
@@ -141,7 +141,7 @@ class Salary < Invoice
141
141
  Account.all
142
142
  end
143
143
 
144
- def self.default_credit_account
144
+ def self.credit_account
145
145
  Account.find_by_code('5000')
146
146
  end
147
147
 
@@ -149,7 +149,7 @@ class Salary < Invoice
149
149
  Account.all
150
150
  end
151
151
 
152
- def self.default_debit_account
152
+ def self.debit_account
153
153
  self.direct_account
154
154
  end
155
155
 
@@ -1,4 +1,7 @@
1
1
  class SalaryBookingTemplate < BookingTemplate
2
+ # Access restrictions
3
+ attr_accessible :include_in_saldo_list, :salary_declaration_code
4
+
2
5
  # Obligation flags
3
6
  def self.saldo_inclusion_flags
4
7
  # Fix: Using .pluck(:name) would be nice but gives non-deterministic behaviour (id instead of name, sometimes)
@@ -3,4 +3,4 @@
3
3
  = boot_page_title t_model SalaryTemplate
4
4
 
5
5
  - @salary_template = @employee.salary_templates.first
6
- = render 'salary_templates/form' if @salary_template
6
+ = render 'salary_templates/form', :resource => @salary_template if @salary_template
@@ -1,4 +1,4 @@
1
- = simple_form_for @salary do |f|
1
+ = simple_form_for resource do |f|
2
2
  = f.input :employee_id, :as => :hidden
3
3
  = f.input :employer_id, :as => :hidden
4
4
  = f.input :state, :as => :hidden
@@ -8,8 +8,8 @@
8
8
  .span6= f.input :duration_from, :as => :date_field
9
9
  .span6= f.input :duration_to, :as => :date_field
10
10
  .row-fluid
11
- .span6= f.input :used_leave_days, :as => :string
12
- .span6= f.input :leave_days_balance, :as => :string
11
+ .span6= f.input :used_leave_days, :as => :string, :input_html => {:class => 'span2'}
12
+ .span6= f.input :leave_days_balance, :as => :string, :input_html => {:class => 'span2'}
13
13
  .row-fluid
14
14
  .span12= f.input :text, :input_html => {:rows => 4}
15
15
  .row-fluid
@@ -17,4 +17,5 @@
17
17
 
18
18
  = render 'line_items/list_form', :f => f, :invoice => resource
19
19
 
20
- = f.button :submit
20
+ .form-actions
21
+ = f.button :submit
@@ -1,6 +1,6 @@
1
1
  = boot_page_title
2
2
 
3
- = simple_form_for @salary, :url => new_salary_path, :method => :get do |f|
3
+ = simple_form_for resource, :url => new_salary_path, :method => :get do |f|
4
4
  .row-fluid
5
5
  .span12
6
6
  =f.association :employee, :as => :combobox
@@ -8,4 +8,5 @@
8
8
  .span12
9
9
  = f.input :duration_from, :as => :date_field
10
10
 
11
- = f.button :submit
11
+ .form-actions
12
+ = f.button :submit
@@ -1,5 +1,5 @@
1
1
  .contextual
2
- = icon_link_to(:payslip, {:action => :payslip, :format => :pdf}, :target => '_blank')
2
+ = icon_link_to :payslip, {:action => :payslip, :format => :pdf}, :icon => :print
3
3
  = contextual_links_for
4
4
 
5
5
  =boot_page_title
@@ -1,4 +1,4 @@
1
- = simple_form_for @salary_booking_template do |f|
1
+ = simple_form_for resource do |f|
2
2
  .row-fluid
3
3
  .span6= f.input :title, :input_html => {"data-autofocus" => true}
4
4
  .span6= f.input :code
@@ -17,4 +17,5 @@
17
17
  .row-fluid
18
18
  .span12= f.input :salary_declaration_code
19
19
 
20
- = f.button :submit
20
+ .form-actions
21
+ = f.button :submit
@@ -5,4 +5,4 @@
5
5
  %td= salary_item.text_field :price, :required => true, :style => 'width: 5em', :autocomplete => "off"
6
6
  %td.action_links
7
7
  = salary_item.hidden_field :_destroy
8
- = link_to t_action(:delete), '#', :class => 'icon-delete-text delete-nested-form-item'
8
+ = list_link_to :delete, '#', :class => 'delete-nested-form-item'
@@ -14,7 +14,7 @@
14
14
  %th.right= t_attr :amount, SalaryBookingTemplate
15
15
  %tbody
16
16
  - @salary_booking_templates.each do |template|
17
- - line_items = template.line_items.where(:date => @value_period)
17
+ - line_items = template.line_items.where(:date => @by_date)
18
18
  - line_items = line_items.includes(:invoice).where(invoices: {company_id: @employee.id}) if @employee
19
19
  - total_amount = line_items.sum(&:accounted_amount)
20
20
  - next if total_amount == 0
@@ -1,4 +1,4 @@
1
- - title = [ t_title, @value_period.last.year ].presence.compact.join(' - ')
1
+ - title = [ t_title, @by_date.last.year ].presence.compact.join(' - ')
2
2
  = boot_page_title title
3
3
 
4
4
  %table.table.table-striped.collection
@@ -17,19 +17,19 @@
17
17
  %tbody
18
18
  - ahv_total = 0
19
19
  - for employment in @employments
20
- - ahv_amount = employment.employee.salaries.where(:value_date => @value_period).sum(&:ahv_amount)
20
+ - ahv_amount = employment.employee.salaries.where(:value_date => @by_date).sum(&:ahv_amount)
21
21
  - ahv_total += ahv_amount
22
22
  %tr
23
23
  %td= employment.employee.ssn
24
24
  %td= employment.employee.date_of_birth
25
25
  %td= employment.employee.vcard.full_name
26
- %td= duration_from(employment, @value_period)
27
- %td= duration_to(employment, @value_period)
26
+ %td= duration_from(employment, @by_date)
27
+ %td= duration_to(employment, @by_date)
28
28
  %td.currency= currency_fmt(ahv_amount)
29
29
  %td.currency= currency_fmt(ahv_amount)
30
30
  %td.currency= currency_fmt(0)
31
31
  %td= employment.employee.sex_to_s
32
- %td.action-links= link_to t_action(:salary_declaration), salary_declaration_path(:by_employee => employment.employee, :by_value_period => params[:by_value_period])
32
+ %td.action-links= link_to t_action(:salary_declaration), salary_declaration_path(:by_employee => employment.employee, :by_date => params[:by_date])
33
33
 
34
34
  %tfoot
35
35
  %tr
@@ -1,4 +1,4 @@
1
- = simple_form_for @salary_template do |f|
1
+ = simple_form_for resource do |f|
2
2
  .row-fluid
3
3
  .span6= f.input :title, :input_html => {"data-autofocus" => true}
4
4
  .span6= f.association :person, :as => :combobox, :collection => Employee.all
@@ -7,4 +7,5 @@
7
7
 
8
8
  = render 'salary_items/list_form', :f => f
9
9
 
10
- = f.button :submit
10
+ .form-actions
11
+ = f.button :submit
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.23.0'
2
+ VERSION = '0.23.2'
3
3
  end
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.23.0
4
+ version: 0.23.2
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: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,48 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: shoulda
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rcov
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
41
  description: This plugin extends bookyt with Salary functionality.
84
42
  email: simon.huerlimann@cyt.ch
85
43
  executables: []
@@ -170,7 +128,7 @@ requirements: []
170
128
  rubyforge_project:
171
129
  rubygems_version: 2.4.5
172
130
  signing_key:
173
- specification_version: 3
131
+ specification_version: 4
174
132
  summary: Salary plugin for bookyt
175
133
  test_files: []
176
134
  has_rdoc: