lucasalary 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/exe/luca-salary +59 -43
- data/lib/luca_salary/monthly.rb +3 -2
- data/lib/luca_salary/payment.rb +9 -5
- data/lib/luca_salary/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: e1eaada7633a6968784a6421f92f6393aebb762d67725f7df7237a429e4dd0f5
|
4
|
+
data.tar.gz: 7168896dd1c49cd1a4f44e35ab5dc232426c304964fb878bff67d899db9f8753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b959970ee8cec2debca73f672c2f16d6365d3bd29b5c53fc4814369ecf08e9312f137c824371c799e3a2bf4cda2f27f3b200a3d7a46e5c66a599a78702fb3175
|
7
|
+
data.tar.gz: fa89846e020e818a8e9367312292a9256757ebed278bc1d7afbbe785a525d28929a7f04d4801490164e749dcbdee65da051108546cbae7a364fc32bd8cfc392c
|
data/CHANGELOG.md
CHANGED
data/exe/luca-salary
CHANGED
@@ -5,60 +5,76 @@ require 'optparse'
|
|
5
5
|
require 'luca_salary'
|
6
6
|
require 'luca_salary/monthly'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
LucaSalary::Monthly.new.export_json
|
8
|
+
module LucaCmd
|
9
|
+
class Profile
|
10
|
+
def self.create(args = nil, _params = nil)
|
11
|
+
LucaSalary::Profile.gen_profile!(args.first)
|
12
|
+
end
|
14
13
|
end
|
15
|
-
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
15
|
+
class Payment
|
16
|
+
def self.create(args = nil, _params = nil)
|
17
|
+
if args
|
18
|
+
args << 28 if args.length == 2 # specify safe last day
|
19
|
+
LucaSalary::Base.new(args.join('-')).calc
|
20
|
+
else
|
21
|
+
LucaSalary::Base.new.calc
|
22
|
+
end
|
23
|
+
end
|
25
24
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
25
|
+
def self.export(args = nil, _params = nil)
|
26
|
+
if args
|
27
|
+
args << 28 if args.length == 2 # specify safe last day
|
28
|
+
LucaSalary::Payment.new(args.join('-')).export_json
|
29
|
+
else
|
30
|
+
LucaSalary::Payment.new.export_json
|
31
|
+
end
|
32
|
+
end
|
34
33
|
|
35
|
-
def
|
36
|
-
|
34
|
+
def self.list(args = nil, params = nil)
|
35
|
+
if args
|
36
|
+
args << 28 if args.length == 2 # specify safe last day
|
37
|
+
LucaSalary::Monthly.new(args.join('-')).report(params.dig('mode'))
|
38
|
+
else
|
39
|
+
LucaSalary::Monthly.new.report(params.dig('mode'))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
LucaRecord::Base.valid_project?
|
40
46
|
cmd = ARGV.shift
|
47
|
+
params = {}
|
41
48
|
|
42
49
|
case cmd
|
43
|
-
when
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
args = opt.parse(ARGV)
|
53
|
-
report(args, params)
|
50
|
+
when /profiles?/
|
51
|
+
subcmd = ARGV.shift
|
52
|
+
case subcmd
|
53
|
+
when 'create'
|
54
|
+
OptionParser.new do |opt|
|
55
|
+
opt.banner = 'Usage: luca-salary profiles create Name'
|
56
|
+
args = opt.parse(ARGV)
|
57
|
+
LucaCmd::Profile.create(args)
|
58
|
+
end
|
54
59
|
end
|
55
|
-
when '
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
when 'export'
|
61
|
+
LucaCmd::Payment.export(ARGV)
|
62
|
+
when /payments?/
|
63
|
+
subcmd = ARGV.shift
|
64
|
+
case subcmd
|
65
|
+
when 'create'
|
66
|
+
OptionParser.new do |opt|
|
67
|
+
opt.banner = 'Usage: luca-salary payments create year month [date]'
|
68
|
+
args = opt.parse(ARGV)
|
69
|
+
LucaCmd::Payment.create(args)
|
70
|
+
end
|
71
|
+
when 'list'
|
72
|
+
OptionParser.new do |opt|
|
73
|
+
opt.banner = 'Usage: luca-salary payments list [--mail] year month [date]'
|
74
|
+
opt.on('--mail', 'send to managers') { |_v| params['mode'] = 'mail' }
|
75
|
+
args = opt.parse(ARGV)
|
76
|
+
LucaCmd::Payment.list(args, params)
|
77
|
+
end
|
62
78
|
end
|
63
79
|
else
|
64
80
|
puts 'Invalid subcommand'
|
data/lib/luca_salary/monthly.rb
CHANGED
@@ -20,15 +20,16 @@ module LucaSalary
|
|
20
20
|
# output payslips via mail or console
|
21
21
|
#
|
22
22
|
def report(mode = nil)
|
23
|
+
data = LucaSalary::Payment.new(@date.to_s).payslip
|
23
24
|
if mode == 'mail'
|
24
25
|
mail = Mail.new do
|
25
26
|
subject '[luca salary] Monthly Payment'
|
26
27
|
end
|
27
28
|
mail.to = @config.dig('mail', 'report_mail')
|
28
|
-
mail.text_part = YAML.dump(
|
29
|
+
mail.text_part = YAML.dump(LucaSupport::Code.readable(data))
|
29
30
|
LucaSupport::Mail.new(mail, @pjdir).deliver
|
30
31
|
else
|
31
|
-
puts YAML.dump(
|
32
|
+
puts YAML.dump(LucaSupport::Code.readable(data))
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
data/lib/luca_salary/payment.rb
CHANGED
@@ -58,11 +58,15 @@ module LucaSalary
|
|
58
58
|
acct_label = @dict[k][:acct_label]
|
59
59
|
h[pos][acct_label] = h[pos].key?(acct_label) ? h[pos][acct_label] + v : v
|
60
60
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
[].tap do |res|
|
62
|
+
item = {}
|
63
|
+
item['date'] = "#{@date.year}-#{@date.month}-#{@date.day}"
|
64
|
+
item['debit'] = h[:debit].map { |k, v| { 'label' => k, 'value' => v } }
|
65
|
+
item['credit'] = h[:credit].map { |k, v| { 'label' => k, 'value' => v } }
|
66
|
+
item['x-editor'] = 'LucaSalary'
|
67
|
+
res << item
|
68
|
+
puts JSON.dump(LucaSupport::Code.readable(res))
|
69
|
+
end
|
66
70
|
end
|
67
71
|
|
68
72
|
private
|
data/lib/luca_salary/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucasalary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|