lucadeal 0.2.22 → 0.2.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/exe/luca-deal +3 -0
- data/lib/luca_deal/invoice.rb +23 -0
- data/lib/luca_deal/templates/monthly-payment-list.html.erb +40 -0
- data/lib/luca_deal/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3d23a1f082ee44833db42f3cf4dbdecc0d078ea3ca6499d5cf77e6d235580a
|
4
|
+
data.tar.gz: c2ea468ea064bb865d0b481d9717a03f11afe212f0bfd3b58ac43722116a95e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 545d6acb5b7837497c30d17a42c6a32611186f2e12f9821d116c9aa3ed9735dc1c8bc2c072d1439c9e21e1fd38d7398de770ffd9fd835352f4565f96a18a19ca
|
7
|
+
data.tar.gz: c8cf01067781332a241138ab9b253d282902a3838a19d2f9623d9eb29c6c4a3432e7d0e6818bc67a3e3b3e682e5ba3c4c5c128a90f93b3f91dcadca0285ea2f4
|
data/CHANGELOG.md
CHANGED
data/exe/luca-deal
CHANGED
@@ -174,6 +174,8 @@ class LucaCmd
|
|
174
174
|
end
|
175
175
|
if params[:html]
|
176
176
|
LucaDeal::Invoice.new(date).preview_stdout
|
177
|
+
elsif params[:mail]
|
178
|
+
LucaDeal::Invoice.new(date).stats_email
|
177
179
|
else
|
178
180
|
render(LucaDeal::Invoice.new(date).stats(count || 1), params)
|
179
181
|
end
|
@@ -344,6 +346,7 @@ when /invoices?/, 'i'
|
|
344
346
|
opt.on('--nu', 'show table in nushell') { |_v| params[:output] = 'nu' }
|
345
347
|
opt.on('-o', '--output VAL', 'output serialized data') { |v| params[:output] = v }
|
346
348
|
opt.on('--html', 'output html invoices') { |_v| params[:html] = 'monthly' }
|
349
|
+
opt.on('--mail', 'send payment list by email') { |_v| params[:mail] = true }
|
347
350
|
args = opt.parse(ARGV)
|
348
351
|
LucaCmd::Invoice.list(args, params)
|
349
352
|
end
|
data/lib/luca_deal/invoice.rb
CHANGED
@@ -116,6 +116,29 @@ module LucaDeal
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
# send payment list to preview address or from address.
|
120
|
+
#
|
121
|
+
def stats_email
|
122
|
+
{}.tap do |res|
|
123
|
+
stats(2).each.with_index(1) do |stat, i|
|
124
|
+
@issue_date = stat['issue_date'] if i == 1
|
125
|
+
stat['records'].each do |record|
|
126
|
+
res[record['customer']] ||= {}
|
127
|
+
res[record['customer']]['customer_name'] ||= record['customer']
|
128
|
+
res[record['customer']]["amount#{i}"] ||= record['subtotal']
|
129
|
+
res[record['customer']]["tax#{i}"] ||= record['tax']
|
130
|
+
end
|
131
|
+
end
|
132
|
+
@invoices = res.values
|
133
|
+
end
|
134
|
+
|
135
|
+
mail = Mail.new
|
136
|
+
mail.to = CONFIG.dig('mail', 'preview') || CONFIG.dig('mail', 'from')
|
137
|
+
mail.subject = 'Check monthly payment list'
|
138
|
+
mail.html_part = Mail::Part.new(body: render_erb(search_template('monthly-payment-list.html.erb')), content_type: 'text/html; charset=UTF-8')
|
139
|
+
LucaSupport::Mail.new(mail, PJDIR).deliver
|
140
|
+
end
|
141
|
+
|
119
142
|
def export_json
|
120
143
|
[].tap do |res|
|
121
144
|
self.class.asof(@date.year, @date.month) do |dat|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
5
|
+
<style>
|
6
|
+
td { text-align: right; line-height: 2em; min-width: 7em }
|
7
|
+
thead th, thead td { text-align: center }
|
8
|
+
tr.sub { font-size: .8em; color: #aaa }
|
9
|
+
</style>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div style="margin: 1em 0">Issue date: <%= @issue_date %></div>
|
13
|
+
<table>
|
14
|
+
<thead>
|
15
|
+
<tr>
|
16
|
+
<th>#</th>
|
17
|
+
<th>Customer</th>
|
18
|
+
<th>Amount</th><th>Tax</th>
|
19
|
+
<th>Amount</th><th>Tax</th>
|
20
|
+
</tr>
|
21
|
+
<tr class="sub">
|
22
|
+
<th></th>
|
23
|
+
<th></th>
|
24
|
+
<th>This month</th><th>This month</th>
|
25
|
+
<th>Last Month</th><th>Last Month</th>
|
26
|
+
</tr>
|
27
|
+
</thead>
|
28
|
+
<tbody>
|
29
|
+
<% @invoices.each.with_index(1) do |invoice, i| %>
|
30
|
+
<tr>
|
31
|
+
<td><%= i %></td>
|
32
|
+
<td><%= invoice["customer_name"] %></td>
|
33
|
+
<td><%= invoice["amount1"] %></td><td><%= invoice["tax1"] %></td>
|
34
|
+
<td><%= invoice["amount2"] %></td><td><%= invoice["tax2"] %></td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
</tbody>
|
38
|
+
</table>
|
39
|
+
</body>
|
40
|
+
</html>
|
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.2.
|
4
|
+
version: 0.2.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/luca_deal/templates/fee-report.html.erb
|
94
94
|
- lib/luca_deal/templates/invoice-mail.txt.erb
|
95
95
|
- lib/luca_deal/templates/invoice.html.erb
|
96
|
+
- lib/luca_deal/templates/monthly-payment-list.html.erb
|
96
97
|
- lib/luca_deal/version.rb
|
97
98
|
homepage: https://github.com/chumaltd/luca/tree/master/lucadeal
|
98
99
|
licenses:
|