lucadeal 0.2.14 → 0.2.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/luca_deal/invoice.rb +5 -5
- data/lib/luca_deal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d81788d16b07f572c9d07bf998cdaa5a8e55db76ea5b1b513eebaae3c783c61
|
4
|
+
data.tar.gz: d148d1079305e88354c47c3ce5699e2c656a40099228b9c1653488b451a41afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f41b4156fb05131e969b0490937c766076e1795a9a6c725e657e1f533333532436b34bb362f42aa9600dcb67e25f080a7a9f6b3bf8ce4a9c2f276990c69e478
|
7
|
+
data.tar.gz: ae87eae9ca9af5459e3082bf517feb98ec4a98e0af87bb52e625e4067212dd9d6743644a57383c092555d1e90fef4009871a13b6eefc17d1c0f8d5806e76f58d
|
data/lib/luca_deal/invoice.rb
CHANGED
@@ -97,7 +97,7 @@ module LucaDeal
|
|
97
97
|
collection << stat
|
98
98
|
end
|
99
99
|
end
|
100
|
-
puts YAML.dump(collection)
|
100
|
+
puts YAML.dump(LucaSupport::Code.readable(collection))
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -113,7 +113,7 @@ module LucaDeal
|
|
113
113
|
invoice['customer'] = get_customer(contract.dig('customer_id'))
|
114
114
|
invoice['due_date'] = due_date(@date)
|
115
115
|
invoice['issue_date'] = @date
|
116
|
-
invoice['sales_fee'] = contract.dig('sales_fee')
|
116
|
+
invoice['sales_fee'] = contract['sales_fee'] if contract.dig('sales_fee')
|
117
117
|
invoice['items'] = get_products(contract['products'])
|
118
118
|
.concat(contract['items']&.map { |i| i['qty'] ||= 1; i } || [])
|
119
119
|
.compact
|
@@ -201,12 +201,12 @@ module LucaDeal
|
|
201
201
|
{}.tap do |subtotal|
|
202
202
|
items.each do |i|
|
203
203
|
rate = i.dig('tax') || 'default'
|
204
|
-
qty = i['qty'] || 1
|
204
|
+
qty = i['qty'] || BigDecimal('1')
|
205
205
|
subtotal[rate] = { 'items' => 0, 'tax' => 0 } if subtotal.dig(rate).nil?
|
206
|
-
subtotal[rate]['items'] +=
|
206
|
+
subtotal[rate]['items'] += i['price'] * qty
|
207
207
|
end
|
208
208
|
subtotal.each do |rate, amount|
|
209
|
-
amount['tax'] = (amount['items'] * load_tax_rate(rate))
|
209
|
+
amount['tax'] = (amount['items'] * load_tax_rate(rate))
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
data/lib/luca_deal/version.rb
CHANGED