2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/prawn/payslip_document.rb', line 2
def salary_table(salary)
rows = []
saldo_rows = []
salary.line_items.each_with_index do |item, index|
if item.quantity == "saldo_of"
saldo_rows << index
rows << [item.title, nil, nil, currency_fmt(item.price)]
else
rows << [item.title, item.times_to_s, currency_fmt(item.price), currency_fmt(item.accounted_amount)]
end
end
table(rows, :width => bounds.width) do
cells.valign = :top
cells.borders = []
cells.padding_bottom = 2
cells.padding_top = 2
columns(0).padding_left = 0
columns(1..3).align = :right
saldo_rows.each do |index|
row(index).font_style = :bold
row(index).padding_bottom = 10
end
end
end
|