lucadeal 0.3.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/exe/luca-deal +20 -5
- data/lib/luca_deal/invoice.rb +17 -4
- 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: 560b745f485f42d80938858af2ff4cdbe1b2cc9aef27898ca0801430c6d638cd
|
4
|
+
data.tar.gz: f800500cc78a51ca0cb574856493ae43660d659a463f741b442d0887da9027a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c1d0abdf72851ceb10a18cf64538aee7ef1c9313d0ab4fc86bcbebf090824e4002670225208b7ddf30c38eb6e064062e15ba15c858f411895c17ce674ca1612
|
7
|
+
data.tar.gz: 1d9f8d246ddd47196860e350662dc34989e810e0f5e9951b380e1028962ce4a0c9a2c926592991d5a8a39036a8ab38fbc38c22b6580bec8372f50ab02753e2f7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## LucaDeal 0.4.1
|
2
|
+
|
3
|
+
* Limit LucaRecord dependency '>= 0.5.4'
|
4
|
+
|
5
|
+
## LucaDeal 0.4.0
|
6
|
+
|
7
|
+
* implement `luca-deal invoices print` for local HTML/PDF rendering.
|
8
|
+
* remove `luca-deal invoices list --html` in favor of `print` sub command.
|
9
|
+
|
1
10
|
## LucaDeal 0.3.1
|
2
11
|
|
3
12
|
* add `luca-deal invoices settle --search-terms` for late payment case.
|
data/exe/luca-deal
CHANGED
@@ -177,9 +177,7 @@ class LucaCmd
|
|
177
177
|
date = "#{Date.today.year}-#{Date.today.month}-1"
|
178
178
|
count = 3
|
179
179
|
end
|
180
|
-
if params[:
|
181
|
-
LucaDeal::Invoice.new(date).preview_stdout
|
182
|
-
elsif params[:mail]
|
180
|
+
if params[:mail]
|
183
181
|
LucaDeal::Invoice.new(date).stats_email
|
184
182
|
else
|
185
183
|
render(LucaDeal::Invoice.new(date).stats(count || 1), params)
|
@@ -201,6 +199,16 @@ class LucaCmd
|
|
201
199
|
end
|
202
200
|
end
|
203
201
|
|
202
|
+
def self.print(args = nil, params = {})
|
203
|
+
if args.length >= 2
|
204
|
+
date = "#{args[0]}-#{args[1]}-#{args[2] || '1'}" if !args.empty?
|
205
|
+
LucaDeal::Invoice.new(date).print(nil, params)
|
206
|
+
else
|
207
|
+
date = "#{Date.today.year}-#{Date.today.month}-#{Date.today.day}"
|
208
|
+
LucaDeal::Invoice.new(date).print(args[0], params)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
204
212
|
def self.settle(args = nil, params = nil)
|
205
213
|
str = args[0].nil? ? STDIN.read : File.read(args[0])
|
206
214
|
LucaDeal::Invoice.settle(str, params[:term])
|
@@ -266,7 +274,7 @@ class LucaCmd
|
|
266
274
|
when 'json'
|
267
275
|
puts JSON.dump(dat)
|
268
276
|
when 'nu'
|
269
|
-
LucaSupport::View.nushell(
|
277
|
+
LucaSupport::View.nushell(dat)
|
270
278
|
when 'csv'
|
271
279
|
str = CSV.generate(String.new, col_sep: "\t") do |row|
|
272
280
|
row << dat.first.keys
|
@@ -377,7 +385,6 @@ when /invoices?/, 'i'
|
|
377
385
|
opt.banner = 'Usage: luca-deal invoices list [options] year month [date]'
|
378
386
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
379
387
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
380
|
-
opt.on('--html', 'output html invoices') { |_v| params[:html] = 'monthly' }
|
381
388
|
opt.on('--mail', 'send payment list by email') { |_v| params[:mail] = true }
|
382
389
|
args = opt.parse(ARGV)
|
383
390
|
LucaCmd::Invoice.list(args, params)
|
@@ -389,6 +396,13 @@ when /invoices?/, 'i'
|
|
389
396
|
args = opt.parse(ARGV)
|
390
397
|
LucaCmd::Invoice.mail(args, params)
|
391
398
|
end
|
399
|
+
when 'print'
|
400
|
+
OptionParser.new do |opt|
|
401
|
+
opt.banner = 'Usage: luca-deal invoices print [options] <invoice_id | year month>'
|
402
|
+
opt.on('--pdf', 'output PDF invoices. wkhtmlpdf is required') { |_v| params[:output] = :pdf }
|
403
|
+
args = opt.parse(ARGV)
|
404
|
+
LucaCmd::Invoice.print(args, params)
|
405
|
+
end
|
392
406
|
when 'settle'
|
393
407
|
params[:term] = 1
|
394
408
|
OptionParser.new do |opt|
|
@@ -405,6 +419,7 @@ when /invoices?/, 'i'
|
|
405
419
|
puts ' delete'
|
406
420
|
puts ' list'
|
407
421
|
puts ' mail: send mail with invoice'
|
422
|
+
puts ' print: render invoices into HTML/PDF'
|
408
423
|
puts ' settle'
|
409
424
|
exit 1
|
410
425
|
end
|
data/lib/luca_deal/invoice.rb
CHANGED
@@ -40,13 +40,26 @@ module LucaDeal
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
# Render HTML to
|
43
|
+
# Render HTML/PDF to files
|
44
|
+
# TODO: change output dir
|
44
45
|
#
|
45
|
-
def
|
46
|
-
|
46
|
+
def print(id = nil, params = {})
|
47
|
+
filetype = params[:output] || :html
|
48
|
+
if id
|
49
|
+
dat = self.class.find(id)
|
47
50
|
@company = set_company
|
48
51
|
invoice_vars(dat)
|
49
|
-
|
52
|
+
File.open(attachment_name(dat, filetype), 'w') do |f|
|
53
|
+
f.puts render_invoice(filetype)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
self.class.asof(@date.year, @date.month) do |dat, _|
|
57
|
+
@company = set_company
|
58
|
+
invoice_vars(dat)
|
59
|
+
File.open(attachment_name(dat, filetype), 'w') do |f|
|
60
|
+
f.puts render_invoice(filetype)
|
61
|
+
end
|
62
|
+
end
|
50
63
|
end
|
51
64
|
end
|
52
65
|
|
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
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-11 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:
|
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:
|
26
|
+
version: 0.5.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|