lucadeal 0.4.0 → 0.4.2

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
  SHA256:
3
- metadata.gz: 14852f4570ab9b7da28524ffe3c4b9fc2129e96a3f7ade9991cfe2f20c8730e1
4
- data.tar.gz: 0a002fdffad8e94900f81ca53d130407c2dee4f03770cc7881d22f7313d20603
3
+ metadata.gz: bccbeee521150eecf98d76d7a6ee89af35378d3d38b23074003be4efb003cb7a
4
+ data.tar.gz: 3d358fda0bef02a3b25e362d977f14d49b2f5a05641c7195b4b714929f11e665
5
5
  SHA512:
6
- metadata.gz: 1046732b7d2256f2384186a38cd6d766d8409c7602959d864782f502b0c87729e24b1510c9662a92ea1dae2eb699edfa5e4b9ad36bd4ffd838bb9b42b1ca1ff7
7
- data.tar.gz: 4fd222f9031b9032542794d01a81982ca38732ecf38c8dac5ef48a165034dcbcd325646a841595c2b4139d2e30c9471faf5ebeab0b8fab2d140f251e09b5151f
6
+ metadata.gz: a6bacf4bbb7e4ef9343693a4bec91a5a4617a969fb40dd5f6cd9755434da6bce560f2cd1788c83f9dfd1810cc212b3a1a0325866bea9b903e86853ccbdf84118
7
+ data.tar.gz: 281a5b540e9746cd84b265e38537584cd2fb1b09372e5e443db4c269ec591bd92db9ab274b33cffaa3dd5b5c22bb65cc30520e56fe3febd19a0e8dfd84f19ada
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
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
+
6
+ ## LucaDeal 0.4.1
7
+
8
+ * Limit LucaRecord dependency '>= 0.5.4'
9
+
1
10
  ## LucaDeal 0.4.0
2
11
 
3
12
  * implement `luca-deal invoices print` for local HTML/PDF rendering.
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(YAML.dump(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)
@@ -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 { |c| h[c['name']] = c }
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']}",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaDeal
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.2'
5
5
  end
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.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-26 00:00:00.000000000 Z
11
+ date: 2023-04-18 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'
19
+ version: 0.5.4
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'
26
+ version: 0.5.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +103,7 @@ metadata:
103
103
  homepage_uri: https://github.com/chumaltd/luca/tree/master/lucadeal
104
104
  source_code_uri: https://github.com/chumaltd/luca/tree/master/lucadeal
105
105
  changelog_uri: https://github.com/chumaltd/luca/tree/master/lucadeal/CHANGELOG.md
106
- post_install_message:
106
+ post_install_message:
107
107
  rdoc_options: []
108
108
  require_paths:
109
109
  - lib
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubygems_version: 3.3.5
122
- signing_key:
122
+ signing_key:
123
123
  specification_version: 4
124
124
  summary: Deal with contracts
125
125
  test_files: []