bookyt_salary 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ @import blueprint/grid
2
+
3
+ // Grid
4
+ $blueprint-grid-columns: 24
5
+ $blueprint-grid-width: 30px
6
+ $blueprint-grid-margin: 10px
7
+
8
+
9
+ // Column widths
10
+ $column_small_form: 10
11
+
12
+ // Cash up styling
13
+ #cash_register_new,
14
+ #new_day
15
+ +column(12)
16
+
17
+ #cash_register_new
18
+ ul
19
+ width: 50%
20
+ float: left
21
+ &.second
22
+ li
23
+ width: 141px
24
+ float: right
25
+ label
26
+ width: 45px
27
+ float: left
28
+ input
29
+ width: 90px
30
+ #cash
31
+ float: left
32
+ color: red
33
+ text-decoration: underline
34
+ font-weight: bold
35
+ #result
36
+ width: 100%
37
+ margin-top: 10px
38
+ padding-top: 10px
39
+ border-top: 1px solid black
40
+ label
41
+ font-weight: bold
42
+ margin-right: 15px
43
+ input
44
+ width: 100%
45
+ li:first-child
46
+ margin-bottom: 10px
47
+
48
+ #new_day
49
+ label
50
+ width: 160px
51
+ input
52
+ width: 100px
53
+ float: right
54
+ &#day_submit
55
+ width: 100%
56
+
57
+ #day_edit
58
+ table
59
+ th
60
+ padding-right: 20px
@@ -1,4 +1,7 @@
1
1
  class SalariesController < AuthorizedController
2
+
3
+ respond_to :html, :pdf
4
+
2
5
  # Filter/Search
3
6
  # =============
4
7
  has_scope :by_state
@@ -39,6 +42,8 @@ class SalariesController < AuthorizedController
39
42
  end
40
43
 
41
44
  def payslip
42
- show!
45
+ show! do |format|
46
+ format.html { redirect_to :action => :show }
47
+ end
43
48
  end
44
49
  end
data/app/models/salary.rb CHANGED
@@ -1,4 +1,18 @@
1
1
  class Salary < Invoice
2
+ # Association customizing
3
+ belongs_to :employee, :foreign_key => :company_id, :class_name => 'Person'
4
+ belongs_to :employer, :foreign_key => :customer_id, :class_name => 'Person'
5
+
6
+ validates :employee, :employer, :presence => true
7
+
8
+ def employer_id=(value)
9
+ customer_id = value
10
+ end
11
+
12
+ def employee_id=(value)
13
+ company_id = value
14
+ end
15
+
2
16
  # String
3
17
  def to_s(format = :default)
4
18
  "%s (%s / %s - %s)" % [title, company, duration_from ? I18n::localize(duration_from) : '', duration_to ? I18n::localize(duration_to) : '']
@@ -69,11 +83,11 @@ class Salary < Invoice
69
83
  super(params, 'salary:employer:vkb').save
70
84
 
71
85
  super(params, 'salary:employee:ktg').save
72
- super(params.merge(:person_id => company.id), "salary:bvg").save
86
+ super(params.merge(:person_id => employee.id), "salary:bvg").save
73
87
 
74
88
  super(params, 'salary:invoice').save
75
89
 
76
- super(params.merge(:person_id => company.id), "salary:kz").save
77
- super(params.merge(:person_id => company.id), "salary:social:kz").save
90
+ super(params.merge(:person_id => employee.id), "salary:kz").save
91
+ super(params.merge(:person_id => employee.id), "salary:social:kz").save
78
92
  end
79
93
  end
@@ -0,0 +1,19 @@
1
+ prawn_document(:renderer => Prawn::LetterDocument) do |pdf|
2
+ employer = resource.employer
3
+ employee = resource.employee
4
+ direct_account = Account.find_by_code("5000")
5
+ direct_bookings = Booking.by_reference(resource)
6
+ direct_balance = direct_bookings.empty? ? 0.0 : direct_bookings.direct_balance(direct_account)
7
+
8
+ # Letter header
9
+ pdf.letter_header(employer, employee, resource.to_s)
10
+
11
+ # Free text with the socical security number
12
+ pdf.free_text "#{t_attr(:social_security_nr, Employee)}: #{employee.social_security_nr}"
13
+
14
+ # Line Items
15
+ pdf.salary_table(direct_balance, direct_account, direct_bookings)
16
+
17
+ # Closing
18
+ pdf.common_closing(employer)
19
+ end
@@ -1,6 +1,6 @@
1
1
  .contextual
2
2
  = icon_link_to :pdf, :format => :pdf
3
- = icon_link_to :payslip
3
+ = icon_link_to(:payslip, {:action => :payslip, :format => :pdf, :target => '_blank'})
4
4
  = contextual_links_for
5
5
 
6
6
  %h1= resource.title
@@ -25,17 +25,6 @@
25
25
  = collection_select :direct_booking, :booking_template_id, BookingTemplate.by_type(resource_class.name.underscore), :id, :title
26
26
  = submit_tag t_action('new')
27
27
 
