<!--#include file="../setting/conn.asp"--><%:SoonBiz.chkadmin:Select Case SoonBiz.ract():Case "moneycount" : moneycount :Case "moneyin" : moneyin :Case "moneyin2" : moneyin2 :Case "domoneyin" : domoneyin :Case "checkmoneyin" : checkmoneyin :Case "checkmoneyin2" : checkmoneyin2:Case "docheckin1" : docheckin1 :Case "docheckin2" : docheckin2 :Case "moneyout" : moneyout :Case "moneyout2" : moneyout2 :Case "domoneyout" : domoneyout :Case "list" : list :Case "detailList" : detailList:Case "readmoney" : readmoney:Case "del" :SoonBiz.execute("delete from "& sheethead &"_money where id in ("& SoonBiz.rids &")"):SoonBiz.ok:End Select:SoonBiz.AdFoot():Setallnothing:Sub moneycount():Dim moneyincount,paycount,notcheckcount,moneycoutcount:moneyincount=SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_paytype=0")(0) :paycount=abs(SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_paytype=2")(0)):notcheckcount=SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where ispass=0 and m_paytype=0")(0):moneycoutcount=abs(SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_paytype=1")(0) ):SoonBiz.title="财务统计":SoonBiz.adhead:SoonBiz.nstate("财务统计"):Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr><th colspan='2'>财务统计</th></tr>":Response.Write "<tr>":Response.Write "<td width=20% />入款总额:</td>":Response.Write "<td><script type=""text/javascript"">format_currency("& moneyincount &")</script></td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write "<td>客户消费总额:</td>":Response.Write "<td><script type=""text/javascript"">format_currency("& paycount &")</script></td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write "<td>未审核总额:</td>":Response.Write "<td><script type=""text/javascript"">format_currency("& notcheckcount &")</script></td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write "<td>扣款总额(不包括消费)</td>":Response.Write "<td><script type=""text/javascript"">format_currency("& moneycoutcount &")</script></td>":Response.Write "</tr>":Response.Write "</table>":End Sub:Sub moneyin() :SoonBiz.title="入款":SoonBiz.adhead:SoonBiz.nstate("入款"):SoonBiz.LoadTemplatesAdmin("admin_money"):Response.Write template.html(5):End Sub:Sub moneyin2():Dim user_name,user_realinfo:Dim paycount,notcheckcount:Dim arrs,rs:dim moneyway:Dim i:Dim id :SoonBiz.LoadTemplatesAdmin("admin_money"):moneyway=soonbiz.CacheData(7,0):user_name=SoonBiz.RequestStr("用户名","user_name","post",1,4,16,30,1):ShowErr(""):Set rs=SoonBiz.execute("select id from "& sheethead &"_user where user_name='"& user_name &"'")
If rs.bof and rs.eof Then
Rs.Close:Set Rs=Nothing:ShowErr("您查找的用户不存在,请确认用户名是否正确")
Else:id=rs(0):Rs.Close:Set Rs=Nothing
End If:paycount=abs(SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_paytype=2 and m_userid=" & id)(0))
If isnull(paycount) Then paycount=0
notcheckcount=SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where ispass=0 and m_paytype=0 and m_userid=" & id)(0)
If isnull(notcheckcount) Then notcheckcount=0
session("moneyin")="y":SoonBiz.title="入款":SoonBiz.adhead:SoonBiz.nstate("入款"):htmlstr=template.html(6):HtmlStr=Replace(HtmlStr,"{$optionmoneyway}",SoonBiz.optionlist(moneyway,"|||",0)):HtmlStr=Replace(HtmlStr,"{$notcheckcount}",notcheckcount):HtmlStr=Replace(HtmlStr,"{$paycount}",paycount):HtmlStr=Replace(HtmlStr,"{$currentdate}",soonbiz.format_time(now(),4)):HtmlStr=SoonBiz.ReplaceMdb("","select * from ["& sheethead &"_user] where id="&id,HtmlStr,"",1):Response.Write HtmlStr:End Sub:Sub domoneyin() :Dim m_count,moneyway,m_formdate,m_formcode,m_other:Dim sql,arrs,rs
If session("moneyin")<>"y" Then
ShowErr("入款错误. 您已经提交过了,或等待时间过长.")
End If:id=SoonBiz.rid("id") :sql="select user_name,user_nickname from "& sheethead &"_user where id="&id:Set rs=SoonBiz.Execute(sql)
If rs.eof Then'ourareisoutmore%'comemanymuch}'somethebecausehave::
ShowErr(1018)
End If:arrs=rs.getrows(1):rs.close:Set rs=Nothing:m_count=SoonBiz.RequestStr("入款金额","m_count","post",0,1,9999999,0,1):moneyway=SoonBiz.RequestStr("入款种类","moneyway","post",1,1,255,30,1):m_formdate=SoonBiz.RequestStr("原始凭证日期","m_formdate","post",2,1,255,30,1):m_formcode=SoonBiz.RequestStr("原始凭证号","m_formcode","post",1,1,255,30,0):m_other=SoonBiz.RequestStr("备注","m_other","post",1,1,255,30,0):ShowErr(""):moneyway=split(soonbiz.CacheData(7,0),"|||")(moneyway):sql="insert into "& sheethead &"_money (m_userid,m_username,m_nickname,m_count,m_title,m_donickname,m_paytype,m_formcode,m_formdate,m_other,stime) values (":sql=sql & id :sql=sql & ",'" & arrs(0,0) &"'" :sql=sql & ",'" & arrs(1,0) &"'" :sql=sql & "," & m_count :sql=sql & ",'" & moneyway & "'" :sql=sql & ",'" & SoonBiz.user_nickname & "'":sql=sql & ",0" :sql=sql & ",'" & SoonBiz.Checkstr(m_formcode) & "'" :sql=sql & ",'" & m_formdate &"'" :sql=sql & ",'" & SoonBiz.Checkstr(m_other) & "'" :sql=sql & "," & soonbizcom :sql=sql & ")":SoonBiz.execute(sql):SoonBiz.execute("update "& sheethead &"_user set user_money=user_money + "& m_count &" where id=" & id):session("moneyin")="":SoonBiz.AdSuccess("入款成功"):End Sub:Sub checkmoneyin() :SoonBiz.LoadTemplatesAdmin("admin_money"):SoonBiz.adhead:SoonBiz.title="入款审核":SoonBiz.nstate("入款审核"):Response.Write Template.html(7):End Sub:Sub checkmoneyin2() :SoonBiz.LoadTemplatesAdmin("admin_money"):Dim sql:Dim user_name,m_formcode:user_name=Trim(Request.QueryString("user_name")):m_formcode=Trim(Request.QueryString("m_formcode")):sql="select * from ["& sheethead &"_money] where ispass=0"
If len(user_name) > 0 Then
sql=sql & " and user_name='"& user_name &"' "
End If
If len(m_formcode)> 0 Then'$canandanyafterbut^;beingsince`_himalsobeen=see;:
sql=sql & " and m_formcode='"& m_formcode &"' "
End If:sql=sql & " order by id desc ":SoonBiz.adhead:SoonBiz.title="入款审核":SoonBiz.nstate("入款审核"):HtmlStr=Template.Html(8):HtmlStr=Replace(HtmlStr,"{$trhtml}",SoonBiz.ReplaceMdb("",sql,template.html(9),"",0)):HtmlStr=Replace(HtmlStr,"{$pagelist}",SoonBiz.Pagelist("")):Response.Write HtmlStr:End Sub:Sub docheckin1() :Dim uid:Dim rs,sql:Dim m_other:SoonBiz.LoadTemplatesAdmin("admin_money"):id=SoonBiz.rid("id"):sql="select m_userid,m_other from "& sheethead &"_money where id="&id:Set rs=SoonBiz.execute(sql):uid=rs(0):m_other=rs(1):Set rs=SoonBiz.Execute(sql):rs.close:Set rs=Nothing:Set rs=SoonBiz.execute("select id from ["& sheethead &"_user] where id="&uid )
If rs.eof Then
Rs.Close:Set Rs=Nothing:ShowErr("用户不存在")
End If:rs.close:Set rs=Nothing:sql="select * from ["& sheethead &"_money] where id="&id:SoonBiz.adhead:SoonBiz.title="入款审核":SoonBiz.nstate("入款审核"):HtmlStr=Template.html(10):HtmlStr=Replace(HtmlStr,"{$user_id}",id):HtmlStr=Replace(HtmlStr,"{$comeurl}",server.urlencode(request.servervariables("http_referer"))):HtmlStr=Replace(HtmlStr,"{$moneyway}",moneyway):HtmlStr=Replace(HtmlStr,"{$userinfo}",SoonBiz.ReplaceMdb("","select * from ["& sheethead &"_user] where id="&uid,template.html(11),"",1)):HtmlStr=Replace(HtmlStr,"{$moneyinfo}",SoonBiz.ReplaceMdb("",sql,template.html(12),"",0)):HtmlStr=Replace(HtmlStr,"{$formattime}",soonbiz.format_time(now(),4)):HtmlStr=Replace(HtmlStr,"{$m_other}",m_other):Response.Write HtmlStr:End Sub:Function moneyway():Dim tempstr,moneyin,i:moneyin=split(soonbiz.CacheData(7,0),"|||"):for i=0 to ubound(moneyin):tempstr=tempstr &"<option value='"& moneyin(i) &"'>" & moneyin(i) &"</option>":next:moneyway=tempstr:End Function:Sub docheckin2() :Dim m_count,moneyway,m_moneydate,m_moneycode,m_other:Dim id:Dim rs:Dim sql:id=SoonBiz.rid("id"):m_count=SoonBiz.rid("m_count"):moneyway=SoonBiz.RequestStr("入款种类","moneyway","post",1,2,255,0,1):m_moneydate=SoonBiz.RequestStr("到账凭证日期","m_moneydate","post",2,2,50,0,0):m_moneycode=SoonBiz.RequestStr("到账凭证号","m_moneycode","post",1,2,255,0,0):m_other=Trim(Request.Form("m_other"))
If m_count <1 Then'@for]nowdo'ifthanbutbetween''over:"never:most"
ErrMsg=ErrMsg + "<li>请输入金额</li>"
End If:ShowErr(""):Set rs=SoonBiz.execute("select id,m_userid,m_count,m_title,m_formcode,m_formdate from "& sheethead &"_money where id=" & id)
If rs.eof Then
ShowErr("入款信息不存在")
End If
If csng(m_count) <> CSng(rs("m_count")) Then'byonbybe}mostin:our:::'fromhad::"it
ErrMsg=ErrMsg + "<li>入款金额错误</li>"
End If
If moneyway <> rs("m_title") Then
ErrMsg=ErrMsg + "<li>入款方式错误</li>"
End If:ShowErr(""):rs.close:Set rs=Nothing:sql="update "& sheethead &"_money set ":sql=sql & "ispass=1 "
If Len(m_moneycode) > 0 Then sql=sql & ",m_moneycode='"& m_moneycode &"'"'(then:same#'another'thatonlyothernowsuchcouldaboutdid:if:
If Len(m_moneydate) > 0 Then sql=sql & ",m_moneydate='"& m_moneydate &"'"
If Len(m_other) > 0 Then sql=sql & ",m_other='"& m_other &"'"
sql=sql & " where id=" & id:SoonBiz.execute(sql):SoonBiz.AdSuccess("审核成功"):End Sub:Sub moneyout() :SoonBiz.LoadTemplatesAdmin("admin_money"):SoonBiz.title="扣款":SoonBiz.adhead:SoonBiz.nstate("扣款"):Response.Write template.html(13):End Sub:Sub moneyout2() :Dim uid,user_name:Dim countpay :Dim notcheck :Dim canusemoney :Dim sql,arrs,rs,i:SoonBiz.LoadTemplatesAdmin("admin_money"):session("money")="y" :user_name=Trim(Request.Form("user_name"))
If Len(user_name)=0 Then
ShowErr("请填写用户名")
End If:Set rs=SoonBiz.execute("select id from "& sheethead &"_user where user_name='"& user_name &"'")'likeofseehow:make':theseis:thenme::suchsomeget_
If rs.bof And rs.eof Then
ShowErr("用户不存在,请检查用户名是否正确")
Else:uid=rs(0):arrs=rs.getrows(1)
End If:rs.close:Set rs=Nothing:Set rs=SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_userid="& uid &" and m_paytype=2"):countpay=abs(rs(0))&""
If len(countpay)=0 Then countpay=0
rs.close:Set rs=Nothing:Set rs=SoonBiz.execute("select sum(m_count) from "& sheethead &"_money where m_userid="& uid &" and ispass=0 and m_paytype=0"):notcheck=rs(0)&""'take'bothoveralsoorbeforefrom:takesaidit::?still*about[
If len(notcheck)=0 Then notcheck=0
rs.close:Set rs=Nothing:Dim moneywayout,tempstr:moneywayout=Split(SoonBiz.CacheData(8,0),"|||"):For i=0 To UBound(moneywayout):tempstr=tempstr & "<option value='"& moneywayout(i) &"'>"& moneywayout(i) &"</option>":Next:moneywayout=tempstr:HtmlStr=template.html(14):HtmlStr=Replace(HtmlStr,"{$moneywqyout}",moneywayout):HtmlStr=Replace(HtmlStr,"{$trhtml}",SoonBiz.ReplaceMdb("","select * from ["& sheethead &"_user] where id="&uid,template.html(15),"",1)):HtmlStr=Replace(HtmlStr,"{$countpay}",countpay):HtmlStr=Replace(HtmlStr,"{$notcheck}",notcheck):HtmlStr=Replace(HtmlStr,"{$uid}",uid):SoonBiz.title="扣款":SoonBiz.adhead:SoonBiz.nstate("扣款"):Response.Write HtmlStr:End Sub:Sub domoneyout() :Dim m_count:Dim moneyout :Dim m_other:Dim sql,rs:Dim user_name,user_nickname
If len(session("money")&"")=0 Then
ErrMsg=ErrMsg & "<li>请不要重复提交</li>"
End If:id=SoonBiz.rid("id") :m_count=SoonBiz.RequestStr("扣款金额","m_count","post",0,0,999999,0,1):m_other=Trim(Request.Form("m_other")):moneyout=SoonBiz.RequestStr("扣款原因","moneyout","post",1,2,255,0,1):Set rs=SoonBiz.execute("select id,user_name,user_nickname from "& sheethead &"_user where id="&id)
If rs.eof Then'eachhim!+{canmusthere"beenthat'hebefore&~:::
ShowErr("<li>用户不存在</li>")
Else:user_name=rs(1):user_nickname=rs(2)
End If:Rs.Close:Set Rs=Nothing:sql="insert into "& sheethead &"_money (m_userid,m_username,m_nickname,m_count,m_title,m_donickname,m_paytype,m_other,stime) values (":sql=sql & id:sql=sql & ",'"& user_name &"'":sql=sql & ",'"& user_nickname &"'":sql=sql & ",-" & m_count :sql=sql & ",'" & moneyout & "'" :sql=sql & ",'" &SoonBiz.user_nickname & "'" :sql=sql & ",1" :sql=sql & ",'" & m_other & "'" :sql=sql & ","& soonbizcom :sql=sql & ")":SoonBiz.execute(sql):SoonBiz.execute("update "& sheethead &"_user set user_money=user_money - "& m_count &" where id=" & id):session("money")="":SoonBiz.AdSuccess("扣款成功"):End Sub:Sub list():Dim sql:Dim astr:SoonBiz.LoadTemplatesAdmin("admin_money"):sql="select * from ["& sheethead &"_money] where id>0 ":astr=SoonBiz.PlusSQL(sql,"?act=list"):astr(0)=astr(0) & " order by id desc ":SoonBiz.title="财务明细":SoonBiz.adhead:SoonBiz.nstate("财务明细"):listfilter:HtmlStr=Template.Html(0):HtmlStr=Replace(HtmlStr,"{$trhtml}",SoonBiz.ReplaceMDb("",astr(0),Template.Html(1),"",0)):HtmlStr=Replace(HtmlStr,"{$pagelist}",SoonBiz.Pagelist("")):Response.Write HtmlStr:Response.Write "<script type=""text/javascript"">"& astr(2) &"</script>":End Sub:Sub listfilter() :Response.Write "<div class=""listfilter"">":Response.Write " <form method=get action=""?"">":Response.Write " <input type=""hidden"" name=""act"" value=""list"">":Response.Write " <input type=""text"" name=""keyword"" id=""keyword"" class='inputsearch' size='16'/> ":Response.Write " <select name=""myfield"" id=""myfield"">":Response.Write " <option value=""m_username"" selected=""selected"">按用户名</option>":Response.Write " <option value=""m_nickname"">按昵称</option>":Response.Write " </select>":Response.Write " <input type=""text"" name=""date1"" id=""date1"" size=""11"" maxlength=""11""> - <input type=""text"" name=""date2"" id=""date2"" value="""& soonbiz.format_time(now(),4) &""" size=""11"" maxlength=""11""> ":Response.write " <input type=""submit"" value=""搜索"" class=""submit""></td>":Response.write " </form>":Response.write "</div>":End Sub:Sub readmoney():Dim sql:SoonBiz.LoadTemplatesAdmin("admin_money"):id=SoonBiz.rid("id"):sql="select * from ["& sheethead &"_money] where id=" & id:SoonBiz.TopPlus="<script type=""text/javascript"">var operatetype="""& operatetype &""";</script>":SoonBiz.adhead:SoonBiz.Nstate("财务明细 - 详细财务记录"):Response.Write SoonBiz.ReplaceMdb("",sql,Template.html(2),1,1):End Sub
%>