line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::Tax::Withholding::JP; |
2
|
5
|
|
|
5
|
|
270361
|
use 5.008001; |
|
5
|
|
|
|
|
58
|
|
3
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
106
|
|
4
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
296
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.05"; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
32
|
use constant { border => 1000000 }; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
714
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %consumption = ( |
11
|
|
|
|
|
|
|
rate => 0.08, |
12
|
|
|
|
|
|
|
name => 'æ¶è²»ç¨', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my %withholding = ( |
16
|
|
|
|
|
|
|
rate => 0.10, |
17
|
|
|
|
|
|
|
name => 'æºæ³å¾´å', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %special = ( |
21
|
|
|
|
|
|
|
rate => 0.0021, |
22
|
|
|
|
|
|
|
name => '復èç¹å¥æå¾ç¨', |
23
|
|
|
|
|
|
|
from => '2013-01-01', |
24
|
|
|
|
|
|
|
until => '2037-12-31', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
5
|
|
|
5
|
|
2616
|
use Moose; |
|
5
|
|
|
|
|
2374190
|
|
|
5
|
|
|
|
|
35
|
|
28
|
5
|
|
|
5
|
|
41590
|
use Time::Piece; |
|
5
|
|
|
|
|
47796
|
|
|
5
|
|
|
|
|
24
|
|
29
|
|
|
|
|
|
|
my $t = localtime; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has price => ( is => 'rw', isa => 'Int', default => 0 ); |
32
|
|
|
|
|
|
|
has amount => ( is => 'rw', isa => 'Int', default => 1 ); |
33
|
|
|
|
|
|
|
has date => ( is => 'rw', isa => 'Str', default => $t->ymd() ); |
34
|
|
|
|
|
|
|
has no_wh => ( is => 'ro', isa => 'Bool', default => 0 ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
37
|
5
|
|
|
5
|
|
786
|
no Moose; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
37
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub net { |
40
|
5
|
|
|
5
|
1
|
37
|
my $self = shift; |
41
|
5
|
|
|
|
|
130
|
return $self->price(@_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub subtotal { |
45
|
120
|
|
|
120
|
1
|
158
|
my $self = shift; |
46
|
120
|
|
|
|
|
3137
|
return $self->price() * $self->amount(); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub tax { |
50
|
38
|
|
|
38
|
1
|
64
|
my $self = shift; |
51
|
38
|
|
|
|
|
70
|
return int( $self->subtotal() * $consumption{'rate'} ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub full { |
55
|
28
|
|
|
28
|
1
|
48
|
my $self = shift; |
56
|
28
|
|
|
|
|
61
|
return int( $self->subtotal() + $self->tax() ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub withholding { |
60
|
36
|
|
|
36
|
1
|
67
|
my $self = shift; |
61
|
36
|
100
|
|
|
|
921
|
return 0 if $self->no_wh(); |
62
|
24
|
|
|
|
|
58
|
my $rate = $self->rate(); |
63
|
24
|
100
|
|
|
|
208
|
if( $self->subtotal() <= border ) { |
64
|
18
|
|
|
|
|
37
|
return int( $self->subtotal() * $rate ); |
65
|
|
|
|
|
|
|
}else{ |
66
|
6
|
|
|
|
|
14
|
my $base = $self->subtotal() - border; |
67
|
6
|
|
|
|
|
37
|
return int( $base * $rate * 2 + border * $rate ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub rate { |
72
|
24
|
|
|
24
|
0
|
34
|
my $self = shift; |
73
|
24
|
|
|
|
|
44
|
my $rate = $withholding{'rate'}; |
74
|
24
|
|
|
|
|
203
|
my $from = $t->strptime( $special{'from'}, '%Y-%m-%d' ); |
75
|
24
|
|
|
|
|
2742
|
my $until = $t->strptime( $special{'until'}, '%Y-%m-%d' ); |
76
|
24
|
|
|
|
|
2586
|
my $date = $t->strptime( $self->date(), '%Y-%m-%d' ); |
77
|
|
|
|
|
|
|
|
78
|
24
|
100
|
100
|
|
|
2029
|
return $rate if $date < $from or $until < $date; |
79
|
20
|
|
|
|
|
863
|
return $rate + $special{'rate'}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub total { |
83
|
18
|
|
|
18
|
1
|
35
|
my $self = shift; |
84
|
18
|
|
|
|
|
47
|
return $self->full - $self->withholding; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
__END__ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=encoding utf-8 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Business::Tax::Withholding::JP - auto calculation for Japanese tax and withholding |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Business::Tax::Withholding::JP - æ¥æ¬ã®æ¶è²»ç¨ã¨æºæ³å¾´åã®ãããããè¨ç®ãèªååãã¾ãã |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
use Business::Tax::Withholding::JP; |
102
|
|
|
|
|
|
|
my $calc = Business::Tax::Withholding::JP->new( price => 10000 ); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
$calc->net(); # 10000 |
105
|
|
|
|
|
|
|
$calc->amount(); # 1 |
106
|
|
|
|
|
|
|
$calc->subtotal(); # 10000 |
107
|
|
|
|
|
|
|
$calc->tax(); # 800 |
108
|
|
|
|
|
|
|
$calc->full(); # 10800 |
109
|
|
|
|
|
|
|
$calc->withholding(); # 1021 |
110
|
|
|
|
|
|
|
$calc->total(); # 9779 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Or you can set the date in period of special tax being expired |
113
|
|
|
|
|
|
|
$calc = Business::Tax::Withholding::JP->new( date => '2038-01-01' ); |
114
|
|
|
|
|
|
|
$calc->price(10000); |
115
|
|
|
|
|
|
|
$calc->withholding(); # 1000 |
116
|
|
|
|
|
|
|
$calc->total(); # 9800 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# And you may ignore the withholings |
119
|
|
|
|
|
|
|
$calc = Business::Tax::Withholding::JP->new( no_wh => 1 ); |
120
|
|
|
|
|
|
|
$calc->price(10000); # 10000 |
121
|
|
|
|
|
|
|
$calc->amount(2); # 2 |
122
|
|
|
|
|
|
|
$calc->subtotal(); # 20000 |
123
|
|
|
|
|
|
|
$calc->tax(); # 1600 |
124
|
|
|
|
|
|
|
$calc->withholding(); # 0 |
125
|
|
|
|
|
|
|
$calc->total(); # 21600 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 DESCRIPTION |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Business::Tax::Withholding::JP |
130
|
|
|
|
|
|
|
is useful calculator for long term in Japanese Business. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
You can get correctly taxes and withholdings from price in your context |
133
|
|
|
|
|
|
|
without worrying about the special tax for reconstructing from the Earthquake. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
the consumption tax B<rate is 8%> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
You can also ignore the withholings. It means this module can be a tax calculator |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Business::Tax::Withholding::JP ã¯æ¥æ¬ã®ãã¸ãã¹ã§é·æçã«ä½¿ããã¢ã¸ã¥ã¼ã«ã§ãã |
140
|
|
|
|
|
|
|
ç¹å¥å¾©èæå¾ç¨ã®æéãå¿é
ãããã¨ãªããè«æ±ä¾¡æ ¼ããæ£ããç¨éé¡ã¨æºæ³å¾´åé¡ãè¨ç®ã§ãã¾ãã |
141
|
|
|
|
|
|
|
ãªããæºæ³å¾´åãããªãçµçã«ã対å¿ãã¾ããB<æ¶è²»ç¨çã¯8ï¼
> ã§ãã |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 Constructor |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head3 new( price => I<Int>, amount => I<Int>, date => I<Date>, no_wh => I<Bool> ); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
You can omit these paramators. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
ãã©ã¡ã¼ã¿ã¯æå®ããªãã¦æ§ãã¾ããã |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item price |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
the price of your products will be set. defaults 0. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
ç¨æä¾¡æ ¼ãæå®ãã¦ãã ãããæå®ããªããã°0ã§ãã |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item amount |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
the amount of your products will be set. defaults 1. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
æ°éãæå®ãã¦ãã ãããæå®ããªããã°1ã§ãã |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item date |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
You can set payday. the net of withholding depends on this. default is today. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
æ¯ææ¥ãæå®ãã¦ãã ãããæºæ³å¾´åé¡ãå¤åãããã¨ãããã¾ããæå®ããªããã°ä»æ¥ã¨ãã¦è¨ç®ãã¾ãã |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item no_wh |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
If you set this flag, the all you can get is only tax and total. defaults 0 and this is read-only. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
ãã®ãã©ã°ãç«ã¦ãã¨ãã®ã¢ã¸ã¥ã¼ã«ã®é·æãå°ç¡ãã«ã§ãã¾ããåæå¤ã¯ãã¡ãã0ã§ããã¨ããå¤ãããã¨ã¯ã§ãã¾ããã |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 Methods and subroutine |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item price |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You can reset the price. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
price ã«å¤ã代å
¥å¯è½ã§ãã |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item amount |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
You can reset the amount. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
amount ã«å¤ã代å
¥å¯è½ã§ãã |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item date |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
You can reset the payday like 'YYYY-MM-DD' |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
date ã«ãå¤ã代å
¥å¯è½ã§ãããã©ã¼ãããã¯'YYYY-MM-DD'ï¼-åºåãï¼ã§ãã |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item net |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
You can get the net of your pay. it's equal to the price. |
204
|
|
|
|
|
|
|
So it's the alias of price(). |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
net 㯠price ã¨åãåãããã¾ãã |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item subtotal |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
it returns price() * amount() |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
subtotal ã¯å¤ã¨æ°éã®ç©ï¼å°è¨ï¼ãè¿ãã¾ãã |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item tax |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
You can get the net of your tax. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
ç¨é¡ã®ã¿ãåå¾ãããå ´åã¯ãã¡ãã |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item full |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
You can get the net of your pay including tax. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
ç¨è¾¼éé¡ãç¥ãããå ´åã¯ãã¡ãã |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item withholding |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
You can get the net of your withholding from your pay. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
æºæ³å¾´åé¡ãç¥ãããå ´åã¯ãã¡ãã |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item total |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
You can get the total of your pay including tax without withholding |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
æºæ³å¾´åé¡ãå·®ãå¼ããç¨è¾¼æ¯æé¡ãç¥ãããå ´åã¯ãã¡ããã使ããã ããã |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=back |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 LICENSE |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Copyright (C) worthmine. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
245
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head1 AUTHOR |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
worthmine E<lt>worthmine@cpan.orgE<gt> |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |