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

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

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


If YY = "" and MM = "" and DD = "" and TT = "" then

	YY = Year(now)
	MM = Month(now)

End If

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

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






totalCount = 0
sumCount = 0

For i = 1 To 12

	curCount(i) = 0
	MM = Right( "0" & i, 2)

	'//table명
	table = "sdk_mms_report_detail_" & Right(YY,2) & MM

	'//table 존재유무
	sql = "select count(*) as cnt from information_schema.tables where table_name = '" & table & "'"
	Set rs = dbcon.execute( sql )
	rscount = rs("cnt")
	Set rs = nothing

	If rscount > 0 then

		'//월별 카운터를 구한다
		qry = "select count(*) as vC from " & table
		Set rs = dbcon.execute( qry )
		
		arr = i
		VC = rs("vC")
		curCount(arr) = VC
		sumCount = sumCount + VC
	else

		arr = i
		VC = 0
		curCount(arr) = VC
		sumCount = sumCount + VC
	End if
next



' 날짜변 데이터를 배열에 담는다
maxCount = 0
minCount = 100000

For i=1 To UBound(curCount)


	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>MMS발송월별 통계</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/mms_d.asp" tabindex="<%=getTabIndex()%>">mms발송 통계</a> &gt; <a href="/manager/content/05stats/mms_m.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="mms_m.asp"  method="get">

							<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><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="올해" class="stats" onclick="page_go1('mms_m.asp?YY=<%=Year(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='1月' value='"&arrData(1,0)&"' color='B1D361' /&gt;"
						strXML = strXML & "&lt;set name='2月' value='"&arrData(2,0)&"' color='FECC6D' /&gt;"
						strXML = strXML & "&lt;set name='3月' value='"&arrData(3,0)&"' color='E94646' /&gt;"
						strXML = strXML & "&lt;set name='4月' value='"&arrData(4,0)&"' color='7BDCC5'/&gt;"
						strXML = strXML & "&lt;set name='5月' value='"&arrData(5,0)&"' color='74C2E4'/&gt;"
						strXML = strXML & "&lt;set name='6月' value='"&arrData(6,0)&"' color='828FE3'/&gt;"
						strXML = strXML & "&lt;set name='7月' value='"&arrData(7,0)&"' color='D07CDB'/&gt;"
						strXML = strXML & "&lt;set name='8月' value='"&arrData(8,0)&"' color='D8D8D8'/&gt;"

						strXML = strXML & "&lt;set name='9月' value='"&arrData(9,0)&"' color='B1D361' /&gt;"
						strXML = strXML & "&lt;set name='10月' value='"&arrData(10,0)&"' color='FECC6D' /&gt;"
						strXML = strXML & "&lt;set name='11月' value='"&arrData(11,0)&"' color='E94646' /&gt;"
						strXML = strXML & "&lt;set name='12月' value='"&arrData(12,0)&"' color='7BDCC5'/&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 />
						</colgroup>

						<thead>
						<tr>
							<th scope="col">일자</th>
							<th scope="col">발송건수</th>
							<th scope="col">비율(%)</th>
						</tr>
						</thead>

						<tbody>
					<%
					For z=1 To 12
					%>

						<tr>
							<td scope="row" class="center"><%If z <= 12 Then response.write z&"월" End if%></td>
							<td scope="row" class="center"><% SetDetail(z)%></td>
							<td scope="row" class="center"><%=arrData(z,2)%></td>

						</tr>
					<%
					next
					%>

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

			

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

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

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