-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstock-pro-fireant.html
337 lines (303 loc) · 15.1 KB
/
stock-pro-fireant.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="/website/images/stock/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="/website/images/stock/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/website/images/stock/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/website/images/stock/favicon-16x16.png">
<title>Stock Pro - TienPD3</title>
<!-- spreadjs -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
<link rel="stylesheet" type="text/css" href="website/css/common/function.spreadjs.css"></link>
<link rel="stylesheet" type="text/css" href="website/css/spreadjs/gc.spread.sheets.excel2013white.16.0.2.css"></link>
<script type="text/javascript" src="website/scripts/spreadjs/gc.spread.sheets.all.16.0.2.min.latest.js"></script>
<script type="text/javascript" src="website/scripts/spreadjs/interop/gc.spread.excelio.16.0.2.min.latest.js"></script>
<script type="text/javascript" src="website/license/spreadjs/license-grapecity.js"></script>
<!-- / spreadjs -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<!-- aui.atlassian.com -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/aui/9.5.1/aui/aui-prototyping.min.css"></link>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sinon.js/15.0.1/sinon.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/aui/9.5.1/aui/aui-prototyping.min.js"></script>
<!-- / aui.atlassian.com -->
<!-- common -->
<script type="text/javascript" src="website/common/const.js"></script>
<script type="text/javascript" src="website/common/function.common.js"></script>
<script type="text/javascript" src="website/common/function.spreadjs.js"></script>
<script type="text/javascript" src="website/common/function.update.js"></script>
<script type="text/javascript" src="website/common/function.simplize.js"></script>
<script type="text/javascript" src="website/common/function.fireant.trend.js"> </script>
<script type="text/javascript" src="website/common/function.fireant.valuation.js"> </script>
<!-- / common -->
<!-- site -->
<script type="text/javascript" src="https://e.cafef.vn/kby.ashx"> </script>
<!-- / site -->
<script>
$(document).ready(function() {
localStorage.removeStorageExpires();
buildUrlSimplize();
var firstValue = buildDropdownStockList();
initBuildDropdownStockCode(firstValue.id, firstValue.rules)
$(document).on('change', '#drpdStockList', function() {
const id = $(this).find('option:selected').attr('id');
const rules = $(this).find('option:selected').attr('rules');
initBuildDropdownStockCode(id, rules)
var drpdSelected = JSON.parse(localStorage.getStorage('drpdSelected')) || {};
drpdSelected.stockListSelected = id;
localStorage.setStorage('drpdSelected', JSON.stringify(drpdSelected), null)
});
$(document).on('change', '#drpdStockCode', function() {
onChangeStockCode();
});
$(document).on('click', '#btnNext', function() {
saveWhiteList();
});
$('#idWarning').text(stockListSimplizeNewData);
});
function saveWhiteList() {
var tmpSymbol = $('#drpdStockCode').find('option:selected').attr('id');
var tmpTickerStockExchange = $('#drpdStockCode').find('option:selected').text();
saveGoodStock(tmpSymbol, tmpTickerStockExchange);
doNext();
}
function doNext() {
var last = $("#drpdStockCode > option").last();
var current = $("#drpdStockCode > option:selected");
if (last[0] != current[0]) {
if (!$('#chkAutoStockNoValue').is(":checked")) {
$('#btnNext').prop('disabled', false);
}
current.prop("selected", false).next().prop("selected", true);
} else {
$('#btnNext').prop('disabled', true);
}
onChangeStockCode();
}
function isCheckElementStockCodeLast() {
var last = $("#drpdStockCode > option").last();
var current = $("#drpdStockCode > option:selected");
return last[0] == current[0];
}
function initBuildDropdownStockCode(pId, pRules) {
buildDropdownStockCode(pId, pRules);
AJS.$("#drpdStockCode").auiSelect2();
onChangeStockCode();
}
function onChangeStockCode() {
AJS.$("#drpdStockCode").auiSelect2();
var pSymbol = $('#drpdStockCode').find('option:selected').attr('id');
var filter = $(oc).filter(function (i, elm) {
return elm.c === pSymbol
})[0];
if (filter !== undefined) {
loadData(filter.c, filter.m, filter.san);
}
var drpdSelected = JSON.parse(localStorage.getStorage('drpdSelected')) || {};
drpdSelected.stockCodeSelected = pSymbol;
localStorage.setStorage('drpdSelected', JSON.stringify(drpdSelected), null)
}
$(document).on('change', '#chkAutoStockNoValue', function() {
if(this.checked) {
saveWhiteList();
}
});
</script>
<script>
var spread, excelIO, loadingStatus;
function loadData(pSymbol, pName, pExchange) {
setParameter(pSymbol, pName, pExchange);
loadFile(pSymbol, pName);
}
function loadFile(pSymbol, pName) {
resetData();
excelIo = new GC.Spread.Excel.IO();
var excelUrl = document.getElementById('importUrl').value + '?cache=' + uuidv4();
if (loadingStatus) {
loadingStatus.updateText("Đang xử lý");
$('.gc-play-loading').removeClass('hide');
}
var oReq = new XMLHttpRequest();
oReq.open('get', excelUrl, true);
oReq.responseType = 'blob';
oReq.onload = function () {
var blob = oReq.response;
excelIo.open(blob, function (json) {
var jsonExcel = JSON.stringify(json);
jsonExcel = getDataJson(jsonExcel, pSymbol, pName);
if (!spread) {
spread = new GC.Spread.Sheets.Workbook(document.getElementById("spreadSheet"));
var statusBar = initStatusBar(spread)
loadingStatus = new LoadingStatus('LoadingStatus', { tipText: 'Đang xử lý' });
statusBar.add(loadingStatus);
}
spread.fromJSON(jsonExcel, {
incrementalLoading: {
loading: function (progress, args) {
loadingStatus.updateProgress(progress, args);
},
loaded: function () {
loadingStatus.updateText("Lấy dữ liệu " + pSymbol + " thành công");
$('.gc-play-loading').addClass('hide');
autoNextStock();
}
}
});
activeSheet(spread, 'Định giá');
spread.options.scrollbarAppearance = GC.Spread.Sheets.ScrollbarAppearance.mobile;
spread.options.showVerticalScrollbar = false;
spread.options.scrollbarShowMax = false;
// Cho phép edit tên sheet hay không?
spread.options.tabEditable = true; // false: disable, true: enable
// Cho phép ẩn sheet hay không?
// spread.options.tabStripVisible = true; // true: show, false: hide
// Cho phép thêm sheet hày không?
spread.options.newTabVisible = true; // false: hide, true: show
// Cho phép ẩn mũi tên ở sheet hay không?
spread.options.tabNavigationVisible = false; // false: hide, true: show
// Setting vị trí sheet
spread.options.tabStripPosition = GC.Spread.Sheets.TabStripPosition.top;
}, function (message) {
console.log(message);
});
};
oReq.send(null);
}
var sleepNext = null;
function autoNextStock() {
clearInterval(sleepNext);
var sheet = spread.getActiveSheet();
// Lấy CELL TIÊU CHUẨN ĐỊNH GIÁ DOANH NGHIỆP TỐT
var cellValue = sheet.getText(13, 3);
var tempIsGoodStock = false;
if (cellValue == 'YES') {
tempIsGoodStock = true;
}
if ($('#chkAutoStockNoValue').is(":checked")) {
if ($('#chkSaveWhitelist').is(":checked")) {
var idx = 5
sleepNext = setInterval(function () {
if (idx <= 0) {
clearInterval(sleepNext);
if (isCheckElementStockCodeLast()) {
$('#btnNext').prop('disabled', true);
$('#btnNext').text('Kiểm tra mã tiếp theo');
} else {
saveWhiteList();
}
}
$('#btnNext').prop('disabled', true);
if (tempIsGoodStock) {
$('#btnNext').text('Cổ phiếu cần đánh giá, tiếp tục sau ' + idx + ' giây');
} else {
$('#btnNext').text('Cổ phiếu không tốt, tiếp tục sau ' + idx + ' giây');
}
idx--;
}, 1000);
} else {
if (!tempIsGoodStock) {
var idx = 5
sleepNext = setInterval(function () {
if (idx <= 0) {
clearInterval(sleepNext);
if (isCheckElementStockCodeLast()) {
$('#btnNext').prop('disabled', true);
$('#btnNext').text('Kiểm tra mã tiếp theo');
} else {
saveWhiteList();
}
}
$('#btnNext').prop('disabled', true);
$('#btnNext').text('Cổ phiếu không tốt, tiếp tục sau ' + idx + ' giây');
idx--;
}, 1000);
} else {
if (isCheckElementStockCodeLast()) {
$('#btnNext').prop('disabled', true);
} else {
$('#btnNext').prop('disabled', false);
}
$('#btnNext').text('Kiểm tra mã tiếp theo');
}
}
} else {
if (isCheckElementStockCodeLast()) {
$('#btnNext').prop('disabled', true);
} else {
$('#btnNext').prop('disabled', false);
}
$('#btnNext').text('Kiểm tra mã tiếp theo');
}
}
function saveGoodStock(pSymbol, tickerStockExchange) {
var sheet = spread.getActiveSheet();
// Lấy CELL TIÊU CHUẨN ĐỊNH GIÁ DOANH NGHIỆP TỐT
var cellValue = sheet.getText(13, 3);
var tmpStockValueList = localStorage.getStorage('stockValue');
if (tmpStockValueList === null) {
tmpStockValueList = [];
} else {
tmpStockValueList = JSON.parse(tmpStockValueList);
}
if (cellValue === 'NO') {
var tmpStockValue = tmpStockValueList.filter(row => row.ticker === pSymbol);
if(tmpStockValue !== null) {
tmpStockValueList = tmpStockValueList.filter(function(row) {
return row.ticker !== pSymbol;
});
}
localStorage.setStorage('stockValue', JSON.stringify(tmpStockValueList), UNLIMITED);
return false;
} else {
var tmpStockValue = tmpStockValueList.filter(row => row.ticker === pSymbol);
if(tmpStockValue.length === 0) {
tmpStockValue = {
ticker: pSymbol,
stockExchange: tickerStockExchange
}
tmpStockValueList.push(tmpStockValue)
}
localStorage.setStorage('stockValue', JSON.stringify(tmpStockValueList), UNLIMITED);
return true;
}
}
</script>
</head>
<body>
<form class="aui">
<i class="red" id="idWarning" for="warning"></i>
<div></div>
<label for="drpdStockList">Bộ lọc chứng khoán</label>
<div id="idStockList">
<select class="select" id="drpdStockList" name="drpdStockList"></select>
<input type="checkbox" name="chkAutoStockNoValue" id="chkAutoStockNoValue">
<label for="chkAutoStockNoValue">Tự động bỏ qua cổ phiếu không giá trị</label>
</div>
<label for="drpdStockCode">Mã chứng khoán</label>
<div id="idStockCode">
<select class="select" id="drpdStockCode" name="drpdStockCode" placeholder="Vui lòng chọn mã chứng khoán"></select>
<input type="checkbox" name="chkSaveWhitelist" id="chkSaveWhitelist">
<label for="chkSaveWhitelist">Tự động lưu Whitelist</label>
</div>
</form>
<!-- Spinner -->
<div class="gc-playground_view">
<div id="spreadSheet" style="width: 100%; height: 550px;"></div>
<div class="gc-play-loading">
<div class="indicator-wrapper gcim_hidden">
<div class="loading-ring" style="height: 30px; width: 30px;">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
</div>
<div id="statusBar"></div>
<!-- / Spinner -->
<input type="hidden" id="importUrl" value="website/file/template.xlsx" />
<button id="btnNext" class="aui-button aui-button-primary">Kiểm tra mã tiếp theo</button>
</body>
</html>