28
- - @direct_account = Account.find_by_code("2050")
29
- %h3= link_to @direct_account.title, @direct_account
30
- #salary_payment_booking_list
31
- = render 'direct_bookings/list', :reference => resource
32
-
33
- - @direct_account = Account.find_by_code("5000")
34
- %h3= link_to @direct_account.title, @direct_account
35
- #salary_payment_booking_list
36
- = render 'direct_bookings/list', :reference => resource
37
-
38
- - @direct_account = Account.find_by_code("5700")
39
- %h3= link_to @direct_account.title, @direct_account
40
- #salary_booking_list
41
- = render 'direct_bookings/list', :reference => resource
28
+ = render 'direct_bookings/show', :reference => resource, :direct_account => Account.find_by_code("2050")
29
+ = render 'direct_bookings/show', :reference => resource, :direct_account => Account.find_by_code("5000")
30
+ = render 'direct_bookings/show', :reference => resource, :direct_account => Account.find_by_code("5700")
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,33 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bookyt_salary
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
13
- - "Simon H\xC3\xBCrlimann (CyT)"
7
+ authors:
8
+ - Simon Hürlimann (CyT)
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-19 00:00:00 +02:00
19
- default_executable:
12
+ date: 2011-11-04 00:00:00.000000000Z
20
13
  dependencies: []
21
-
22
14
  description: This plugin extends bookyt with Salary functionality.
23
15
  email: simon.huerlimann@cyt.ch
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
18
  extra_rdoc_files: []
29
-
30
- files:
19
+ files:
31
20
  - app/assets/stylesheets/bookyt_salary.sass
32
21
  - app/controllers/salaries_controller.rb
33
22
  - app/models/salary.rb
@@ -35,7 +24,7 @@ files:
35
24
  - app/views/salaries/_list.html.haml
36
25
  - app/views/salaries/_salary.html.haml
37
26
  - app/views/salaries/_salary_certificate.html.haml
38
- - app/views/salaries/payslip.html.haml
27
+ - app/views/salaries/payslip.pdf.prawn
39
28
  - app/views/salaries/show.html.haml
40
29
  - app/views/salaries/statistics.html.haml
41
30
  - config/locales/de.yml
@@ -45,39 +34,28 @@ files:
45
34
  - lib/bookyt_salary/navigation.rb
46
35
  - lib/bookyt_salary/railtie.rb
47
36
  - lib/bookyt_salary/version.rb
48
- has_rdoc: true
49
37
  homepage: https://github.com/huerlisi/bookyt_salary
50
38
  licenses: []
51
-
52
39
  post_install_message:
53
40
  rdoc_options: []
54
-
55
- require_paths:
41
+ require_paths:
56
42
  - lib
57
- required_ruby_version: !ruby/object:Gem::Requirement
43
+ required_ruby_version: !ruby/object:Gem::Requirement
58
44
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
- version: "0"
66
- required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
50
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
75
55
  requirements: []
76
-
77
56
  rubyforge_project:
78
- rubygems_version: 1.5.2
57
+ rubygems_version: 1.8.11
79
58
  signing_key:
80
59
  specification_version: 3
81
60
  summary: Salary plugin for bookyt
82
61
  test_files: []
83
-
@@ -1,40 +0,0 @@
1
- .contextual
2
- = icon_link_to :pdf, :format => :pdf
3
- = icon_link_to :show
4
-
5
- %h1= resource.title
6
- .box
7
- %table{:style => "width: 100%"}
8
- %tr
9
- %th= t_attr(:customer, Invoice)
10
- %td= link_to(full_address(resource.customer.vcard, ', '), resource.customer)
11
- %th= t_attr(:company, Invoice)
12
- %td= link_to(full_address(resource.company.vcard, ', '), resource.company)
13
- %tr
14
- %th= t_attr(:state, Invoice)
15
- %td#invoice_state=t resource.state, :scope => 'invoice.state'
16
- %tr
17
- %th= t_attr(:duration_from, Invoice)
18
- %td= l(resource.duration_from) if resource.duration_from
19
- %th= t_attr(:duration_to, Invoice)
20
- %td= l(resource.duration_to) if resource.duration_to
21
-
22
- .contextual
23
- = form_tag new_direct_booking_path(:direct_booking => {:reference_id => resource.id, :reference_type => resource_class.base_class}), :method => :get, :remote => true do
24
- = collection_select :direct_booking, :booking_template_id, BookingTemplate.by_type(resource_class.name.underscore), :id, :title
25
- = submit_tag t_action('new')
26
-
27
- %h3= Account.find_by_code("2050").title
28
- - @direct_account = Account.find_by_code("2050")
29
- #salary_payment_booking_list
30
- = render 'direct_bookings/list', :reference => resource
31
-
32
- %h3= Account.find_by_code("5000").title
33
- - @direct_account = Account.find_by_code("5000")
34
- #salary_payment_booking_list
35
- = render 'direct_bookings/list', :reference => resource
36
-
37
- %h3= Account.find_by_code("5700").title
38
- - @direct_account = Account.find_by_code("5700")
39
- #salary_booking_list
40
- = render 'direct_bookings/list', :reference => resource