lucadeal 0.5.5 → 0.5.7

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: b2ff306506550b9b61a9c3fa6ba072cff287c895c32cabf43ff2dec3d1ec0be8
4
- data.tar.gz: f7868b2693bd695ebce548205b64e9724ded153f7219b75009f6b26562a05dc4
3
+ metadata.gz: f38a6fb61fd01e68eefa964fbac76eb83ee2449e5d1d70ebee0164758d23a8b5
4
+ data.tar.gz: 8d72a97c0af4b35fef36771fd35d224f77bbf09b76e90e2d6271988ef6fc2877
5
5
  SHA512:
6
- metadata.gz: 1a5f365a8837b62e5c24ceb8f2df7897960380c2abafa4e8b15892620399a6b75e6535a3bd52349b74799d7c58c1a8617458da386981179a7da6576157212e96
7
- data.tar.gz: 911ac5f5a19191b280e6575b6c0bf328a37c0ee5b6e0a30b3d9fc252b06cc110a6ffaafc231e6ba07680fdc86abd695dbf6e92e4015fe59676b08156a886aa15
6
+ metadata.gz: a3179e7f88e7022b29e2a10be76847ccf8edbd0a91ab56b70e9a71e0e1c42f828baf68dc701e4fbdf816bd4afc0d449494b81125adb1e78cd3c9f1bb2fd7a3cb
7
+ data.tar.gz: 04a7c35dc5bab8b531669b137aadaa746fdbe6853d1c7ca5ca614937eac9aa5e0efa34b349eeb3eacdb358fbb07fbb8f54d8f8c8b11b43d99aa4fc4c6e7072d6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## LucaDeal 0.5.7
2
+
3
+ * `luca-deal fee export` now skips no transaction customer.
4
+
5
+ ## LucaDeal 0.5.6
6
+
7
+ * `luca-deal report balance` now prints customer ID.
8
+
1
9
  ## LucaDeal 0.5.5
2
10
 
3
11
  * `luca-deal report balance --detail` now correctly handles historical Customer attributes.
data/lib/luca_deal/fee.rb CHANGED
@@ -155,11 +155,14 @@ module LucaDeal
155
155
  labels = export_labels
156
156
  [].tap do |res|
157
157
  self.class.asof(@date.year, @date.month) do |dat|
158
- item = {}
159
- item['date'] = dat['issue_date']
160
- item['debit'] = []
161
- item['credit'] = []
162
158
  sub = dat['sales_fee']
159
+ next if readable(sub['fee']) == 0 and readable(sub['deduction']) == 0
160
+
161
+ item = {
162
+ 'date' => dat['issue_date'],
163
+ 'debit' => [],
164
+ 'credit' => []
165
+ }
163
166
  if readable(sub['fee']) != 0
164
167
  item['debit'] << { 'label' => labels[:debit][:fee], 'amount' => readable(sub['fee']) }
165
168
  item['credit'] << { 'label' => labels[:credit][:fee], 'amount' => readable(sub['fee']) }
@@ -226,7 +229,7 @@ module LucaDeal
226
229
  # TODO: load labels from CONST.config before country defaults
227
230
  #
228
231
  def export_labels
229
- case LucaRecord::CONST.confg['country']
232
+ case LucaRecord::CONST.config['country']
230
233
  when 'jp'
231
234
  {
232
235
  debit: { fee: '支払手数料', tax: '支払手数料', deduction: '未払費用' },
@@ -91,10 +91,8 @@ module LucaDeal
91
91
 
92
92
  def self.report(date, scan_years = 10, detail: false, due: false)
93
93
  fy_end = Date.new(date.year, date.month, -1)
94
- if detail
95
- customers = {}.tap do |h|
96
- Customer.all.each { |c| h[c['name']] = LucaSupport::Code.parse_current(c, fy_end) }
97
- end
94
+ customers = {}.tap do |h|
95
+ Customer.all.each { |c| h[c['id']] = LucaSupport::Code.parse_current(c, fy_end) }
98
96
  end
99
97
  [].tap do |res|
100
98
  items = {}
@@ -113,7 +111,7 @@ module LucaDeal
113
111
  next if (settle_date && settle_date <= fy_end)
114
112
  end
115
113
 
116
- customer = invoice.dig('customer', 'name')
114
+ customer = invoice.dig('customer', 'id')
117
115
  items[customer] ||= { 'unsettled' => BigDecimal('0'), 'invoices' => [] }
118
116
  items[customer]['unsettled'] += (invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax')||0)
119
117
  items[customer]['invoices'] << invoice
@@ -121,7 +119,8 @@ module LucaDeal
121
119
  end
122
120
  items.each do |k, item|
123
121
  row = {
124
- 'customer' => k,
122
+ 'id' => k,
123
+ 'customer' => customers.dig(k, 'name'),
125
124
  'unsettled' => LucaSupport::Code.readable(item['unsettled']),
126
125
  }
127
126
  if detail
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaDeal
4
- VERSION = '0.5.5'
4
+ VERSION = '0.5.7'
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.5.5
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-11 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucarecord