luca-jp 0.1.3 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/luca-jp +12 -0
- data/lib/luca/jp.rb +2 -0
- data/lib/luca/jp/aoiro.rb +226 -42
- data/lib/luca/jp/chihouzei.rb +72 -13
- data/lib/luca/jp/common.rb +62 -6
- data/lib/luca/jp/it_part.rb +1 -1
- data/lib/luca/jp/sonshitsu.rb +102 -0
- data/lib/luca/jp/syouhizei.rb +3 -2
- data/lib/luca/jp/templates/beppyo1.xml.erb +3 -1
- data/lib/luca/jp/templates/beppyo2.xml.erb +31 -0
- data/lib/luca/jp/templates/beppyo4.xml.erb +38 -12
- data/lib/luca/jp/templates/beppyo51.xml.erb +14 -7
- data/lib/luca/jp/templates/beppyo52.xml.erb +50 -13
- data/lib/luca/jp/templates/beppyo7.xml.erb +31 -0
- data/lib/luca/jp/templates/el-no6-43.xml.erb +1 -1
- data/lib/luca/jp/templates/el-no6-9.xml.erb +51 -0
- data/lib/luca/jp/templates/el-no6.xml.erb +26 -34
- data/lib/luca/jp/templates/eltax-userinf.xml.erb +20 -0
- data/lib/luca/jp/templates/eltax.xml.erb +7 -7
- data/lib/luca/jp/templates/gaikyo.xml.erb +1 -0
- data/lib/luca/jp/templates/syouhizei-shinkoku-kanni.xml.erb +3 -1
- data/lib/luca/jp/templates/tekiyougaku.xml.erb +2 -0
- data/lib/luca/jp/urikake.rb +47 -0
- data/lib/luca/jp/util.rb +23 -1
- data/lib/luca/jp/version.rb +1 -1
- metadata +7 -2
@@ -0,0 +1,20 @@
|
|
1
|
+
<USER_INF id="USER_INF">
|
2
|
+
<USER_ID id="USER_ID"><%= it_part_config('eltax_id') %></USER_ID>
|
3
|
+
<KANA id="KANA"><%= it_part_config('nozeisha_nm_kn') %></KANA>
|
4
|
+
<NAME id="NAME"><%= it_part_config('nozeisha_nm') %></NAME>
|
5
|
+
<HONTEN id="HONTEN">
|
6
|
+
<HONTEN_ADDR id="HONTEN_ADDR"><%= it_part_config('nozeisha_adr') %></HONTEN_ADDR>
|
7
|
+
<HONTEN_ZIP id="HONTEN_ZIP"><%= it_part_config('nozeisha_zip').gsub('-', '') %></HONTEN_ZIP>
|
8
|
+
<HONTEN_TEL id="HONTEN_TEL"><%= it_part_config('nozeisha_tel').gsub('-', '') %></HONTEN_TEL>
|
9
|
+
</HONTEN>
|
10
|
+
<DAIHYO id="DAIHYO">
|
11
|
+
<DAIHYOKAKU_CD id="DAIHYOKAKU_CD">01</DAIHYOKAKU_CD>
|
12
|
+
<DAIHYO_KANA id="DAIHYO_KANA"><%= it_part_config('daihyo_nm_kn') %></DAIHYO_KANA>
|
13
|
+
<DAIHYO_NAME id="DAIHYO_NAME"><%= it_part_config('daihyo_nm') %></DAIHYO_NAME>
|
14
|
+
<DAIHYO_ADDR id="DAIHYO_ADDR"><%= it_part_config('daihyo_adr') %></DAIHYO_ADDR>
|
15
|
+
<DAIHYO_ZIP id="DAIHYO_ZIP"><%= it_part_config('daihyo_zip').gsub('-', '') %></DAIHYO_ZIP>
|
16
|
+
<DAIHYO_TEL id="DAIHYO_TEL"></DAIHYO_TEL>
|
17
|
+
</DAIHYO>
|
18
|
+
<T_RCPT_NUM id="T_RCPT_NUM"><%= eltax_config('receipt_num') %></T_RCPT_NUM>
|
19
|
+
<HOJIN_NUMBER id="HOJIN_NUMBER"><%= it_part_config('nozeisha_bango') %></HOJIN_NUMBER>
|
20
|
+
</USER_INF>
|
@@ -21,14 +21,14 @@
|
|
21
21
|
<gen:yy><%= wareki(@start_date) %></gen:yy>
|
22
22
|
<gen:mm><%= @start_date.month %></gen:mm>
|
23
23
|
<gen:dd><%= @start_date.day %></gen:dd>
|
24
|
-
<gen:yyyymmdd
|
24
|
+
<gen:yyyymmdd><%= @start_date.strftime('%Y%m%d') %></gen:yyyymmdd>
|
25
25
|
</SDATE>
|
26
26
|
<EDATE id="EDATE">
|
27
27
|
<gen:era><%= gengou(@end_date) %></gen:era>
|
28
28
|
<gen:yy><%= wareki(@end_date) %></gen:yy>
|
29
29
|
<gen:mm><%= @end_date.month %></gen:mm>
|
30
30
|
<gen:dd><%= @end_date.day %></gen:dd>
|
31
|
-
<gen:yyyymmdd
|
31
|
+
<gen:yyyymmdd><%= @end_date.strftime('%Y%m%d') %></gen:yyyymmdd >
|
32
32
|
</EDATE>
|
33
33
|
<RPT_DATE id="RPT_DATE">
|
34
34
|
<gen:era><%= gengou(@issue_date) %></gen:era>
|
@@ -74,15 +74,15 @@
|
|
74
74
|
<KAZEI_TEL id="KAZEI_TEL" />
|
75
75
|
<HOGEN_NUM id="HOGEN_NUM" />
|
76
76
|
<KANRI_NUM id="KANRI_NUM" />
|
77
|
-
<KAZEI_NUM id="KAZEI_NUM"
|
77
|
+
<KAZEI_NUM id="KAZEI_NUM"><%= eltax_config('x_houjin_bango') %></KAZEI_NUM>
|
78
78
|
<HOJO_NUM id="HOJO_NUM" />
|
79
79
|
<STF_NUM id="STF_NUM" />
|
80
80
|
</ORG_INF>
|
81
|
-
<STIME id="STIME"
|
81
|
+
<STIME id="STIME"><%= @app_version %></STIME>
|
82
82
|
<HOJIN_DOFUKEN id="HOJIN_DOFUKEN">
|
83
83
|
<FORM_INF id="FORM_INF">
|
84
|
-
<JIGYO_NAME id="JIGYO_NAME"
|
85
|
-
<SHIHON id="SHIHON"
|
84
|
+
<JIGYO_NAME id="JIGYO_NAME"><%= it_part_config('jigyo_naiyo') %></JIGYO_NAME>
|
85
|
+
<SHIHON id="SHIHON"><%= it_part_config('shihon_kin') %></SHIHON>
|
86
86
|
<HOJIN_NUM id="HOJIN_NUM"></HOJIN_NUM>
|
87
87
|
<JIMUSHO_NUM id="JIMUSHO_NUM"><%= @jimusho_code %></JIMUSHO_NUM>
|
88
88
|
<SEIRI_NUM id="SEIRI_NUM" />
|
@@ -104,7 +104,7 @@
|
|
104
104
|
<SYSTEM_INF id="SYSTEM_INF">
|
105
105
|
<SYSTEM_DATA id="SYSTEM_DATA"></SYSTEM_DATA>
|
106
106
|
<NOUZEI_UPDATE id="NOUZEI_UPDATE">
|
107
|
-
<SDATE
|
107
|
+
<SDATE><%= DateTime.now.strftime('%Y%m%d%H%M%S') %></SDATE>
|
108
108
|
<UDATE></UDATE>
|
109
109
|
<SIGN_DATE></SIGN_DATE>
|
110
110
|
<SEND_DATE></SEND_DATE>
|
@@ -34,6 +34,7 @@
|
|
34
34
|
<%= render_attr('ABI00110', @中間納付額) %>
|
35
35
|
<%= render_attr('ABI00120', 納付税額(@税額, @中間納付額)) %>
|
36
36
|
<%= render_attr('ABI00130', 中間還付税額(@税額, @中間納付額)) %>
|
37
|
+
<%= render_attr('ABI00170', LucaSupport::Code.readable(@sales)) %>
|
37
38
|
</ABI00000>
|
38
39
|
<ABJ00000>
|
39
40
|
<ABJ00010>
|
@@ -45,7 +46,7 @@
|
|
45
46
|
<%= render_attr('ABJ00070', @地方税中間納付額) %>
|
46
47
|
<%= render_attr('ABJ00080', 納付税額(@譲渡割額, @地方税中間納付額)) %>
|
47
48
|
<%= render_attr('ABJ00090', 中間還付税額(@譲渡割額, @地方税中間納付額)) %>
|
48
|
-
<%= render_attr('ABJ00130',
|
49
|
+
<%= render_attr('ABJ00130', (@税額 - @中間納付額) + (@譲渡割額 - @地方税中間納付額)) %>
|
49
50
|
</ABJ00000>
|
50
51
|
<ABK00000>
|
51
52
|
<ABK00010><kubun_CD>2</kubun_CD></ABK00010>
|
@@ -56,6 +57,7 @@
|
|
56
57
|
<ABL00000>
|
57
58
|
<ABL00010><kubun_CD>2</kubun_CD></ABL00010>
|
58
59
|
<ABL00020><%= 事業区分 %></ABL00020>
|
60
|
+
<ABL00210><kubun_CD>2</kubun_CD></ABL00210>
|
59
61
|
</ABL00000>
|
60
62
|
</SHA020-1>
|
61
63
|
<SHA020-2 page="1">
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<MAA00020 IDREF="JIGYO_NENDO_FROM"/>
|
5
5
|
<MAA00030 IDREF="JIGYO_NENDO_TO"/>
|
6
6
|
</MAA00010>
|
7
|
+
<MAA00040><kubun_CD>1</kubun_CD></MAA00040>
|
7
8
|
<MAA00050 IDREF="TEISYUTSU_DAY"/>
|
8
9
|
<MAA00060 IDREF="ZEIMUSHO"/>
|
9
10
|
<MAA00070 IDREF="NOZEISHA_ADR"/>
|
@@ -14,6 +15,7 @@
|
|
14
15
|
</MAA00090>
|
15
16
|
<MAA00115 IDREF="NOZEISHA_BANGO"/>
|
16
17
|
<MAA00120 IDREF="SHIHON_KIN"/>
|
18
|
+
<%= render_attr('MAA00130', @別表四調整所得 - @繰越損失管理.deduction) %>
|
17
19
|
<MAA00140>
|
18
20
|
<%= render_attr('MAA00150', 1) %>
|
19
21
|
<%= render_attr('MAA00160', 1) %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'cgi/escape'
|
5
|
+
require 'luca_deal'
|
6
|
+
require 'luca_support'
|
7
|
+
require 'luca_support/config'
|
8
|
+
require 'luca/jp'
|
9
|
+
|
10
|
+
module Luca
|
11
|
+
module Jp
|
12
|
+
class Urikake < LucaDeal::Invoice
|
13
|
+
@dirname = 'invoices'
|
14
|
+
|
15
|
+
def report(total = nil)
|
16
|
+
listed_amount = 0
|
17
|
+
str = CSV.generate(String.new, headers: false, col_sep: ',', encoding: 'UTF-8') do |f|
|
18
|
+
list.map do |invoice|
|
19
|
+
amount = readable(invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax'))
|
20
|
+
listed_amount += amount
|
21
|
+
f << ['3', '0', '売掛金', invoice.dig('customer', 'name'), invoice.dig('customer', 'address'), amount, nil ]
|
22
|
+
end
|
23
|
+
if total
|
24
|
+
f << ['3', '0', '売掛金', 'その他', nil, total - listed_amount, nil ]
|
25
|
+
f << ['3', '1', nil, nil, nil, total, nil ]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
File.open('HOI030_3.0.csv', 'w') { |f| f.write(str) }
|
29
|
+
end
|
30
|
+
|
31
|
+
def list
|
32
|
+
invoices = self.class.asof(@date.year, @date.month)
|
33
|
+
.map { |dat, _path| dat }
|
34
|
+
.sort_by { |invoice| invoice.dig('subtotal', 0, 'items') }
|
35
|
+
.reverse
|
36
|
+
|
37
|
+
reports = invoices.filter { |invoice| 500_000 <= invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
|
38
|
+
return reports if reports.length >= 5
|
39
|
+
|
40
|
+
additional = invoices
|
41
|
+
.filter { |invoice| 500_000 > invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
|
42
|
+
.take(5 - reports.length)
|
43
|
+
reports.concat(additional)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/luca/jp/util.rb
CHANGED
@@ -22,7 +22,15 @@ module Luca
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def prepaid_tax(code)
|
25
|
-
LucaSupport::Code.readable(@bs_data.dig(code) || 0)
|
25
|
+
#LucaSupport::Code.readable(@bs_data.dig(code) || 0)
|
26
|
+
search_end = @end_date.prev_month # exclude year end adjustment
|
27
|
+
amount, _ = self.class.net(@start_date.year, @start_date.month, search_end.year, search_end.month, code: code)
|
28
|
+
LucaSupport::Code.readable(amount[code] || 0)
|
29
|
+
end
|
30
|
+
|
31
|
+
def refund_tax(code)
|
32
|
+
credit = credit_amount(code, @start_date.year, @start_date.month, @end_date.year, @end_date.month)
|
33
|
+
LucaSupport::Code.readable(credit)
|
26
34
|
end
|
27
35
|
|
28
36
|
def 納付税額(税額, 中間納付額)
|
@@ -46,6 +54,8 @@ module Luca
|
|
46
54
|
end
|
47
55
|
|
48
56
|
def render_attr(code, val)
|
57
|
+
return '' if val.nil? || val.to_s.length == 0
|
58
|
+
|
49
59
|
"<#{code}>#{val}</#{code}>"
|
50
60
|
end
|
51
61
|
|
@@ -56,6 +66,18 @@ module Luca
|
|
56
66
|
def config
|
57
67
|
EX_CONF.nil? ? LucaSupport::CONFIG : LucaSupport::CONFIG.merge(EX_CONF)
|
58
68
|
end
|
69
|
+
|
70
|
+
def it_part_config(key)
|
71
|
+
config.dig('jp', 'it_part', key)
|
72
|
+
end
|
73
|
+
|
74
|
+
def beppyo2_config(key)
|
75
|
+
config.dig('jp', 'beppyo2', key)
|
76
|
+
end
|
77
|
+
|
78
|
+
def eltax_config(key)
|
79
|
+
config.dig('jp', 'eltax', key)
|
80
|
+
end
|
59
81
|
end
|
60
82
|
end
|
61
83
|
end
|
data/lib/luca/jp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luca-jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
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-03-
|
11
|
+
date: 2021-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucabook
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/luca/jp/common.rb
|
86
86
|
- lib/luca/jp/it_part.rb
|
87
87
|
- lib/luca/jp/kessan.rb
|
88
|
+
- lib/luca/jp/sonshitsu.rb
|
88
89
|
- lib/luca/jp/syouhizei.rb
|
89
90
|
- lib/luca/jp/templates/aoiro.xtx.erb
|
90
91
|
- lib/luca/jp/templates/beppyo1-next.xml.erb
|
@@ -94,9 +95,12 @@ files:
|
|
94
95
|
- lib/luca/jp/templates/beppyo4.xml.erb
|
95
96
|
- lib/luca/jp/templates/beppyo51.xml.erb
|
96
97
|
- lib/luca/jp/templates/beppyo52.xml.erb
|
98
|
+
- lib/luca/jp/templates/beppyo7.xml.erb
|
97
99
|
- lib/luca/jp/templates/consumption.xtx.erb
|
98
100
|
- lib/luca/jp/templates/el-no6-43.xml.erb
|
101
|
+
- lib/luca/jp/templates/el-no6-9.xml.erb
|
99
102
|
- lib/luca/jp/templates/el-no6.xml.erb
|
103
|
+
- lib/luca/jp/templates/eltax-userinf.xml.erb
|
100
104
|
- lib/luca/jp/templates/eltax.xml.erb
|
101
105
|
- lib/luca/jp/templates/fuhyo43.xml.erb
|
102
106
|
- lib/luca/jp/templates/fuhyo53.xml.erb
|
@@ -106,6 +110,7 @@ files:
|
|
106
110
|
- lib/luca/jp/templates/tekiyougaku.xml.erb
|
107
111
|
- lib/luca/jp/templates/yakuin-meisai.xml.erb
|
108
112
|
- lib/luca/jp/templates/yokin-meisai.xml.erb
|
113
|
+
- lib/luca/jp/urikake.rb
|
109
114
|
- lib/luca/jp/util.rb
|
110
115
|
- lib/luca/jp/version.rb
|
111
116
|
homepage: https://github.com/chumaltd/luca-jp/tree/main
|