uob-payroll 1.0.5 → 1.0.6

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: ffc20a1da3bc5aebc95f34d5751534f32886c086
4
- data.tar.gz: 6ff939c710c741b2700d934f17b45dce2b4cdc19
3
+ metadata.gz: 32983839740c020f77497bd36935fe222e0a4e08
4
+ data.tar.gz: 38d9c170b7c86606d13fe18c3e8c489f4780baa6
5
5
  SHA512:
6
- metadata.gz: c5b8e0106265cc6a2b1ef65b52d2e653962808eb93577b0231405383bb719d70f60fffcd24688557b976849042f19857b942a3b729ac8fa5013f77bcabaa2ffe
7
- data.tar.gz: 7304289625f6026dbc825163d15f368c3671ad9ac45657ecec7f4f594c03f1a88739bae5cf1aead15dbb231bd4653498d8703e78ddffe028508857b053e80524
6
+ metadata.gz: e42067c89bc9b913c80470bf129a2e8f503d6ec6c67d077d767e2d5ee1d55359954c4a37bc455133319611e228d780a9a7148fa22c02e66acf441c42c8fa1b26
7
+ data.tar.gz: 0305338ff2552081bd518550811e8c174b39cfc0af78206cc9a951b40dc8b71cac8289919f79c6075407b2421d134ffad45f88b40640da744de99202f84ee702
@@ -20,7 +20,7 @@ module UOB
20
20
  value_date: payable_date
21
21
  )
22
22
  @rows = transactions.map { |transaction| Row.new transaction }
23
- @footer = Footer.new total_amount: rows.sum(&:amount), header: header, rows: rows
23
+ @footer = Footer.new total_amount: total_amount(rows), header: header, rows: rows
24
24
  end
25
25
 
26
26
  def content
@@ -33,6 +33,14 @@ module UOB
33
33
 
34
34
  private
35
35
 
36
+ # We need to round each amount first before summing them up so that it matches
37
+ # the amounts in the details
38
+ def total_amount(rows)
39
+ rows.each.map { |row|
40
+ row.amount.round(2)
41
+ }.reduce(0, :+)
42
+ end
43
+
36
44
  attr_accessor :header, :rows, :footer
37
45
  end
38
46
  end
@@ -1,5 +1,5 @@
1
1
  module Uob
2
2
  module Payroll
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uob-payroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Paca