www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\adminadmin\users\admin_account.asp

    <!--#include file="../../conn.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:801w软件代理系统
' 当前版本:801wAsp 801w cn 801w com
' 文件名称:admin_main.asp
' 更新日期:2010-2-16
' 官方网站:801w代理系统(www.801w.cn www.801w.com) QQ:274667447
'=====================================================================
' Copyright 2003-2010 801w.cn - All Rights Reserved.
' 801wasp is a trademark of 801w.cn
'=====================================================================
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="100" align="left">交易明细查询</td>
		<td class="tableline" width="*" align="right"><a href="admin_index.asp">管理首页</a>
			 - <a href="admin_account.asp">交易明细</a>
			 - <a href="?Accountype=0">收入明细</a>
			 - <a href="?Accountype=1">支出明细</a>
			 - <a href="?Reclaim=1">回收站</a>
			 - <a href="?action=add">添加交易明细表</a>
			 - <a href="admin_userorder.asp">充值定单</a>
			 - <a href="admin_confirm.asp">交费确认</a>
			 - <a href="admin_paymode.asp">付款方式</a>
		</td>
	</tr>
</table>
<%
Dim maxperpage,totalrec,Pcount,pagelinks,showmode,pagenow,count
Dim Action,listArry,SQLQuery

If Not ChkAdmin("Account") Then
	Call Transfer_error()
End If
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "add"
	Call AddAccount()
Case "savenew"
	Call SavenewAccount()
Case "save"
	Call SaveAccount()
Case "view"
	Call ViewAccount()
Case "del"
	Call DelAccount()
Case "reclaim"
	Call ReclaimAccount()
Case "renew"
	Call RenewAccount()
Case Else
	Call showmain()
End Select
If FoundErr=True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
	Dim i,iCount,lCount
	iCount=2:lCount=2
	maxperpage = 30 '###每页显示数
	count=NewAsp.ChkNumeric(Request("count"))
	pagenow=NewAsp.ChkNumeric(Request("page"))
	If pagenow=0 Then pagenow=1
	Call showQueryform()
%>
<form name="selform" method="post" action="admin_account.asp">
<input type="hidden" name="action" value="reclaim">
<table id="tablehovered" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th nowrap="nowrap">选择</th>
	<th nowrap="nowrap">付 款 人</th>
	<th nowrap="nowrap">收款单位</th>
	<th nowrap="nowrap">项目名称</th>
	<th nowrap="nowrap">数 量</th>
	<th nowrap="nowrap">单 位</th>
	<th nowrap="nowrap">单 价</th>
	<th nowrap="nowrap">总 金 额</th>
	<th nowrap="nowrap">交易日期</th>
	<th nowrap="nowrap">款项类型</th>
</tr>
<tr>
	<td class="tablerow1" colspan="10" align="left" id="showNextPage">&nbsp;</td>
</tr>
<%
	Call showAccountlist()
	If IsArray(listArry) Then
		For i=0 To Ubound(listArry,2)
			If Not Response.IsClientConnected Then Response.End
			If (i mod 2) = 0 Then iCount=2:lCount=1 Else iCount=1:lCount=2
%>
<tr align="center">
	<td class="tablerow<%=iCount%> hovered"><input type="checkbox" name="AccountID" value="<%=listArry(0,i)%>"></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=NewAsp.HTMLEncodes(listArry(1,i))%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=NewAsp.HTMLEncodes(listArry(2,i))%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=NewAsp.HTMLEncodes(listArry(3,i))%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=NewAsp.HTMLEncodes(listArry(4,i))%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=NewAsp.HTMLEncodes(listArry(5,i))%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><font color="blue"><%=FormatCurrency(listArry(6,i),2,-1)%></font> 元</td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><font color="red"><%=FormatCurrency(listArry(7,i),2,-1)%></font> 元</td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%=showDateTime(listArry(8,i),"yyyy-MM-dd")%></td>
	<td class="tablerow<%=iCount%> hovered" nowrap="nowrap"><%
			If CLng(listArry(9,i))>0 Then
				Response.Write "<font color=""red"">支 出</font>"
			Else
				Response.Write "<font color=""blue"">收 入</font>"
			End If
	%> | <a href="?action=view&AccountID=<%=listArry(0,i)%>" title="查看详细信息">查 看</a></td>
