lucasalary 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/exe/luca-salary +9 -4
- data/lib/luca_salary/base.rb +3 -1
- data/lib/luca_salary/payment.rb +24 -0
- data/lib/luca_salary/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3de293feb769006a2764979fdc52357699cc79c116fcde6b6c871b473e650035
|
4
|
+
data.tar.gz: 63f14cd43cc3a7aec7c31c6a59bafa67c03b998c8a23b882becb5d76e308fbbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ed7707f597948379ec7059926c67bd101f5fb182c33c3cf347574ed9dc44daa9af1519768c89f88723c579b5339d7fb57d78bb05976f8e46ba4eb2d6db0e1f
|
7
|
+
data.tar.gz: 88ac6c04ab1956d26f976e31e5fbb9474d49163fbabbe3bd9259defd472190898280d8f3b76a6ddd32ca8420ba41d289d2c379abd2f7ddc1c5f1072326f9a982
|
data/CHANGELOG.md
CHANGED
data/exe/luca-salary
CHANGED
@@ -40,8 +40,12 @@ module LucaCmd
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.total(args = nil,
|
44
|
-
|
43
|
+
def self.total(args = nil, params = nil)
|
44
|
+
if params['mode'] == 'adjust'
|
45
|
+
LucaSalary::Payment.year_adjust(args[0].to_i, args[1].to_i)
|
46
|
+
else
|
47
|
+
LucaSalary::Payment.year_total(args.first.to_i)
|
48
|
+
end
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
@@ -86,9 +90,10 @@ when /payments?/
|
|
86
90
|
end
|
87
91
|
when 'total'
|
88
92
|
OptionParser.new do |opt|
|
89
|
-
opt.banner = 'Usage: luca-salary payments total year'
|
93
|
+
opt.banner = 'Usage: luca-salary payments total [--adjust] year [month]'
|
94
|
+
opt.on('--adjust', 'Apply year total adjustment to payslip of year/month') { |_v| params['mode'] = 'adjust' }
|
90
95
|
args = opt.parse(ARGV)
|
91
|
-
LucaCmd::Payment.total(args)
|
96
|
+
LucaCmd::Payment.total(args, params)
|
92
97
|
end
|
93
98
|
else
|
94
99
|
puts 'Proper subcommand needed.'
|
data/lib/luca_salary/base.rb
CHANGED
@@ -45,7 +45,9 @@ module LucaSalary
|
|
45
45
|
|
46
46
|
def self.sum_code(obj, code, exclude = nil)
|
47
47
|
target = obj.select { |k, _v| /^#{code}[0-9A-Fa-f]{,3}$/.match(k) }
|
48
|
-
target = target
|
48
|
+
target = target
|
49
|
+
.reject { |_k, v| v.nil? }
|
50
|
+
.reject { |k, _v| exclude&.include?(k) }
|
49
51
|
target.values.inject(:+) || 0
|
50
52
|
end
|
51
53
|
|
data/lib/luca_salary/payment.rb
CHANGED
@@ -78,6 +78,30 @@ module LucaSalary
|
|
78
78
|
return payment
|
79
79
|
end
|
80
80
|
|
81
|
+
# Apply adjustment for yearly refund.
|
82
|
+
# Search Year Total records 6 months before specified payslip month.
|
83
|
+
#
|
84
|
+
def self.year_adjust(year, month)
|
85
|
+
target_month = Date.new(year, month, 1)
|
86
|
+
total_st = target_month.prev_month(6)
|
87
|
+
search(year, month).each do |slip, path|
|
88
|
+
term(total_st.year, total_st.month, year, month, slip['profile_id'], "#{@dirname}/total/") do |total|
|
89
|
+
slip['3A1'] = total['3A1']
|
90
|
+
slip['4A1'] = total['4A1']
|
91
|
+
end
|
92
|
+
# Recalculate sum
|
93
|
+
['3', '4'].each do |key|
|
94
|
+
slip[key] = 0
|
95
|
+
slip[key] = LucaSalary::Base.sum_code(slip, key)
|
96
|
+
slip['5'] = slip['1'] - slip['2'] - slip['3'] + slip['4']
|
97
|
+
end
|
98
|
+
IO.write(
|
99
|
+
abs_path(@dirname) / path[0] / "#{path[1]}-#{path[2]}",
|
100
|
+
YAML.dump(LucaSupport::Code.readable(slip.sort.to_h))
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
81
105
|
# Export json for LucaBook.
|
82
106
|
# Accrual_date can be change with `payment_term` on config.yml. Default value is 0.
|
83
107
|
# `payment_term: 1` means payment on the next month of calculation target.
|
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.25
|
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:
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|
@@ -93,7 +93,7 @@ metadata:
|
|
93
93
|
homepage_uri: https://github.com/chumaltd/luca/tree/master/lucasalary
|
94
94
|
source_code_uri: https://github.com/chumaltd/luca/tree/master/lucasalary
|
95
95
|
changelog_uri: https://github.com/chumaltd/luca/tree/master/lucasalary/CHANGELOG.md
|
96
|
-
post_install_message:
|
96
|
+
post_install_message:
|
97
97
|
rdoc_options: []
|
98
98
|
require_paths:
|
99
99
|
- lib
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubygems_version: 3.3.5
|
112
|
-
signing_key:
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Salary calculation framework
|
115
115
|
test_files: []
|