程序代码:<!--#include file="heck.asp"-->
<%
InOut = Request("add")
If Request.form("add")=" 确认支出信息录入 " Then
adddate = Request.Form("adddate")
selpayer = Request.Form("selpayer")
seltype = Request.Form("seltype")
mo = Trim(Request.Form("mo"))
mo0 = Trim(Request.Form("mo0"))
mo1 = Trim(Request.Form("mo1"))
mo2 = Trim(Request.Form("mo2"))
hj=cint(mo)+cint(mo0) '设置变量,让两个金额相加'
pjna = Trim(Request.Form("pjna"))
if seltype="" then
Response.Write "<script>alert('请用管理员帐号添加费用类型!');location='javascript:history.back(-1)';</SCRIPT>"
Response.End
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From
"
rs.Open Sql,Conn,1,3
If mo2<>0 then '如果白条核销的情况
'往表公用插入支出数据
rs.addNew
rs("InOut") = InOut
rs("PayTypeID") = seltype
rs("Moneys") = mo2
rs("Project") = checkform(pjna)
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
set rs=nothing
Response.Write "<script>alert('操作成功!');this.location.href='gypay.asp';</SCRIPT>"
elseIf mo1<>0 then '如果发票核销的情况
'往表公用插入支出数据
rs.addNew
rs("InOut") = InOut
rs("PayTypeID") = seltype
rs("Moneys") = mo1
rs("Project") = checkform(pjna)
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
'往对公公用总表插入支出数据
Set rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From [dglistgy]"
rs.Open Sql,Conn,1,3
rs.addNew
rs("InOut") = InOut
rs("PayTypeID") = seltype
rs("Moneys") = mo1
rs("Project") = checkform(pjna)
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
set rsy=nothing
Response.Write "<script>alert('操作成功!');this.location.href='gypay.asp';</SCRIPT>"
elseif mo1=0 and mo2=0 then '转账
rs.addNew
rs("InOut") = InOut
rs("PayTypeID") = seltype
rs("Moneys") = mo
rs("Project") = checkform(pjna+"实际支出)
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
'往表公用插入收入数据mo+mon
rs.addNew
rs("InOut") = InOut+1
rs("PayTypeID") = 3
rs("Moneys") = hj
rs("Project") = checkform(pjna+"转账单金额")
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
'往对公公用总表插入支出数据
Set rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From [dglistgy]"
rs.Open Sql,Conn,1,3
rs.addNew
rs("InOut") = InOut
rs("PayTypeID") = seltype
rs("Moneys") = hj
rs("Project") = checkform(pjna)
rs("addTime") = adddate
rs("data") = adddate
rs("etime") = now()
rs("user") = Request.Cookies("id")
rs.Update
rs.Close
Response.Write "<script>alert('操作成功!');this.location.href='gypay.asp';</SCRIPT>"
End if
End if
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="images/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.auto-style1 {
height: 35px;
}
.auto-style2 {
width: 35%;
}
.auto-style3 {
width: 87px;
}
.auto-style7 {
height: 29px;
}
.auto-style8 {
color: #0066FF;
}
.auto-style9 {
color: #FF0000;
}
.auto-style10 {
width: 79px;
}
.auto-style11 {
width: 314px;
}
</style>
</head>
<body>
<script>
var ie =navigator.appName=="Microsoft Internet Explorer"?true:false;
function $(objID)
{
return document.getElementById(objID);
}
function CheckForm() {
if (document.form1.adddate.value=="")
{
alert("请选择日期!");
return false;
}
if (document.form1.pjna.value=="")
{
alert("摘要名称不能为空!");
document.form1.pjna.focus();
return false;
}
if (document.form1.seltype.value=="")
{
alert("请选择费用类型!如果没有请先添加!");
return false;
}
}
</script>
<script type="text/javascript" src="images/time.js"></script>
<table width="100%" border="0" align=center cellpadding="6" cellspacing="0">
<form action="" method=post name=form1 onSubmit="return CheckForm()">
<tr>
<td colspan=5 align="center" bgcolor="#F9F9F9" class="auto-style1"><b>
<%If InOut=0 Then
Response.Write"<font color=red size=larger>学校公用经费支出记账</font>"
End if
%> </b></td>
</tr>
<tr>
<td align="right" class="auto-style2">选择日期:</div></td>
<td colspan="4" ><input name="adddate" type="text" size="20" readonly="readonly" onclick="showcalendar(event, this);" onfocus="showcalendar(event, this);if(this.value=='0000-00-00')this.value=''" /></td>
</tr>
<tr>
<td align="right" class="auto-style2">费用类型:</td>
<td colspan="4"><select name="seltype">
<%
set rs=server.createobject("adodb.recordset")
sql="select * from [type] Where InOut="&InOut&""
rs.open sql,conn,1,1
response.write "<option sel=selected value='' name=seltype>请选择</option>"
do while not rs.eof
response.write "<option " & sel & " value='"+CStr(rs("ID"))+"' name=seltype>"+rs("PayType")+"</option>"+chr(13)+chr(10)
rs.movenext
loop
rs.close
%>
</select></td>
</tr>
<tr>
<td class="auto-style2" ><div align="right">摘要:</div></td>
<td colspan="4" ><input name="pjna" type="text" size="50" maxlength="50" class="auto-style11" /></td>
</tr>
<tr>
<td align="right" class="auto-style2">业务选择:</td>
<td colspan="4" >
<strong>1.转 账</strong> <input name="mo" type="text" size="20" maxlength="10" class="auto-style3" /> <strong>(实+盈)</strong> <input name="mo0" type="text" size="20" maxlength="10" class="auto-style3" /></td>
</tr>
<tr>
<td align="right" class="auto-style2"></td>
<td colspan="4" >
<span class="auto-style9"><strong>2.发票核销<input name="mo1" type="text" size="20" maxlength="10" class="auto-style3" /></strong></span>
<span class="auto-style8"><strong> 3.白条核销<input name="mo2" type="text" size="20" maxlength="10" class="auto-style10" /></strong></span></td>
</tr>
<tr>
<td colspan="5" align="center" ><input type="submit" name="add" value=" 确认支出信息录入 " class="auto-style7" /></td>
</tr>
</form>
</table>
</body>
</html>请求帮改改。不知道什么搞了