</tr>
<%
		Next
		listArry=Null
	End If
%>
<tr>
	<td class="tablerow<%=lCount%>" colspan="10">
	<input class="button" type="button" name="chkall" value="全选" onClick="CheckAll(this.form)"><input class="button" type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
	<input class="button" type="submit" name="submit_button1" value="放入回收站" onclick="{if(confirm('确定放入回收站吗?')){document.selform.action.value='reclaim';return true;}return false;}">
	<input class="button" type="submit" name="submit_button2" value="还原回收站" onclick="{if(confirm('确定还原吗?')){document.selform.action.value='renew';return true;}return false;}">
	<input class="button" type="submit" name="submit_button3" value=" 彻底删除 " onclick="{if(confirm('确定要彻底删除吗?')){document.selform.action.value='del';return true;}return false;}"></td>
</tr>
<tr>
	<td class="tablerow<%=iCount%>" colspan="10" id="NextPageText"><var class="morePage"><%=showlistpage(pagenow,Pcount,maxperpage,totalrec,pagelinks)%></var></td>
</tr>
</table>
</form>
<script type="text/javascript">
document.getElementById("showNextPage").innerHTML = document.getElementById("NextPageText").innerHTML;
</script>
<%
End Sub

Sub showAccountlist()
	Dim Rs,SQL
	Dim BeginDate,LastDate
	If Trim(Request("BeginDate")) <> "" And Trim(Request("LastDate")) <> "" Then
		BeginDate = CDate(Replace(Replace(Request("BeginDate"), ",", "-"), " ", ""))
		LastDate = CDate(Replace(Replace(Request("LastDate"), ",", "-"), " ", ""))
		If IsSqlDataBase=1 Then
			SQLQuery="WHERE Reclaim=0 And Datediff(d,DateAndTime,getdate())<" & DateDiff("d", BeginDate-1, Now()) & " And Datediff(d,DateAndTime,getdate())>" & DateDiff("d", LastDate+1, Now()) & ""
		Else
			SQLQuery="WHERE Reclaim=0 And Datediff('d',DateAndTime,Now())<" & DateDiff("d", BeginDate-1, Now()) & " And Datediff('d',DateAndTime,Now())>" & DateDiff("d", LastDate+1, Now()) & ""
		End If
	Else
		If Not IsNull(Request("Reclaim")) And Request("Reclaim") <> "" Then
			SQLQuery="WHERE Reclaim>0"
		Else
			If Trim(Request("Accountype")) <> "" Then
				If Request("Accountype") > 0 Then
					SQLQuery="WHERE Accountype>0 And Reclaim=0"
				Else
					SQLQuery="WHERE Accountype=0 And Reclaim=0"
				End If
			Else
				SQLQuery="WHERE Reclaim=0"
			End If
		End If
	End If
	If count=0 Then
		totalrec=NewAsp.Execute("SELECT COUNT(*) FROM [NC_Account] "&SQLQuery&"")(0)
	Else
		totalrec=count
	End If
	Pcount = CLng(totalrec / maxperpage)
	If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
	If pagenow>Pcount Then pagenow=1
	pagelinks="?showmode="&Request("showmode")&"&count="&totalrec&"&"
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT AccountID,payer,payee,product,Amount,unit,price,TotalPrices,DateAndTime,Accountype,Explain,Reclaim FROM [NC_Account] "&SQLQuery&" ORDER BY AccountID DESC"
	Rs.Open SQL,Conn,1,1
	If pagenow >1 Then
		Rs.Move (pagenow-1) * maxperpage
	End If
	If Not (Rs.BOF And Rs.EOF) Then
		listArry=Rs.GetRows(maxperpage)
	Else
		listArry=Null
	End If
	Rs.close()
	Set Rs=Nothing
