<!--#include virtual="/manager/common/file/stats_top.asp"-->

<%

Dim qryValue	' 선언해줘야 함!! SetWhere 함수 내에서 사용되는 변수..
Dim curCount(24)
Dim arrData(24, 2)

YY = inputvalue(request("YY"))
MM = inputvalue(request("MM"))
DD = inputvalue(request("DD"))
TT = inputvalue(request("TT"))

If YY="" and MM="" and DD="" and TT="" then
	YY = Year(now)
	MM = Month(now)
	DD = Day(now)
End if


int_YY = "" : If IsNumeric(YY) Then  int_yy = Int(YY)
int_MM = "" : If IsNumeric(MM) Then  int_MM = Int(MM)
int_DD = "" : If IsNumeric(DD) Then  int_DD = Int(DD)

If Len(MM)=1 Then MM = "0"&MM
If Len(DD)=1 Then DD = "0"&DD


' where 조건
Call SetWhere()
' $qryValue = "";


' 카운터 수의 합을 구한다
qry = "select count(vNum) from visit_counter " & qryValue
Set Rs = Dbcon.Execute (qry)
totalCount = rs(0)
rs.close : Set rs = Nothing


' 배열 초기화
For i=1 To 24
	curCount(i) = 0
Next


' 일별 카운터를 구한다
qry = "select vHH, count(vNum) as vC from visit_counter "&qryValue&" group by vHH order by vHH"
Set Rs = Dbcon.Execute (qry)

sumCount = 0
Do While Not rs.eof
	vHH = Int(rs("vHH"))
	vC = Int(rs("vC"))

	curCount(vHH) = vC
	sumCount = sumCount + vC

	rs.movenext
Loop
rs.close : Set rs = Nothing

maxCount = 0
minCount = 100000


For i=1 To 24

	If sumCount > 0 then
		curSize	= int((curCount(i)/sumCount) * 540)
		curPer	= formatnumber((curCount(i)/sumCount) * 100, 2)
	else
		curSize = 0
		curPer	 = 0
	End if

	if maxCount < curCount(i) then
		maxCount = curCount(i)
	End if

	if minCount > curCount(i) then
		minCount = curCount(i)
	End if

	arrData(i,0) = curCount(i)

	arrData(i,1) = curSize
	arrData(i,2) = curPer

	if arrData(i,0)= 0 then
		arrData(i,0) = ""
	End if

	if arrData(i,2) = 0 then
		arrData(i,2) = ""
	End if

Next

