-
Notifications
You must be signed in to change notification settings - Fork 0
/
thaitax_m48.html
274 lines (248 loc) · 10.8 KB
/
thaitax_m48.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-114303747-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-114303747-1');
</script>
<meta charset="UTF-8">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script><Paste>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="jquery.number.min.js"></script>
<title>ESTATE CORNER คำนวนภาษีการขายอสังหาริมทรัพย์</title>
</head>
<body>
<div class="container col-sm-8 col-md-8 col-lg-5">
<form id="form" class="form-horizontal">
<div class="panel panel-primary">
<div class="panel-heading">
<img src="corner.png">
<strong>คำนวนภาษีการขายอสังหาริมทรัพย์</strong>
</div>
<div class="panel-body">
<div class="row">
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> ประเภทธุรกรรม </label>
<div class="col-md-9 col-sm-8">
<input type="radio" name="tax_type" value="opt1" checked class="form-check">บุคคลธรรมดา
<input type="radio" name="tax_type" value="opt2" class="form-check">นิติบุคคล
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> การได้มาของทรัพย์ </label>
<div class="col-md-9 col-sm-8">
<input type="radio" name="asset" value="opt1" checked class="form-check">ได้รับมรดก
<input type="radio" name="asset" value="opt2" class="form-check">รับให้
<input type="radio" name="asset" value="opt3" class="form-check">ได้มาโดยทางอื่น
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> วันที่ได้มา </label>
<div class="col-md-3 col-sm-4">
<input type="text" class="form-control" id="value-d-1">(dd-mm-yyyy)
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> วันที่ขาย </label>
<div class="col-md-3 col-sm-4">
<input type="text" class="form-control" id="value-d-2">(dd-mm-yyyy)
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> จำนวนปีที่ถือครอง </label>
<div class="col-md-3 col-sm-4">
<input type="text" class="form-control number-format-0d text-right" id="value-5" value="0" disabled>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> ระยะเวลาที่มีชื่ออยู่ในทะเบียนบ้าน </label>
<div class="col-md-9 col-sm-8">
<input type="radio" name="year_in_property" value="opt1" checked class="form-check">ตั้งแต่ 1 ปี ขึ้นไป
<input type="radio" name="year_in_property" value="opt2" class="form-check">น้อยกว่า 1 ปี
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> ราคาขาย อสังหาริมทรัพย์ </label>
<div class="col-md-3 col-sm-4">
<input type="text" class="form-control number-format-2d text-right" id="value-3" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4"> ราคาประเมินทุนทรัพย์ </label>
<div class="col-md-3 col-sm-4">
<input type="text" class="form-control number-format-2d text-right" id="value-4" value="0">
</div>
</div>
</div> <!-- .row -->
</div> <!-- penel-body -->
<div class="panel-footer">
<div class="row">
<div class="col-xs-4 text-center">
<button type="button" id="cal_button" class="btn btn-primary">คำนวน</button>
</div>
<div class="col-xs-4 text-center">
<button type="reset" class="btn btn-danger">เริ่มใหม่</button>
</div>
</div>
</div>
</div> <!-- panel -->
<div class="panel panel-success">
<div class="panel-heading">
<div class="form-group">
<label class="control-label col-md-3 col-sm-4 col-xs-4"> </label>
<div class="col-md-3 col-sm-4 col-xs-6">
<div class="text-right"> ประมาณการค่าใช้จ่าย </div>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="form-group">
<label class="control-label col-md-3 col-sm-4 col-xs-4"> ค่าธรรมเนียมการโอน </label>
<div class="col-md-2 col-sm-4 col-xs-6">
<div id="output1" class="text-right"> </div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4 col-xs-4"> ค่าอากรแสตมป์ </label>
<div class="col-md-2 col-sm-4 col-xs-6">
<div id="output2" class="text-right"> </div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4 col-xs-4"> ภาษีธุรกิจเฉพาะ </label>
<div class="col-md-2 col-sm-4 col-xs-6">
<div id="output3" class="text-right"> </div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-4 col-xs-4"> ภาษีเงินได้หัก ณ ที่จ่าย</label>
<div class="col-md-2 col-sm-4 col-xs-6">
<div id="output4" class="text-right"> </div>
</div>
</div>
</div><!-- .row -->
</div>
</div> <!-- panel -->
</form>
</div>
</body>
<script>
$(document).ready(function() {
$("#value-d-1").datepicker({ dateFormat: 'dd-mm-yy'});
$("#value-d-2").datepicker({ dateFormat: 'dd-mm-yy'});
$("input[type='text']").on("focus", function () {
$(this).select();
});
$(".number-format-2d").number(true, 2);
$(".number-format-0d").number(true, 0);
$("#cal_button").click(function() {
var fromDate = $("#value-d-1").datepicker('getDate');
var toDate = $("#value-d-2").datepicker('getDate');
var tax_type =
$("input[name=tax_type]:checked", "#form").val() == "opt1" ? 1
: 2;
var possession_year_exact = calculateAge(
fromDate.getMonth(), fromDate.getDate(), fromDate.getFullYear()
, toDate.getMonth(), toDate.getDate(), toDate.getFullYear());
var asset_type =
$("input[name=asset]:checked", "#form").val() == "opt1" ? 1
: $("input[name=asset]:checked", "#form").val() == "opt2" ? 2
: 3;
var stay_more_than_1_year =
$("input[name=year_in_property]:checked", "#form").val()
.localeCompare("opt1") == 0 ? true: false;
var assessment_value = parseFloat($("#value-4").val()) || 0;
var value_3 = parseFloat($("#value-3").val()) || 0;
var value_4 = parseFloat($("#value-4").val()) || 0;
var property_value = value_3 > value_4
? value_3
: value_4;
var fee = assessment_value * 0.02;
$("#output1").text(Number(fee.toFixed(0)).toLocaleString());
if (tax_type == 1)
{
if (asset_type == 1
|| possession_year_exact >= 5
|| stay_more_than_1_year) {
var fee = property_value * 0.005;
$("#output2").text(Number(fee.toFixed(0)).toLocaleString());
$("#output3").text("-");
} else {
var fee = property_value * 0.033;
$("#output2").text("-");
$("#output3").text(Number(fee.toFixed(0)).toLocaleString());
}
}
else
{
var fee = property_value * 0.033;
$("#output2").text("-");
$("#output3").text(Number(fee.toFixed(0)).toLocaleString());
}
var possession_year = calculateCalendarAge(
fromDate.getFullYear()
, toDate.getFullYear());
$("#value-5").val(possession_year);
var deduct_m165 = (asset_type == 1 || asset_type == 2)
? assessment_value * 0.5
: assessment_value * get_deduct_percentile_by_year(possession_year);
var taxable_value = assessment_value - deduct_m165;
var annual_taxable_value = taxable_value / possession_year;
var annual_personal_income_tax = get_personal_income_tax(annual_taxable_value);
var tax = tax_type == 1
? annual_personal_income_tax * possession_year
: property_value * 0.01;
$("#output4").text(Number(tax.toFixed(0)).toLocaleString());
});
function get_deduct_percentile_by_year(year) {
if (year >= 8) return 0.5;
if (year >= 7) return 0.55;
if (year >= 6) return 0.6;
if (year >= 5) return 0.65;
if (year >= 4) return 0.71;
if (year >= 3) return 0.77;
if (year >= 2) return 0.84;
return 0.92;
}
function get_personal_income_tax(income) {
if (income > 4000000) return 972500 + ((income - 4000000) * 0.35);
if (income > 2000000) return 372500 + ((income - 2000000) * 0.3);
if (income > 1000000) return 122500 + ((income - 1000000) * 0.25);
if (income > 750000) return 72500 + ((income - 750000) * 0.2);
if (income > 500000) return 35000 + ((income - 500000) * 0.15);
if (income > 300000) return 15000 + ((income - 300000) * 0.10);
if (income > 0) return 0 + ((income - 0) * 0.05);
return 0;
}
function calculateCalendarAge(fromYear, endYear)
{
return Math.abs(endYear - fromYear + 1);
}
function calculateAge(fromMonth, fromDay, fromYear, endMonth, endDay, endYear)
{
age = endYear - fromYear;
if (endMonth < fromMonth)
{
age--;
}
if (fromMonth == endMonth && endDay < fromDay)
{
age--;
}
return Math.abs(age);
}
});
</script>
</html>