bookyt_salary 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,15 +3,23 @@ class PayslipDocument < LetterDocument
3
3
  head = [
4
4
  t_attr(:code, LineItem),
5
5
  t_attr(:title, LineItem),
6
- t_attr(:price, LineItem),
7
6
  t_attr(:times, LineItem),
7
+ t_attr(:price, LineItem),
8
8
  t_attr(:accounted_amount, LineItem)
9
9
  ]
10
- content = salary.line_items.collect do |item|
11
- [item.code, item.title, currency_fmt(item.price), item.times, currency_fmt(item.accounted_amount)]
10
+
11
+ rows = []
12
+ saldo_rows = []
13
+ salary.line_items.each_with_index do |item, index|
14
+ if item.quantity == "saldo_of"
15
+ saldo_rows << index + 1
16
+ rows << [item.code, item.title, nil, nil, currency_fmt(item.price)]
17
+ else
18
+ rows << [item.code, item.title, item.times_to_s, currency_fmt(item.price), currency_fmt(item.accounted_amount)]
19
+ end
12
20
  end
13
21
 
14
- rows = [head] + content
22
+ rows = [head] + rows
15
23
 
16
24
  table(rows, :width => bounds.width) do
17
25
  # General cell styling
@@ -23,8 +31,14 @@ class PayslipDocument < LetterDocument
23
31
  # Columns
24
32
  columns(2..4).align = :right
25
33
 
26
- # Footer styling
27
- row(-1).font_style = :bold
34
+ # Saldo styling
35
+ saldo_rows.each do |index|
36
+ row(index).font_style = :bold
37
+ row(index).padding_bottom = 8
38
+ end
39
+
40
+ # Header styling
41
+ row(0).font_style = :bold
28
42
  end
29
43
  end
30
44
  end
@@ -1,3 +1,3 @@
1
1
  module BookytSalary
2
- VERSION = '0.14.1'
2
+ VERSION = '0.14.2'
3
3
  end
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: 37
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 14
9
- - 1
10
- version: 0.14.1
9
+ - 2
10
+ version: 0.14.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"