<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<%
call head()
dim zoneyuejb
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select zoneyuejb from twapp where id=1",conn,1,1
if rs.eof then
  Call Error("<card title=""出错""><p>系统没有配置！")
  end if
zoneyuejb=rs("zoneyuejb")
rs.close
set rs=nothing
dim bbsid
  bbsid=trim(request.querystring("bbsid"))
if bbsid="" or IsNumeric(bbsid)=False then
  Call Error("<card title=""出错""><p>ID无效！")
  end if
dim bbsname,zonejb
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select name,zonejb from ydbbs where id="&bbsid,conn,1,1
if rs.eof then
  Call Error("<card title=""出错""><p>不存在的"&zonene&"！")
  end if
  bbsname =rs("name")
  zonejb =rs("zonejb")
rs.close
set rs=nothing
dim info
info=request.querystring("info")
Select Case info
	Case "payin"   
		Call zonepay()
	Case "payout" 
		Call zoneout()
    Case Else 
	Call paylist()
end select 

sub paylist()
Call saycarda(""&ubb(bbsname)&""&zonene&"金库")











response.write"金库剩余"&getcent&":"&zonejb&""
response.write"<br/>"&zonene&"每天需交税"&zoneyuejb&getcent&""

response.write"<br/><a href=""zonetax.asp?info=payin&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">&gt;我要捐款</a>"&chr(13)
if adminzone=abs(bbsid) then
response.write"<a href=""zonetax.asp?info=payout&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">提款</a>"&chr(13)
end if
   response.write "<br/>-----------<br/>"
typeID=request("typeID")
if typeID="1" then
response.write"<a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">捐助列表</a>|支出明细<br/>"&chr(13)
else
response.write"捐助列表|<a href=""zonetax.asp?bbsid="&bbsid&"&amp;typeID=1&amp;saytk="&saytk&"&amp;sid="&sid&""">支出明细</a><br/>"&chr(13)
end if
if typeID="" or Isnumeric(typeID)=False then typeID=0
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select id,usid,username,paycent,paytime,liyou,typeID from zoneCent where typeID="&typeID&" and bbsid="&bbsid&" order by id desc",conn,1,1
If Not rs.eof	Then
	Dim PageSize,i
	PageSize=8			
	Dim Count,page,pagecount,gopage			
	gopage="zonetax.asp?bbsid="&bbsid&"&amp;typeID="&typeID&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	Count=rs.recordcount	
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize
        if page>pagecount then page=pagecount
	rs.move(pagesize*(page-1))					
	For i=1 To PageSize     						
	If rs.eof Then Exit For	
    response.write i+(page-1)*PageSize&"."
   
    response.write"<a href=""uinfo.asp?id="&rs("usid")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&ubb(rs("username"))&"</a>"&chr(13)
   if rs("typeID")=0 then
  response.write "捐了"&rs("paycent")&getcent&"("&fordate(rs("paytime"))&")"
  else
  response.write "提取了"&rs("paycent")&getcent&"提取说明:"&ubb(rs("liyou"))&"("&fordate(rs("paytime"))&")"
  end if
    response.write "<br/>"
	rs.moveNext
 	Next
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下页</a>"
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上页</a>"
	if pagecount>1 then response.write "<br/>"&page&"/"&pagecount&"页,共"&Count&"条<br/><input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""3""/><a href="""&gopage&"page=$(page)"">跳到该页</a><br/>"
Else
Response.write "暂时没有记录！<br/>"
end if
rs.close
set rs=nothing
end sub

sub zonepay()






call saycarda("我要捐款")


dim Action
 Action=request("Action")
  if Action<>"" then
  dim cent,mypass
  cent=request("cent")
  mypass=request("mypass")
  if cent="" or Isnumeric(cent)=False then
  Call Error("捐款数额无效！")
  end if
  if cent<1000 then
    Call Error("捐款最小数额为1000"&getcent&"！")
  end if
  if clng(cent)>myjb then
    Call Error("您的"&getcent&"不足！")
  end if
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select mm from Users where id="&myid,conn,1,2
if mypass<>rs("mm") then
  Call Error("密码错误！")
  end if
  rs.close
  set rs=nothing

  set rs=server.createobject("adodb.recordset")
rs.open"select id,usid,username,paycent,paytime,bbsid from zoneCent ",conn,1,2
  rs.addnew
  rs("usid")=myid
  rs("username")=myni
  rs("paycent")=cent
  rs("paytime")=now()
  rs("bbsid")=bbsid
  rs.update
  rs.close
  set rs=nothing