End Sub

Sub showQueryform()
	Dim i
%>
<form name="queryform" method="get" action="admin_account.asp">
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th>按日期查询</th>
</tr>
<tr>
	<td class="tablerow2"><select size="1" name="BeginDate">
	<%
	For i = 2001 To Year(Date)
		Response.Write "<option value=""" & i & """"
		If i = Year(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""BeginDate"">"
	For i = 1 To 12
		Response.Write "<option value=""" & i & """"
		If i = Month(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""BeginDate"">"
	For i = 1 To 31
		Response.Write "<option value=""" & i & """"
		If i = Day(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> 到 "
	Response.Write " <select size=""1"" name=""LastDate"">"
	For i = 2001 To Year(Date)
		Response.Write "<option value=""" & i & """"
		If i = Year(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""LastDate"">"
	For i = 1 To 12
		Response.Write "<option value=""" & i & """"
		If i = Month(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""LastDate"">"
	For i = 1 To 31
		Response.Write "<option value=""" & i & """"
		If i = Day(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	%></select>
	<input type="submit" name="query_button" value="开始查询" class="button">
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><%Call AccountCount()%></td>
</tr>
</table>
</form>
<%
End Sub

Sub ViewAccount()
	Dim Rs
	Set Rs = NewAsp.Execute("SELECT * FROM NC_Account WHERE AccountID="& CLng(Request("AccountID")))
	If Rs.BOF And Rs.EOF Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数!</li>"
		Set Rs = Nothing
		Exit Sub
	End If
%>
<form action="?action=save" method="post" name="myform">
<input type="hidden" name="AccountID" value="<%=Rs("AccountID")%>">
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2">查看详细信息</th>
	</tr>
	<tr>
		<td class="tablerow1" align="right" width="25%"><b>付 款 人:</b></td>
		<td class="tablerow1" width="75%"><input size="50" name="payer" value="<%=Server.HTMLEncode(Rs("payer")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>收款单位:</b></td>
		<td class="tablerow2"><input size="50" name="payee" value="<%=Server.HTMLEncode(Rs("payee")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>项目名称:</b></td>
		<td class="tablerow1"><input size="50" name="product" value="<%=Server.HTMLEncode(Rs("product")&"")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>数 量:</b></td>
		<td class="tablerow2"><input size="5" name="Amount" value="<%=Rs("Amount")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>单 位:</b></td>
		<td class="tablerow1"><input size="5" name="unit" value="<%=Rs("unit")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>单 价:</b></td>
		<td class="tablerow2"><input size="10" name="price" value="<%=Rs("price")%>" type="text" /> 元</td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>总 金 额:</b></td>
		<td class="tablerow1"><input size="10" name="TotalPrices" value="<%=Rs("TotalPrices")%>" type="text" /> 元</td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>交易时间:</b></td>
		<td class="tablerow2"><input size="30" name="DateAndTime" value="<%=Rs("DateAndTime")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>款项类型:</b></td>
		<td class="tablerow1"><select name="Accountype">
		<option value="0"<%If Rs("Accountype")=0 Then Response.Write " selected=""selected"""%>>收 入</option>
		<option value="1"<%If Rs("Accountype")>0 Then Response.Write " selected=""selected"""%>>支 出</option>
		</select></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>其它说明:</b></td>
		<td class="tablerow2"><textarea rows="5" cols="50" name="Explain"><%=Server.HTMLEncode(Rs("Explain")&"")%></textarea></td>
	</tr>
	<tr align="center">
		<td class="tablerow1" colspan="2"><input class="button" type="button" onclick="javascript:history.go(-1)" name="go_button" value="返回上一页" />&nbsp;&nbsp; <input class="button" type="submit" name="submit_button" value="修改明细表" /></td>
	</tr>