%>


		<!-- 내용영역 -->
		<div id="contents">

			<div id="contents_head"> 
				<div id="contents_title">
					<img src="/manager/img/tit_ic08.gif" width="22" height="21" class="<%=skin%> center" alt="" /> <h1><span>시간별 통계</span></h1>
				</div>
				<div id="location">
					<a href="/manager/" tabindex="<%=getTabIndex()%>">Home</a> &gt; <a href="/manager/content/05stats/h.asp" tabindex="<%=getTabIndex()%>">통계자료</a> &gt; <a href="/manager/content/05stats/h.asp" tabindex="<%=getTabIndex()%>">방문자 통계</a> &gt; <a href="h.asp" class="now" tabindex="<%=getTabIndex()%>">시간별</a>
				</div>
			</div>

			<!-- 내용들어가는곳 -->
			<div id="contents_area">

				

					<h2 class="space"></h2>


					<div class="write_info">

						<div class="write_form pt7">
							<form id="frm" action="h.asp"  method="post">

							<ul>
							<li class="search"><label for="YY">시간별검색</label> :</li>
							<li>
								<select id="YY" name="YY" title="해당 년도 선택" class="stats" tabindex="<%=getTabIndex()%>">
								<option value="">전체</option>
									<% For z=2009 To Year(now)%>
									<option value="<%=z%>" <%If z=int_YY Then response.write "selected='selected'" End If %>><%=z%>년</option>
									<% next%>
								</select>
							</li>
							<li>
								<select id="MM" name="MM" title="해당 월 선택" class="stats" tabindex="<%=getTabIndex()%>">
								<option value="">전체</option>
									<% For z=1 To 12 %>
									<option value="<%=z%>" <%If z= int_MM Then response.write "selected='selected'" End If %>><%=z%>월</option>
									<% next%>
								</select>
							</li>
							<li>
								<select id="DD" name="DD" title="해당 일 선택" class="stats" tabindex="<%=getTabIndex()%>">
								<option value="">전체</option>
									<% For z=1 To 31 %>
									<option value="<%=z%>" <%If z = int_DD Then response.write "selected='selected'" End If %>><%=z%>일</option>
									<% next%>
								</select>
							</li>
							<li><div id="<%=skin%>_bt"><span class="button"><input type="submit" value="보기" tabindex="<%=getTabIndex()%>" /></span></div></li>
							<li class="pl10"><div id="w01_bt"><span class="button"><input type="button" value="전체보기" onclick="page_go1('h.asp?TT=Y');" tabindex="<%=getTabIndex()%>" /></span> <span class="button"><input type="button" value="<%=year(now)%>년" class="stats" onclick="page_go1('h.asp?YY=<%=year(now)%>');" tabindex="<%=getTabIndex()%>" /></span> <span class="button"><input type="button" value="이번달"  onclick="page_go1('h.asp?YY=<%=year(now)%>&amp;MM=<%=Month(now)%>');" tabindex="<%=getTabIndex()%>" /></span> <span class="button"><input type="button" value="오늘" onclick="page_go1('h.asp?YY=<%=year(now)%>&amp;MM=<%=Month(now)%>&amp;DD=<%=Day(now)%>');" tabindex="<%=getTabIndex()%>" /></span> </div></li>
							</ul>

							</form>
						</div>

					</div>


					<div class="chart1">
					<!--#include virtual="/common/lib/FusionCharts.asp" -->
					<%
						strXML = "&lt;graph caption='' xAxisName='' yAxisName='' showValues='0' decimalPrecision='0' formatNumberScale='0' showAlternateHGridColor='1' AlternateHGridColor='' divLineColor='F0F0F0' divLineAlpha='' alternateHGridAlpha='5' bgcolor='ffffff' canvasBgColor='ffffff' canvasBaseColor='EAEAEA' canvasBaseDepth='1' canvasBgDepth='0' baseFont='verdana' baseFontSize='9' baseFontColor='999999' hoverCapBgColor='ffffff' hoverCapBorderColor='A6A6A6' hoverCapSepChar=' ' chartLeftMargin='0' chartRightMargin='0' chartTopMargin='5' chartBottomMargin='0'&gt;"

						strXML = strXML & "&lt;set name='0시' value='"&arrData(24,0)&"' color='B1D361' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(1,0)&"' color='FECC6D' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(2,0)&"' color='E94646' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(3,0)&"' color='7BDCC5'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(4,0)&"' color='74C2E4'/&gt;"
						strXML = strXML & "&lt;set name='5시' value='"&arrData(5,0)&"' color='828FE3'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(6,0)&"' color='D07CDB'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(7,0)&"' color='D8D8D8'/&gt;"

						strXML = strXML & "&lt;set name='' value='"&arrData(8,0)&"' color='B1D361' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(9,0)&"' color='FECC6D' /&gt;"
						strXML = strXML & "&lt;set name='10시' value='"&arrData(10,0)&"' color='E94646' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(11,0)&"' color='7BDCC5'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(12,0)&"' color='74C2E4'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(13,0)&"' color='828FE3'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(14,0)&"' color='D07CDB'/&gt;"
						strXML = strXML & "&lt;set name='15시' value='"&arrData(15,0)&"' color='D8D8D8'/&gt;"

						strXML = strXML & "&lt;set name='' value='"&arrData(16,0)&"' color='B1D361' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(17,0)&"' color='FECC6D' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(18,0)&"' color='E94646' /&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(19,0)&"' color='7BDCC5'/&gt;"
						strXML = strXML & "&lt;set name='20시' value='"&arrData(20,0)&"' color='74C2E4'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(21,0)&"' color='828FE3'/&gt;"
						strXML = strXML & "&lt;set name='' value='"&arrData(22,0)&"' color='D07CDB'/&gt;"
						strXML = strXML & "&lt;set name='23시' value='"&arrData(23,0)&"' color='D8D8D8'/&gt;"

						strXML = strXML & "&lt;/graph&gt;"

						response.write renderChartHTML("/manager/img/swf/main_colum3d.swf", "", strXML, "myNext", 730, 200, "", "", "")
					%>
					</div>

					<div class="list_count pb2">
						전체 <strong><%=totalCount%></strong>명 방문 (최대 <%=maxCount%>명, 최소 <%=minCount%>명)
					</div>

					<fieldset>
						<legend>시간별 방문자 통계</legend>
						<table cellspacing="0" class="bbs_<%=skin%>" summary="시간별 방문자를 확인합니다.">
						<caption>시간별 방문자 통계 서식</caption>
						<colgroup>
						<col width="60" />
						<col />
						<col width="90" />
						<col width="3" />
						<col width="60" />
						<col />
						<col width="90" />
						<col width="3" />
						<col width="60" />
						<col />
						<col width="90" />
						</colgroup>

						<thead>
						<tr>
							<th scope="col">시간</th>
							<th scope="col">방문수</th>
							<th scope="col">비율(%)</th>
							<th scope="col"></th>
							<th scope="col">시간</th>
							<th scope="col">방문수</th>
							<th scope="col">비율(%)</th>
							<th scope="col"></th>
							<th scope="col">시간</th>
							<th scope="col">방문수</th>
							<th scope="col">비율(%)</th>
						</tr>
						</thead>

						<tbody>
						<tr>
						<%
							
						td_end = 1

						For z=1 To 24

						%>

							<td scope="row" class="center"><%=z%>시</td>
							<td scope="row" class="center"><%SetDetail(z)%></td>
							<td scope="row" class="center"><%=arrData(z,2)%></td>

							
						<%

							td_end = td_end + 1

							If td_end = 4 then ' 3칸째일때
								
								td_end = 1
								
								If z <>24 Then response.write "</tr><tr>"

							else
								response.write "<td scope='row' class='center'></td>"
							End if

						next
						%>

						</tr>
						</tbody>
						</table>
					</fieldset>

				

			</div>
			<!-- 내용들어가는곳 -->

		</div>
		<!-- ' 내용영역 -->


<!--#include virtual = "/manager/common/file/sub_bottom.asp"-->