'操作币
conn.Execute("update Users set myjb=myjb-"&clng(cent)&" Where id="&myid)
conn.Execute("update ydbbs set zonejb=zonejb+"&clng(cent)&" Where id="&bbsid)
  response.write"恭喜！捐款成功！"
  else
  if saytk>1 then
	Response.write "<form name=""form"" method=""post"" action=""zonetax.asp?info=payin&amp;bbsid="&bbsid&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"
end if
%>
捐款数额:<br/><input name="cent" format="*N" emptyok="false"/><br/>
登录密码:<br/><input name="mypass" emptyok="false"/><br/>
<%
if saytk>1 then
response.write "<input type=""hidden"" name=""action"" value=""ok""/>"
%>
<input type="submit" name="Submit" value="确认捐款"></form><br/><%
else%>
<anchor>确认捐款<go href="zonetax.asp?info=payin&amp;bbsid=<%=bbsid%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>" method="post" accept-charset="utf-8">
        <postfield name="cent" value="$(cent)"/>  
        <postfield name="mypass" value="$(mypass)"/>   
        <postfield name="action" value="ok"/>  
		 </go>
</anchor>
<%end if
response.write"<br/><a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">&gt;再考虑一下</a>*捐款最小数额为1000"&getcent&""&chr(13)
end if
response.write"<br/><a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回上级</a>"
end sub

sub zoneout()

call saycarda("我要提款")
if adminzone=abs(bbsid) then
else
  Call Error("权限不足！")
  end if
dim Action
 Action=request("Action")
  if Action<>"" then
  dim cent,mypass,liyou
  cent=request("cent")
  mypass=request("mypass")
  liyou=request("liyou")
  if cent="" or Isnumeric(cent)=False then
  Call Error("提取数额无效！")
  end if
  if cent<1000 then
    Call Error("提取最小数额为1000"&getcent&"！")
  end if
  if clng(cent)>clng(zonejb) then
    Call Error("金库剩余不足此次提取！")
  end if
  if liyou="" then 
    Call Error("理由不充分！")
  end if
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select mm from Users where id="&myid,conn,1,2
if mypass<>rs("mm") then
  Call Error("密码错误！")
  end if
  rs.close
  set rs=nothing

  set rs=server.createobject("adodb.recordset")
rs.open"select id,usid,username,paycent,paytime,liyou,typeID,bbsid from zoneCent ",conn,1,2
  rs.addnew
  rs("usid")=myid
  rs("username")=myni
  rs("paycent")=cent
  rs("paytime")=now()
  rs("liyou")=left(liyou,30)
  rs("typeID")=1
  rs("bbsid")=bbsid
  rs.update
  rs.close
  set rs=nothing
  

'操作币
conn.Execute("update Users set myjb=myjb+"&clng(cent)&" Where id="&myid)
conn.Execute("update ydbbs set zonejb=zonejb-"&clng(cent)&" Where id="&bbsid)
  response.write"恭喜！提取成功！"
  else
if saytk>1 then
	Response.write "<form name=""form"" method=""post"" action=""zonetax.asp?info=payout&amp;bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"
end if
%>


提取数额:<br/><input name="cent" format="*N" emptyok="false"/><br/>
提取理由:<br/><input name="liyou" emptyok="false"/><br/>
登录密码:<br/><input name="mypass" emptyok="false"/><br/>
<%
if saytk>1 then
response.write "<input type=""hidden"" name=""action"" value=""ok""/>"
%>

<input type="submit" name="Submit" value="确认"></form><br/><%
else
%>
<anchor>确认提取
    <go href="zonetax.asp?info=payout&amp;bbsid=<%=bbsid%>&amp;sid=<%=sid%>&saytk=<%=saytk%>" method="post" accept-charset="utf-8">
        <postfield name="cent" value="$(cent)"/>  
        <postfield name="liyou" value="$(liyou)"/>  
        <postfield name="mypass" value="$(mypass)"/>   
        <postfield name="action" value="ok"/>  
    </go>
</anchor>



<%end if
response.write"<br/><a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">&gt;再考虑一下</a>*提取最小数额为1000"&getcent&""&chr(13)
end if
response.write"<br/><a href=""zonetax.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回上级</a>"
end sub

conn.close
set conn=nothing
response.write"<br/><a href=""board.asp?bbsid="&bbsid&"&amp;saytk="&saytk&"&amp;sid="&sid&""">返回家族论坛</a>"
response.write"<br/><a href=""zone.asp?saytk="&saytk&"&amp;sid="&sid&""">返回家族首页</a>"
%><!--#include file="fanhui.asp"-->
<%
call headsay()
%>