</table>
</form>
<%
	Set Rs = Nothing
End Sub

Sub ReclaimAccount()
	Dim selAccountID
	If Not IsEmpty(Request("AccountID")) Then
		selAccountID = NewAsp.CheckIDlist(Request("AccountID"))
		NewAsp.Execute ("UPDATE [NC_Account] SET Reclaim=1 WHERE AccountID in (" & selAccountID & ")")
		Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
	Else
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数,ID不能为空!</li>"
		Exit Sub
	End If
End Sub

Sub RenewAccount()
	Dim selAccountID
	If Not IsEmpty(Request("AccountID")) Then
		selAccountID = NewAsp.CheckIDlist(Request("AccountID"))
		NewAsp.Execute ("UPDATE [NC_Account] SET Reclaim=0 WHERE AccountID in (" & selAccountID & ")")
		Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
	Else
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数,ID不能为空!</li>"
		Exit Sub
	End If
End Sub

Sub DelAccount()
	Dim selAccountID
	If Not IsEmpty(Request("AccountID")) Then
		selAccountID = NewAsp.CheckIDlist(Request("AccountID"))
		NewAsp.Execute("DELETE FROM [NC_Account] WHERE AccountID in (" & selAccountID & ")")
		Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
	Else
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数,ID不能为空!</li>"
		Exit Sub
	End If
End Sub

Sub AccountCount()
	Dim Rs
	Dim Earning,Payout,Balance,Amount
	'---- 收入金额
	Set Rs = NewAsp.Execute("SELECT SUM(TotalPrices) FROM NC_Account WHERE Reclaim=0 And Accountype=0")
	Earning = Rs(0)
	If IsNull(Earning) Then Earning = 0
	Set Rs = Nothing
	'---- 支出金额
	Set Rs = NewAsp.Execute("SELECT SUM(TotalPrices) FROM NC_Account WHERE Reclaim=0 And Accountype>0")
	Payout = Rs(0)
	If IsNull(Payout) Then Payout = 0
	Set Rs = Nothing
	'---- 交易总额
	Set Rs = NewAsp.Execute("SELECT SUM(TotalPrices) FROM NC_Account WHERE Reclaim=0")
	Amount = Rs(0)
	If IsNull(Amount) Then Amount = 0
	Set Rs = Nothing
	'---- 最后余额
	Balance = Earning - Payout
	Response.Write "交易总额:<font color=""red""><b>"
	Response.Write FormatCurrency(Amount,2,-1)
	Response.Write "</b></font> 元&nbsp;&nbsp;"
	Response.Write "收入:<font color=""red""><b>"
	Response.Write FormatCurrency(Earning,2,-1)
	Response.Write "</b></font> 元&nbsp;&nbsp;"
	Response.Write "支出:<font color=""red""><b>"
	Response.Write FormatCurrency(Payout,2,-1)
	Response.Write "</b></font> 元&nbsp;&nbsp;"
	Response.Write "余额:<font color=""red""><b>"
	Response.Write FormatCurrency(Balance,2,-1)
	Response.Write "</b></font> 元&nbsp;&nbsp;"
End Sub

