lucadeal 0.5.4 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +3 -3
- data/lib/luca_deal/invoice.rb +5 -6
- data/lib/luca_deal/product.rb +1 -1
- data/lib/luca_deal/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7938104c239ce8cdc4d5ccc3b7545aba808ee13924705df3ace6bc76be83660e
|
4
|
+
data.tar.gz: 47b8e214254a6b224488dd1c1691e7bc4257b85f4fdd5338591199ecbaecf6be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b167651ef30ca197bd82dbdc1b20e56489f608647d70b1c16e1e73f8af0c252d65c1fc60dfff020785588ad09f57f4a67f1d3c74c65e49a78e2053fcd9c6fdb1
|
7
|
+
data.tar.gz: 6d31167a9c6942798551266b27719a90a798ac7edd9c94e71be37117e830e53e70b04faf5a5a68c74b5c74220c278f898f49fddaed3bae54a8b7a2295755e355
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -76,7 +76,7 @@ Invoice conditions are defined by contracts.
|
|
76
76
|
### Send Invoice
|
77
77
|
|
78
78
|
Invoice is implemented with HTML & ERB. Copy [default template](lib/luca_deal/templates/invoice.html.erb) to `templates/` in the data directory, and customize.
|
79
|
-
If you want to send invoices in PDF, you need to install `wkhtmltopdf command separately. Send mail command is
|
79
|
+
If you want to send invoices in PDF, you need to install `wkhtmltopdf` command separately. Send mail command is:
|
80
80
|
|
81
81
|
```
|
82
82
|
$ luca-deal invoice mail yyyy m
|
@@ -133,7 +133,7 @@ Contract is core object for calculation. Common fields are as follows:
|
|
133
133
|
| | effective | must | | Start date of the contract. |
|
134
134
|
| | defunct | | | End date of the contract. |
|
135
135
|
|
136
|
-
Fields for subscription customers are
|
136
|
+
Fields for subscription customers are:
|
137
137
|
|
138
138
|
| Top level | Second level | | historical | Description |
|
139
139
|
|-----------|---------------|----------|------------|------------------------------------------------------------------------------------------------------|
|
@@ -151,7 +151,7 @@ Fields for subscription customers are as bellows:
|
|
151
151
|
| | id | | | contract id of fee with sales partner. |
|
152
152
|
|
153
153
|
|
154
|
-
Fields for sales fee
|
154
|
+
Fields for sales fee:
|
155
155
|
|
156
156
|
| Top level | Second level | | historical | Description |
|
157
157
|
|-----------|--------------|----------|------------|-------------------------------------------------------------------------------------|
|
data/lib/luca_deal/invoice.rb
CHANGED
@@ -91,10 +91,8 @@ module LucaDeal
|
|
91
91
|
|
92
92
|
def self.report(date, scan_years = 10, detail: false, due: false)
|
93
93
|
fy_end = Date.new(date.year, date.month, -1)
|
94
|
-
|
95
|
-
|
96
|
-
Customer.all.each { |c| h[c['name']] = c }
|
97
|
-
end
|
94
|
+
customers = {}.tap do |h|
|
95
|
+
Customer.all.each { |c| h[c['id']] = LucaSupport::Code.parse_current(c, fy_end) }
|
98
96
|
end
|
99
97
|
[].tap do |res|
|
100
98
|
items = {}
|
@@ -113,7 +111,7 @@ module LucaDeal
|
|
113
111
|
next if (settle_date && settle_date <= fy_end)
|
114
112
|
end
|
115
113
|
|
116
|
-
customer = invoice.dig('customer', '
|
114
|
+
customer = invoice.dig('customer', 'id')
|
117
115
|
items[customer] ||= { 'unsettled' => BigDecimal('0'), 'invoices' => [] }
|
118
116
|
items[customer]['unsettled'] += (invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax')||0)
|
119
117
|
items[customer]['invoices'] << invoice
|
@@ -121,7 +119,8 @@ module LucaDeal
|
|
121
119
|
end
|
122
120
|
items.each do |k, item|
|
123
121
|
row = {
|
124
|
-
'
|
122
|
+
'id' => k,
|
123
|
+
'customer' => customers.dig(k, 'name'),
|
125
124
|
'unsettled' => LucaSupport::Code.readable(item['unsettled']),
|
126
125
|
}
|
127
126
|
if detail
|
data/lib/luca_deal/product.rb
CHANGED
@@ -17,7 +17,7 @@ module LucaDeal
|
|
17
17
|
YAML.dump(list).tap { |l| puts l }
|
18
18
|
end
|
19
19
|
|
20
|
-
# Save data with hash in Product format. Simple format is also available as
|
20
|
+
# Save data with hash in Product format. Simple format is also available as follows:
|
21
21
|
# {
|
22
22
|
# name: 'item_name(required)', price: 'item_price', qty: 'item_qty',
|
23
23
|
# initial: { name: 'item_name', price: 'item_price', qty: 'item_qty' }
|
data/lib/luca_deal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucadeal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.7.
|
19
|
+
version: 0.7.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.
|
26
|
+
version: 0.7.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|