<!--#include virtual="/show/adminhead.asp"-->
<!--#include file="adminleft.asp"-->


<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title><%=webname%>-财务入账扣款</title>
<%
call logquanxian("e4",1)

Function randarr()
Const stringmodarr = "0123456789"
strlength = Len(stringmodarr)
Randomize timer
For i = 1 To 5 
randarr2 = randarr2&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
Next 
randarr=randarr2
End Function


uid=request.QueryString("uid")
fs=request.QueryString("fs")
%>

<DIV>

<SCRIPT LANGUAGE="JavaScript">
var checkflag1 = "false";
function check1(field) {
if (checkflag1 == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag1 = "true";
return "false"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag1 = "false";
return "true"; }
}

function unselectall1()
{
    if(document.myform.chkAll1.checked){
	document.myform.chkAll1.checked = document.myform.chkAll1.checked&0;
	checkflag1 = "false";
    } 	
}
</script>

<DIV id=main1200> 
<%call webleft()%>

<%

act=request.form("act")

if act="add" then
call lognamecode()
leibie=request.form("leibie")
userid=request.form("userid")
jine=request.form("jine")
miaoshu=request.form("miaoshu")

if leibie=99 or userid="" or jine="" then call PopErr("参数不完整")

sql="select * from ayname where aynameid="&userid&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then
call PopErr("未找到此会员")
else
cwku=trim(rs("cwku"))
	if leibie=0 or leibie=3 then
	buyuseryue=ccur(rs("ayyue"))+ccur(jine)
	rs("ayyue")=ccur(rs("ayyue"))+ccur(jine)
	end if
	if leibie=1 or leibie=2 then
	buyuseryue=ccur(rs("ayyue"))-ccur(jine)
	rs("ayyue")=ccur(rs("ayyue"))-ccur(jine)
	end if
	if leibie=11 then
	buyuseryue=ccur(rs("ayyue"))-ccur(jine)
	
	if ccur(jine)>ccur(rs("ayyue")) then
	call PopErr("商户余额不足")
	response.End()
	end if
	
	rs("ayyue")=ccur(rs("ayyue"))-ccur(jine)
	rs("aydongjie")=ccur(rs("aydongjie"))+ccur(jine)
	end if
rs.update
rs.close
if trim(miaoshu)="" then
miaoshu="-"
end if

			'创建财务流水
			select case	trim(cwku)
			case "aycaiwu"
			randarrcwku="A"
			case "aycaiwu01"
			randarrcwku="B"
			case "aycaiwu02"
			randarrcwku="C"
			case "aycaiwu03"
			randarrcwku="D"
			case "aycaiwu04"
			randarrcwku="E"
			case "aycaiwu05"
			randarrcwku="F"
			case else
			randarrcwku="A"
			end select
			crandarrlei="C" 	'标示 D订单 C财务
			crandarrhost="A" 	'服务器数据库
			crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
			crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast
			
conn.Execute("Insert Into "&cwku&"(aycaiwuzt,aycailiushui,aycaiwuleibie,aycaiwuuser,aycaiwudate,aycaiwujine,aycaiwuyue,aycaiwubody,aycaiwufangshi,aycwfsjin,aycwinjin,aycaiwuzhifu) values('1','"&crandarr&"','"&leibie&"','"&clng(userid)&"','"&now()&"','"&Formatnumber(jine,2,true,-1,0)&"','"&Formatnumber(buyuseryue,2,true,-1,0)&"','"&miaoshu&"','4','"&Formatnumber(jine,2,true,-1,0)&"','"&Formatnumber(jine,2,true,-1,0)&"','0')")
call logadd(request.Cookies("aynameid"),"管理-财务入账扣款操作成功"&userid,0,0)
call PopErr2("财务处理成功","admincaiwujin.asp")
end if


end if

%>


<DIV id=main_right>
<DIV id=main_right_content>
<STYLE>.apply_style {
	POSITION: absolute
}
.right_title A {
	LINE-HEIGHT: 27px; WIDTH: 126px; DISPLAY: inline-block; BACKGROUND: url(<%=ossurl%>images/bg22.gif) no-repeat; HEIGHT: 27px
}
.right_title A.current {
	BACKGROUND: url(<%=ossurl%>images/main_right_title_bg.gif) no-repeat; COLOR: #fff; FONT-WEIGHT: bold
}
.table_style_1 TD {
	HEIGHT: 38px
}
.table_style_home_info TD {
	PADDING-BOTTOM: 0px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; HEIGHT: 30px; PADDING-TOP: 0px
}
</STYLE>

<DIV class=right_titleadmin>&nbsp;&nbsp;财务入账扣款</DIV>
<DIV class=main><br>

 <form action="" method="post" name="myform" id="myform"> 
  <table width="60%" border="0" cellpadding="0" cellspacing="0" class="table_style_a1">
    
       <tr>
         <th width="189" align="center" class="border_right border_bottom" >财务类别：
         <td width="589" align="left" class="border_right border_bottom">
		 &nbsp;<select name="leibie" id="leibie">
           <option value="99">选择财务类别</option>
           <option value="0" <%if fs="ru" then response.Write "selected"%>>入款</option>
		   <option value="11" <%if fs="kou" then response.Write "selected"%>>冻结</option>
         </select> </td>          </tr>


	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
        <th align="center" class="border_right border_bottom">会员ID ：
        <td align="left" class="border_right border_bottom">&nbsp;<input name="userid" type="text" id="userid" <%if uid<>"" then response.Write " value="&uid&""%> size="13" maxlength="5"></td>
        </tr>
	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
	    <th align="center" class="border_right border_bottom">发生金额：
	    <td align="left" class="border_right border_bottom">&nbsp;<input name="jine" type="text" id="jine" size="13" maxlength="7">
元</td>
	  </tr>
	  <tr onmouseover=this.bgColor='#D2FFFF' onmouseout=this.bgColor='#ffffff'>
	    <th align="center" class="border_right border_bottom">描述：
	    <td align="left" class="border_right border_bottom">&nbsp;<input name="miaoshu" type="text" id="miaoshu" size="13" maxlength="25">
	      <input name="act" type="hidden" id="act" value="add"></td>
	  </tr>
	  

      <tr>
        <td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" name="Submit" value=" 提 交 "></td>
      </tr>
    </table></form>
</DIV>


</DIV></DIV>
<DIV class=clear></DIV></DIV>
</DIV>
<SCRIPT>
$(function(){
$('.left_title').each(function(){
   $(this).click(function(){
	   var index=$('.left_title').index(this);
	   if($(this).next().hasClass('hide_m')){
		   $(this).next().removeClass('hide_m');
           $(this).next().show();		 
		   $(this).find('img').attr('src','<%=ossurl%>images/expansion.gif');
		   $.cookie('m_index_'+index,'',{expires:0});
	   } else {
	       $(this).next().hide();
		   $(this).next().addClass('hide_m');
		   $(this).find('img').attr('src','<%=ossurl%>images/shrank.gif');		   
		   $.cookie('m_index_'+index,'none',{expires:365});
	   }
   })
})

$('.left_title').each(function(){
	var index=$('.left_title').index(this);
    $(this).next().css('display',$.cookie('m_index_'+index) ? $.cookie('m_index_'+index) : '');
	if($.cookie('m_index_'+index)){
	    $(this).next().addClass('hide_m');
	}
	$(this).find('img').attr('src',$.cookie('m_index_'+index) ? '<%=ossurl%>images/shrank.gif' : '<%=ossurl%>images/expansion.gif');
})
})

</SCRIPT>


<!--#include virtual="/show/footadmin.asp"-->