Sub AddAccount()
%>
<form action="?action=savenew" method="post" name="myform">
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2">添加明细表</th>
	</tr>
	<tr>
		<td class="tablerow1" align="right" width="25%"><b>付 款 人:</b></td>
		<td class="tablerow1" width="75%"><input size="50" name="payer" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>收款单位:</b></td>
		<td class="tablerow2"><input size="50" name="payee" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>项目名称:</b></td>
		<td class="tablerow1"><input size="50" name="product" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>数 量:</b></td>
		<td class="tablerow2"><input size="5" name="Amount" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>单 位:</b></td>
		<td class="tablerow1"><input size="5" name="unit" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>单 价:</b></td>
		<td class="tablerow2"><input size="10" name="price" type="text" /> 元</td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>总 金 额:</b></td>
		<td class="tablerow1"><input size="10" name="TotalPrices" type="text" /> 元</td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>交易时间:</b></td>
		<td class="tablerow2"><input size="30" name="DateAndTime" value="<%=Now()%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right"><b>款项类型:</b></td>
		<td class="tablerow1"><select name="Accountype">
		<option value="0" selected="selected">收 入</option>
		<option value="1">支 出</option>
		</select></td>
	</tr>
	<tr>
		<td class="tablerow2" align="right"><b>其它说明:</b></td>
		<td class="tablerow2"><textarea rows="5" cols="50" name="Explain"></textarea></td>
	</tr>
	<tr align="center">
		<td class="tablerow1" colspan="2"><input class="button" type="button" onclick="javascript:history.go(-1)" name="go_button" value="返回上一页" />&nbsp;&nbsp; <input class="button" type="submit" name="submit_button" value="保存明细表" /></td>
	</tr>
</table>
</form>
<%
End Sub

Sub SavenewAccount()
	Dim Rs,SQL
	If Not IsNumeric(Request("price")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>单价输入错误!</li>"
	End If
	If Not IsNumeric(Request("TotalPrices")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>总金额输入错误!</li>"
	End If
	If Not IsDate(Request("DateAndTime")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>时间输入错误!</li>"
	End If
	If FoundErr = True Then Exit Sub
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_Account WHERE (AccountID is null)"
	Rs.Open SQL,Conn,1,3
	Rs.addnew
		Rs("payer").Value = Trim(Request.Form("payer"))
		Rs("payee").Value = Trim(Request.Form("payee"))
		Rs("product").Value = Trim(Request.Form("product"))
		Rs("Amount").Value = Trim(Request.Form("Amount"))
		Rs("unit").Value = Trim(Request.Form("unit"))
		Rs("price").Value = Trim(Request.Form("price"))
		Rs("TotalPrices").Value = Trim(Request.Form("TotalPrices"))
		Rs("DateAndTime").Value = Trim(Request.Form("DateAndTime"))
		Rs("Accountype").Value = Trim(Request.Form("Accountype"))
		Rs("Explain").Value = Trim(Request.Form("Explain"))
		Rs("Reclaim").Value = 0
	Rs.update
	Rs.Close:Set Rs = Nothing
	Succeed("<li>恭喜您!添加明细成功。</li>")
End Sub

Sub SaveAccount()
	Dim Rs,SQL
	If Trim(Request("AccountID")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>AccountID参数不能为空!</li>"
		Exit Sub
	End If
	If Not IsNumeric(Request("AccountID")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>请输入正确的ID参数!</li>"
		Exit Sub
	End If
	If Not IsNumeric(Request("price")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>单价输入错误!</li>"
	End If
	If Not IsNumeric(Request("TotalPrices")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>总金额输入错误!</li>"
	End If
	If Not IsDate(Request("DateAndTime")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>时间输入错误!</li>"
	End If
	If FoundErr = True Then Exit Sub
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_Account WHERE AccountID="& CLng(Request("AccountID"))
	Rs.Open SQL,Conn,1,3
		Rs("payer").Value = Trim(Request.Form("payer"))
		Rs("payee").Value = Trim(Request.Form("payee"))
		Rs("product").Value = Trim(Request.Form("product"))
		Rs("Amount").Value = Trim(Request.Form("Amount"))
		Rs("unit").Value = Trim(Request.Form("unit"))
		Rs("price").Value = Trim(Request.Form("price"))
		Rs("TotalPrices").Value = Trim(Request.Form("TotalPrices"))
		Rs("DateAndTime").Value = Trim(Request.Form("DateAndTime"))
		Rs("Accountype").Value = Trim(Request.Form("Accountype"))
		Rs("Explain").Value = Trim(Request.Form("Explain"))
		Rs("Reclaim").Value = 0
	Rs.update
	Rs.Close:Set Rs = Nothing
	Succeed("<li>恭喜您!修改明细成功。</li>")
End Sub
%>