<!--#include file="../Lib/Config.asp"-->
<!--#include file="../Lib/DBConn.asp"-->
<!--#include file="../Lib/DBLib.asp"-->
<!--#include file="../Lib/func.asp"-->
<%

Function QTABLE(QuotaSp,QuotaArr)

	Dim QForC,QuotaWhere
	Dim Qsp
	Qsp = Split(QuotaArr,",")

	QuotaWhere = ""
	For QForC=1 To UBound(QuotaSp)
		QuotaWhere = QuotaWhere & "and " & QuotaSp(QForC-1) & "='"& Qsp(QForC-1) &"'"
	Next

	Dim QSQL,QRs,Qi

	QSQL = "SELECT Count(IDX) FROM "& TB_NAME &" where status=10 and ResType<>'TEST' " & QuotaWhere 

	Set QRs = Server.CreateObject("ADODB.Recordset")

	DBConnect()
	QRs.Open QSQL,DBConn,3,1,1

	QTABLE = QRs(0)

	DBClose()

End Function 


Dim QuotaSp,QuotaCount
QuotaSp = Split(Quota_Variables,",")

Dim SQL,Rs,i,j
	SQL = "SELECT * FROM "& Quota_TBNAME &" Order by IDX asc "
	Set Rs = Server.CreateObject("ADODB.Recordset")

	DBConnect()
	Rs.Open SQL,DBConn,3,1,1

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/style.css" >
</head>
<body>
<div style="width:100%;text-align:center;">
	<div id="adminLogo" style="font-family: Arial;font-size: 20px;text-align:left;"></div>
	<div id="adminTitle" style="font-family: Arial;color: #FFFFFF;font-size: 14px;text-align:left;"></div>
	<div id="adminTitle" style="font-family: Arial;color: #000000;font-size: 14px;text-align:center;background-color:#FFFFFF;">
	<form name="frmSearch" id="frmSearch" method="post" action="index.asp">
	<br>
	<table style="width:800px;padding:5px 5px 5px 5px;border-collapse:separate;" cellpadding="5" cellspacing="1" bordercolor="#000000" border="1">
		<tr>
			<td style="text-align: left;" colspan="2">			
			QUOTA
			</td>
		</tr>	

		<% 
		Dim QuotaArr
		Dim QForC
		Dim Qi,QiSum
			Qi = 0
			QiSum = 0
			QForC = 0
		
		Do While Not Rs.Eof %>
			<%
				QuotaArr = ""
				For QForC=1 To UBound(QuotaSp)
					QuotaArr = QuotaArr & Rs(QuotaSp(QForC-1)) & ","
				Next

				If QuotaArr<>"" Then
					QuotaArr = Left(QuotaArr,Len(QuotaArr)-1)
				End if
			%>
		<tr>
			<td style="text-align: left;">			
			<%=Rs("QUOTA_TEXT")%>
			</td>
			<td style="text-align: left;">			
			<%=QTABLE(QuotaSp,QuotaArr)%>/<%=Rs("LIMIT")%>
			</td>
		</tr>
			<% Qi = Qi + QTABLE(QuotaSp,QuotaArr)%>
			<% QiSum = QiSum + Rs("LIMIT")%>
		<% Rs.MoveNext %>
		<% Loop%>
		<tr>
			<td style="text-align: left;">			
			합계
			</td>
			<td style="text-align: left;">			
			<%=Qi%>/<%=QiSum%>
			</td>
		</tr>		
	</table>
	</form>
	</div>
	<br>
</div>
</body>
</html>
<%
	Rs.Close

	DBClose()
%>