-
Notifications
You must be signed in to change notification settings - Fork 0
/
up.php
171 lines (136 loc) · 5.72 KB
/
up.php
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
<html>
<head>
<title>News</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#load").click(function(event){
$(".item").not(':first').remove();
$.post(
"final_data.php",
{ ndata: "reports"},
function(data) {
test= JSON.parse(data);
//alert(test['cname'].length);
var clone = $("#mainbase .item").clone();
var gain=0;
var sum=0;
var gain1=0;
var sum1=0;
var gain2=0;
var sum2=0;
var gain3=0;
var sum3=0;
var m=0;var n=0; var o=0; var p=0;
for(var j=0;j<test['cname'].length;j++){
if(test['close2close'][test['cname'][j]][1]>0){ m++;}else{ tmv="Fail"}
if(test['close2open'][test['cname'][j]][1]>0){ n++;}else{ tmv="Fail"}
if(test['open2open'][test['cname'][j]][1]>0){ o++;}else{ tmv="Fail"}
if(test['open2close'][test['cname'][j]][1]>0){ p++;}else{ tmv="Fail"}
gain+=parseFloat(test['close2close'][test['cname'][j]][1])
sum+=parseFloat(test['close2close'][test['cname'][j]][2])
var per=(gain/sum)*100;
per=per.toFixed(2);
gain1+=parseFloat(test['close2open'][test['cname'][j]][1])
sum1+=parseFloat(test['close2open'][test['cname'][j]][2])
var per1=(gain1/sum1)*100;
per1=per1.toFixed(2);
gain2+=parseFloat(test['open2open'][test['cname'][j]][1])
sum2+=parseFloat(test['open2open'][test['cname'][j]][2])
var per2=(gain2/sum2)*100;
per2=per2.toFixed(2);
gain3+=parseFloat(test['open2close'][test['cname'][j]][1])
sum3+=parseFloat(test['open2close'][test['cname'][j]][2])
var per3=(gain3/sum3)*100;
per3=per3.toFixed(2);
}
gain=parseFloat(gain).toFixed(2);
gain1=parseFloat(gain1).toFixed(2);
gain2=parseFloat(gain2).toFixed(2);
gain3=parseFloat(gain3).toFixed(2);
$(".mytable", clone).html('<table><tr><td><table border="1" class="c2cgain"><thead>C2CGain:</thead><th>Cname</th><th>Gain</th><th>Gain%</th><th>close</th></table></td><td><table border="1" class="c2ogain"><thead>C2OGain:</thead><th>Cname</th><th>Gain</th><th>Gain%</th><th>close</th></table></td><td><table border="1" class="o2ogain"><thead>O2OGain:</thead><th>Cname</th><th>Gain</th><th>Gain%</th><th>close</th></table></td><td><table border="1" class="o2cgain"><thead>O2CGain:</thead><th>Cname</th><th>Gain</th><th>Gain%</th><th>close</th></table></td></tr></table>')
$(".content").append(clone)
$(".mytablen").html('<table><tr><td>Cname</td><td>Count</td></tr></table>');
var tmpnew=[];
$.each(test['com'], function(key, value) {
tmpnew.push(key);
});
$(".tgain").html("<br>Gain : "+gain)
$(".tgainper").html("<br>Gain% : "+per)
$(".total").html("<br>Total : "+sum)
function check(val) {
var tmv="";if(val>0){ tmv="Pass";}else{ tmv="Fail"}
return tmv; }
for(var j=0;j<test['cname'].length;j++){
$('.c2cgain').append('<tr><td>'+test['cname'][j]+'</td><td data-tag="'+check(test['close2close'][test['cname'][j]][1])+'">'+test['close2close'][test['cname'][j]][1]+'</td><td data-tag="'+check(test['close2close'][test['cname'][j]][0])+'">'+test['close2close'][test['cname'][j]][0]+'</td><td>'+test['close2close'][test['cname'][j]][2]+'</td></tr>')
$('.c2ogain').append('<tr><td>'+test['cname1'][j]+'</td><td data-tag="'+check(test['close2open'][test['cname1'][j]][1])+'">'+test['close2open'][test['cname1'][j]][1]+'</td><td data-tag="'+check(test['close2open'][test['cname1'][j]][0])+'">'+test['close2open'][test['cname1'][j]][0]+'</td><td>'+test['close2open'][test['cname1'][j]][2]+'</td></tr>')
$('.o2ogain').append('<tr><td>'+test['cname2'][j]+'</td><td data-tag="'+check(test['open2open'][test['cname2'][j]][1])+'">'+test['open2open'][test['cname2'][j]][1]+'</td><td data-tag="'+check(test['open2open'][test['cname2'][j]][0])+'">'+test['open2open'][test['cname2'][j]][0]+'</td><td>'+test['open2open'][test['cname2'][j]][2]+'</td></tr>')
$('.o2cgain').append('<tr><td>'+test['cname3'][j]+'</td><td data-tag="'+check(test['open2close'][test['cname3'][j]][1])+'">'+test['open2close'][test['cname3'][j]][1]+'</td><td data-tag="'+check(test['open2close'][test['cname3'][j]][0])+'">'+test['open2close'][test['cname3'][j]][0]+'</td><td>'+test['open2close'][test['cname3'][j]][2]+'</td></tr>')
}
for(var b=0;b<tmpnew.length;b++){
$('.mytablen').append('<tr><td>'+tmpnew[b]+'</td><td>'+test['com'][tmpnew[b]]+'</td></tr>');
}
});
});
});
</script>
</head>
<head>
<meta charset="UTF-8">
<title>Reports</title>
</head>
<style>
img {
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
width: 200px; height: 100px;
}
[data-tag=Pass] {
background-color: #CFFD92 ;
}
[data-tag=Fail] {
background-color: #FEC7A7 ;
}
a:link {
text-decoration: none;
}
body {
margin: 30;
}
.center {
margin: auto;
width: 100%;
border: 1px solid #6059B9;
padding: 10px;
}
.phide
{
cursor: pointer;
}
div.absolute {
position: absolute;
left:10px;
}
</style>
<body bgcolor="#F6F5F4" class="center">
<div>
<span class="1button">
<input type="button" value="Load" id="load">
</span>
<span class="Status">
</span>
</div>
<div id="preview"></div>
<div class="content">
<div id="mainbase">
<div class="item">
<div class="mytable">
</div>
</div>
</div>
</div>
<div class="mytablen">
</div>
</body>
</html>