lucadeal 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/exe/luca-deal +7 -1
- data/lib/luca_deal/invoice.rb +10 -1
- data/lib/luca_deal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bccbeee521150eecf98d76d7a6ee89af35378d3d38b23074003be4efb003cb7a
|
4
|
+
data.tar.gz: 3d358fda0bef02a3b25e362d977f14d49b2f5a05641c7195b4b714929f11e665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6bacf4bbb7e4ef9343693a4bec91a5a4617a969fb40dd5f6cd9755434da6bce560f2cd1788c83f9dfd1810cc212b3a1a0325866bea9b903e86853ccbdf84118
|
7
|
+
data.tar.gz: 281a5b540e9746cd84b265e38537584cd2fb1b09372e5e443db4c269ec591bd92db9ab274b33cffaa3dd5b5c22bb65cc30520e56fe3febd19a0e8dfd84f19ada
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## LucaDeal 0.4.2
|
2
|
+
|
3
|
+
* `luca-deal custoer|invoice|fee list`, `luca-deal reports balance` supports interactive `--explore` w/nushell.
|
4
|
+
* `luca-deal invoices settle` checks already settled invoices and renamed customer.
|
5
|
+
|
1
6
|
## LucaDeal 0.4.1
|
2
7
|
|
3
8
|
* Limit LucaRecord dependency '>= 0.5.4'
|
data/exe/luca-deal
CHANGED
@@ -274,7 +274,9 @@ class LucaCmd
|
|
274
274
|
when 'json'
|
275
275
|
puts JSON.dump(dat)
|
276
276
|
when 'nu'
|
277
|
-
LucaSupport::View.nushell(dat)
|
277
|
+
LucaSupport::View.nushell(dat, :expand)
|
278
|
+
when 'explore'
|
279
|
+
LucaSupport::View.nushell(dat, :explore)
|
278
280
|
when 'csv'
|
279
281
|
str = CSV.generate(String.new, col_sep: "\t") do |row|
|
280
282
|
row << dat.first.keys
|
@@ -309,6 +311,7 @@ when /customers?/
|
|
309
311
|
OptionParser.new do |opt|
|
310
312
|
opt.banner = 'Usage: luca-deal customers list [options]'
|
311
313
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
314
|
+
opt.on('--explore', 'explore table in nushell') { |_v| params[:output] = 'explore' }
|
312
315
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
313
316
|
args = opt.parse(ARGV)
|
314
317
|
LucaCmd::Customer.list(args, params)
|
@@ -384,6 +387,7 @@ when /invoices?/, 'i'
|
|
384
387
|
OptionParser.new do |opt|
|
385
388
|
opt.banner = 'Usage: luca-deal invoices list [options] year month [date]'
|
386
389
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
390
|
+
opt.on('--explore', 'explore table in nushell') { |_v| params[:output] = 'explore' }
|
387
391
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
388
392
|
opt.on('--mail', 'send payment list by email') { |_v| params[:mail] = true }
|
389
393
|
args = opt.parse(ARGV)
|
@@ -432,6 +436,7 @@ when /reports?/, 'r'
|
|
432
436
|
OptionParser.new do |opt|
|
433
437
|
opt.banner = 'Usage: luca-deal r[eports] balance [options] [year month]'
|
434
438
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
439
|
+
opt.on('--explore', 'explore table in nushell') { |_v| params[:output] = 'explore' }
|
435
440
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
436
441
|
opt.on('--detail', 'show detail info') { |_v| params[:detail] = true }
|
437
442
|
opt.on('--force-due', 'respect due date over actual payment') { |_v| params[:due] = true }
|
@@ -470,6 +475,7 @@ when /fee/
|
|
470
475
|
OptionParser.new do |opt|
|
471
476
|
opt.banner = 'Usage: luca-deal fee list [options] year month [date]'
|
472
477
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
478
|
+
opt.on('--explore', 'explore table in nushell') { |_v| params[:output] = 'explore' }
|
473
479
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
474
480
|
opt.on('--html', 'output html invoices') { |_v| params[:html] = 'monthly' }
|
475
481
|
args = opt.parse(ARGV)
|
data/lib/luca_deal/invoice.rb
CHANGED
@@ -150,7 +150,11 @@ module LucaDeal
|
|
150
150
|
#
|
151
151
|
def self.settle(io, payment_terms = 1)
|
152
152
|
customers = {}.tap do |h|
|
153
|
-
Customer.all.each
|
153
|
+
Customer.all.each do |c|
|
154
|
+
LucaSupport::Code.take_history(c, 'name').each do |name|
|
155
|
+
h[name] = c
|
156
|
+
end
|
157
|
+
end
|
154
158
|
end
|
155
159
|
contracts = {}.tap do |h|
|
156
160
|
Contract.all.each { |c| h[c['customer_id']] ||= []; h[c['customer_id']] << c }
|
@@ -181,6 +185,11 @@ module LucaDeal
|
|
181
185
|
if Regexp.new("^LucaBook/#{j['id']}").match invoice.dig('settled', 'id')||''
|
182
186
|
break
|
183
187
|
end
|
188
|
+
next if 0 >= [
|
189
|
+
invoice.dig('subtotal', 0, 'items'),
|
190
|
+
invoice.dig('subtotal', 0, 'tax'),
|
191
|
+
invoice.dig('settled', 'amount')
|
192
|
+
].compact.sum
|
184
193
|
|
185
194
|
invoice['settled'] = {
|
186
195
|
'id' => "LucaBook/#{j['id']}",
|
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|