lucadeal 0.2.18 → 0.2.24
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 +30 -0
- data/README.md +23 -1
- data/exe/luca-deal +265 -30
- data/lib/luca_deal.rb +1 -0
- data/lib/luca_deal/contract.rb +11 -1
- data/lib/luca_deal/customer.rb +17 -4
- data/lib/luca_deal/fee.rb +165 -32
- data/lib/luca_deal/invoice.rb +107 -52
- data/lib/luca_deal/no_invoice.rb +20 -0
- data/lib/luca_deal/setup.rb +1 -1
- data/lib/luca_deal/templates/fee-report-mail.txt.erb +6 -0
- data/lib/luca_deal/templates/fee-report.html.erb +54 -0
- data/lib/luca_deal/templates/invoice-mail.txt.erb +6 -0
- data/lib/luca_deal/templates/invoice.html.erb +52 -0
- data/lib/luca_deal/templates/monthly-payment-list.html.erb +54 -0
- data/lib/luca_deal/version.rb +1 -1
- metadata +9 -3
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'luca_deal/invoice'
|
4
|
+
|
5
|
+
module LucaDeal #:nodoc:
|
6
|
+
# Invoice compatible transactions for other payment methods.
|
7
|
+
#
|
8
|
+
class NoInvoice < Invoice
|
9
|
+
@dirname = 'no_invoices'
|
10
|
+
|
11
|
+
def monthly_invoice
|
12
|
+
super('other_payments')
|
13
|
+
end
|
14
|
+
|
15
|
+
# Override not to send mail to customer.
|
16
|
+
#
|
17
|
+
def deliver_mail(attachment_type = nil, mode: nil)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/luca_deal/setup.rb
CHANGED
@@ -12,7 +12,7 @@ module LucaDeal
|
|
12
12
|
FileUtils.cp("#{__dir__}/templates/config.yml", 'config.yml') unless File.exist?('config.yml')
|
13
13
|
Dir.mkdir('data') unless Dir.exist?('data')
|
14
14
|
Dir.chdir('data') do
|
15
|
-
%w[contracts customers invoices].each do |subdir|
|
15
|
+
%w[contracts customers invoices no_invoices].each do |subdir|
|
16
16
|
Dir.mkdir(subdir) unless Dir.exist?(subdir)
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="utf-8">
|
4
|
+
<style>
|
5
|
+
body { size: A4 }
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div style="text-align: right">Issue date: <%= @issue_date %></div>
|
10
|
+
<h1 style="display: block; margin: auto; text-align: center">Fee Report</h1>
|
11
|
+
<section><%= @customer["name"] %></section>
|
12
|
+
<section>Total amount: <%= delimit_num(@amount) %></section>
|
13
|
+
|
14
|
+
<table style="width: 100%">
|
15
|
+
<thead>
|
16
|
+
<th>#</th>
|
17
|
+
<th>Customer Name</th>
|
18
|
+
<th>Item Name</th>
|
19
|
+
<th>qty</th>
|
20
|
+
<th>Sales</th>
|
21
|
+
<th>Fee</th>
|
22
|
+
</thead>
|
23
|
+
<tbody>
|
24
|
+
<% @items.each.with_index(1) do |item, i| %>
|
25
|
+
<tr class="item">
|
26
|
+
<td class="unit"><%= i %></td>
|
27
|
+
<td><%= item["customer_name"] %></td>
|
28
|
+
<td><%= item["name"] %></td>
|
29
|
+
<td class="unit"><%= item["qty"] %></td>
|
30
|
+
<td class="price"><%= delimit_num( item["price"] * item["qty"] ) %></td>
|
31
|
+
<td class="price"><%= delimit_num( item["fee"] ) %></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
<tr>
|
35
|
+
<td class="price" colspan="3">Subtotal</td>
|
36
|
+
<td class="price"><%= delimit_num( @sales_fee['fee'] ) %></td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<td class="price" colspan="3">Tax</td>
|
40
|
+
<td class="price"><%= delimit_num( @sales_fee['tax'] ) %></td>
|
41
|
+
</tr>
|
42
|
+
<tr>
|
43
|
+
<td class="price" colspan="3">Total</td>
|
44
|
+
<td class="price"><%= delimit_num( @sales_fee['fee'] + @sales_fee['tax'] ) %></td>
|
45
|
+
</tr>
|
46
|
+
</table>
|
47
|
+
|
48
|
+
<section>
|
49
|
+
<div><%= @company["name"] %></div>
|
50
|
+
<div><%= @company["address"] %></div>
|
51
|
+
<div><%= @company["address2"] %></div>
|
52
|
+
</section>
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="utf-8">
|
4
|
+
<style>
|
5
|
+
body { size: A4 }
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div style="text-align: right">Issue date: <%= @issue_date %></div>
|
10
|
+
<h1 style="display: block; margin: auto; text-align: center">Invoice</h1>
|
11
|
+
<section><%= @customer["name"] %></section>
|
12
|
+
<section>Total amount: <%= delimit_num(@amount) %></section>
|
13
|
+
|
14
|
+
<table style="width: 100%">
|
15
|
+
<thead>
|
16
|
+
<th>#</th>
|
17
|
+
<th>Item</th>
|
18
|
+
<th>qty</th>
|
19
|
+
<th>Amount</th>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% @items.each.with_index(1) do |item, i| %>
|
23
|
+
<tr class="item">
|
24
|
+
<td class="unit"><%= i %></td>
|
25
|
+
<td><%= item["name"] %></td>
|
26
|
+
<td class="unit"><%= item["qty"] %></td>
|
27
|
+
<td class="price"><%= delimit_num( item["price"] * item["qty"] ) %></td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
<% @subtotal.each.with_index(1) do |sub, i| %>
|
31
|
+
<tr>
|
32
|
+
<td class="price" colspan="3">Subtotal</td>
|
33
|
+
<td class="price"><%= delimit_num( sub['items'] ) %></td>
|
34
|
+
</tr>
|
35
|
+
<tr>
|
36
|
+
<td class="price" colspan="3">Tax</td>
|
37
|
+
<td class="price"><%= delimit_num( sub['tax'] ) %></td>
|
38
|
+
</tr>
|
39
|
+
<tr>
|
40
|
+
<td class="price" colspan="3">Total</td>
|
41
|
+
<td class="price"><%= delimit_num( sub['items'] + sub['tax'] ) %></td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</table>
|
45
|
+
|
46
|
+
<section>
|
47
|
+
<div><%= @company["name"] %></div>
|
48
|
+
<div><%= @company["address"] %></div>
|
49
|
+
<div><%= @company["address2"] %></div>
|
50
|
+
</section>
|
51
|
+
</body>
|
52
|
+
</html>
|
@@ -0,0 +1,54 @@
|
|
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: 6em }
|
7
|
+
thead th, thead td { text-align: center }
|
8
|
+
thead { border-bottom: solid 1px #aaa }
|
9
|
+
tr#total { border-top: solid 1px #aaa }
|
10
|
+
tr.sub { font-size: .8em; color: #aaa }
|
11
|
+
.past { color: #777 }
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div style="margin: 1em 0"><%= @company %></div>
|
16
|
+
<div style="margin: 1em 0">Issue date: <%= @issue_date %></div>
|
17
|
+
<table>
|
18
|
+
<thead>
|
19
|
+
<tr>
|
20
|
+
<th>#</th>
|
21
|
+
<th>Customer</th>
|
22
|
+
<th>This month</th>
|
23
|
+
<th>Last Month</th>
|
24
|
+
<th>2 Month ago</th>
|
25
|
+
</tr>
|
26
|
+
<tr class="sub">
|
27
|
+
<th></th>
|
28
|
+
<th></th>
|
29
|
+
<th>Amount / Tax</th>
|
30
|
+
<th class="past">Amount / Tax</th>
|
31
|
+
<th class="past">Amount / Tax</th>
|
32
|
+
</tr>
|
33
|
+
</thead>
|
34
|
+
<tbody>
|
35
|
+
<% @invoices.each.with_index(1) do |invoice, i| %>
|
36
|
+
<tr>
|
37
|
+
<th><%= i %></th>
|
38
|
+
<td><%= invoice["customer_name"] %></td>
|
39
|
+
<td><%= delimit_num(invoice["amount1"]) %><br /><%= delimit_num(invoice["tax1"]) %></td>
|
40
|
+
<td class="past"><%= delimit_num(invoice["amount2"]) %><br /><%= delimit_num(invoice["tax2"]) %></td>
|
41
|
+
<td class="past"><%= delimit_num(invoice["amount3"]) %><br /><%= delimit_num(invoice["tax3"]) %></td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
<tr id="total">
|
45
|
+
<td></td>
|
46
|
+
<td>Total (<%= @total_count %> records)</td>
|
47
|
+
<td><%= delimit_num(@total_amount) %><br /><%= delimit_num(@total_tax) %></td>
|
48
|
+
<td></td>
|
49
|
+
<td></td>
|
50
|
+
</tr>
|
51
|
+
</tbody>
|
52
|
+
</table>
|
53
|
+
</body>
|
54
|
+
</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.24
|
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: 2021-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucarecord
|
@@ -85,10 +85,16 @@ files:
|
|
85
85
|
- lib/luca_deal/customer.rb
|
86
86
|
- lib/luca_deal/fee.rb
|
87
87
|
- lib/luca_deal/invoice.rb
|
88
|
+
- lib/luca_deal/no_invoice.rb
|
88
89
|
- lib/luca_deal/product.rb
|
89
90
|
- lib/luca_deal/setup.rb
|
90
91
|
- lib/luca_deal/templates/.keep
|
91
92
|
- lib/luca_deal/templates/config.yml
|
93
|
+
- lib/luca_deal/templates/fee-report-mail.txt.erb
|
94
|
+
- lib/luca_deal/templates/fee-report.html.erb
|
95
|
+
- lib/luca_deal/templates/invoice-mail.txt.erb
|
96
|
+
- lib/luca_deal/templates/invoice.html.erb
|
97
|
+
- lib/luca_deal/templates/monthly-payment-list.html.erb
|
92
98
|
- lib/luca_deal/version.rb
|
93
99
|
homepage: https://github.com/chumaltd/luca/tree/master/lucadeal
|
94
100
|
licenses:
|
@@ -112,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
118
|
- !ruby/object:Gem::Version
|
113
119
|
version: '0'
|
114
120
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.2.3
|
116
122
|
signing_key:
|
117
123
|
specification_version: 4
|
118
124
|
summary: Deal with contracts
|