📄 modifyfinancialrecord.asp
字号:
<%@ Language=VBScript %>
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'判断用户是否具有财务管理员身份
if Session("IsFinancialManager")=False then
Response.Redirect "Finance.asp"
end if
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
Warning=false
'查询某个财务记录
if not IsEmpty(Request.Form("Query")) then
'获得用户的查询条件
if Request.Form("QueryCheck1")="on" and len(trim(Request.Form("FinancialRecordID")))<>0 then
sql1="and ID=" & Request.Form("FinancialRecordID")
else
sql1=" "
end if
if Request.Form("QueryCheck2")="on" and len(trim(Request.Form("FinancialProjectName")))<>0 then
sql2=" and ProjectName='" & Request.Form("FinancialProjectName") & "'"
else
sql2=" "
end if
if Request.Form("QueryCheck3")="on" then
sql3=" and Name='" & Request.Form("SelectName") & "'"
else
sql3=" "
end if
if Request.Form("QueryCheck4")="on" then
TheAddDate=Request.Form("AddYear") &"-" & Request.Form("AddMonth") & "-" _
& Request.Form("AddDay")
sql4=" and AddDate=#"& TheAddDate &"# "
else
sql4=" "
end if
set RSRecordResult=conn.Execute("select * from FinancialRecord where AccountName='" _
& Session("Name") &"' " & sql1 & sql2 & sql3 & sql4 &" order by Name")
TheMessage="您查询的财务记录如下"
QueryLabel=2
'用户选定了查询出来的某个财务记录
elseif not IsEmpty(Request.Form("SelectRecord")) then
TheMessage="请在下面修改此条财务记录"
set RSThisRecord=conn.Execute("select * from FinancialRecord" _
& " where ID="&Request.Form("RadioFinancialRecord"))
QueryLabel=3
'用户对选定的财务记录进行了更新
elseif not IsEmpty(Request.Form("UpdateRecord")) then
'校验用户的输入
if not IsNumeric(Request.Form("UpdateFundTypeA")) or _
not IsNumeric(Request.Form("UpdateFundTypeB")) or _
not IsNumeric(Request.Form("UpdateFundTypeC")) or _
not IsNumeric(Request.Form("UpdateFundTypeD")) then
TheMessage="记录中的款项字段中出现了非数字内容,无法修改此记录,请重填记录"
Warning=true
QueryLabel=3
else
set RSLinkedDepartment=conn.Execute("select Department from PSLogins where Name='" _
& Request.Form("UpdateName") & "'")
TheName=Request.Form("UpdateName")
TheDepartment=RSLinkedDepartment("Department")
TheProjectName=Request.Form("UpdateProjectName")
TheFundTypeA=CCur(Request.Form("UpdateFundTypeA"))
TheFundTypeB=CCur(Request.Form("UpdateFundTypeB"))
TheFundTypeC=CCur(Request.Form("UpdateFundTypeC"))
TheFundTypeD=CCur(Request.Form("UpdateFundTypeD"))
TheSummary=Cstr(Request.Form("UpdateSummary"))
TheRemark=Cstr(Request.Form("UpdateRemark"))
TheModifyDate=Date
TheSum=CCur(TheFundTypeA+TheFundTypeB+TheFundTypeC+TheFundTypeD)
'修改此条财务记录
conn.execute "update FinancialRecord set "_
& "Name='" & TheName & "', "_
& "Department='" & TheDepartment & "', "_
& "FundTypeA='" & TheFundTypeA & "', "_
& "FundTypeB='" & TheFundTypeB & "', "_
& "FundTypeC='" & TheFundTypeC & "', "_
& "FundTypeD='" & TheFundTypeD & "', "_
& "Sum='" & TheSum & "', "_
& "Summary='" & TheSummary & "', "_
& "Remark='" & TheRemark & "', "_
& "ModifyDate='" & TheModifyDate & "', "_
& "ProjectName='" & TheProjectName & "' " _
& " Where ID=" & Request.Form("UpdateID")
QueryLabel=3
TheMessage="记录已经修改成功"
end if
set RSThisRecord=conn.Execute("select * from FinancialRecord where ID="&Request.Form("UpdateID"))
else
TheMessage = "请在下面填写您要修改的财务记录的查询条件"
QueryLabel=1
end if
set RSPersons = conn.Execute("select Name from PSLogins order by Name")
set RSFinancialRecord=conn.Execute("select * from FinancialRecord where AccountName='" _
& Session("Name") & "' order by Name")
set RSFinancialProject=conn.Execute("select * from FinancialProject order by FinancialProjectName")
%>
<HTML>
<HEAD>
<TITLE>公司财务信息管理系统 </TITLE>
<META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<BODY BGCOLOR="">
<table width=800 border=0 align=center cellpadding=2 cellspacing=1 bordercolor="#996633" bgcolor=#164DA8>
<tr bgcolor=white>
<td valign=center bgcolor="#0066CC" >
<div align="center"><font color="#CCCCCC" size="+7" face="华文隶书"><strong>公司内部办公信息管理系统</strong></font></div></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13"> </td>
</tr>
</table>
<br>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr>
<td colspan=3> <font color=white>
<P ALIGN="CENTER"><font size="2">公司内部办公信息管理系统->公司财务信息管理系统->修改财务记录 [当前用户-
<% response.write Session("Name") %>
] </font></font></td>
</tr>
<tr bgcolor=white >
<td><a href=".././html/home.asp"><font color="#104DAD" size="2">返回内网主页</font></a></td>
<td align=center> <font size="2">
<% if Warning=false then %>
<font color="#104DAD" >
<% response.write TheMessage %>
</FONT></font> <font size="2">
<% else %>
<font color=Red >
<% response.write TheMessage %>
</font></font> <font size="2">
<% end if %>
</font></td>
<td align=right><a href="Finance.asp"><font color="#104DAD" size="2">返回上一级网页</font></a></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13"> </td>
</tr></table>
<br>
<FORM ACTION="ModifyFinancialRecord.asp" METHOD=POST>
<% if QueryLabel=1 then %>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#164DA8" WIDTH=800 align=center>
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=20% bgcolor=#B5C7EF> </td>
<td>
<table CELLPADDING=1 CELLSPACING=1 BORDER=1 align=center width=100% bgcolor=White>
<tr height=35>
<td><input type=checkbox name=QueryCheck1 ></td>
<td ><font size="2">财务记录ID</font></td>
<td><INPUT TYPE="text" NAME="FinancialRecordID" VALUE="" size=50>
</td>
</tr>
<tr height=35>
<td><input type=checkbox name=QueryCheck2></td>
<td ><font size="2">财务项目名称</font></td>
<td><INPUT TYPE="text" NAME="FinancialProjectName" VALUE="" size=50>
</td>
</tr>
<tr height=35>
<td><input type=checkbox name=QueryCheck3 ></td>
<td width=25%><font color="#164DA8" size="2">财务记录经手人</font></td>
<td> <SELECT NAME="SelectName" >
<%
Do Until RSPersons.EOF
%>
<OPTION VALUE="<% Response.Write RSPersons("Name") %>">
<% Response.Write RSPersons("Name") %>
</OPTION>
<%
RSPersons.Movenext
loop
%>
</SELECT> </td>
</tr>
<tr height=35>
<td><input type=checkbox name=QueryCheck4></td>
<td width=25%><font color="#164DA8" size="2">财务记录添加日期</font></td>
<td> <select name="AddYear" size=1>
<OPTION VALUE="<% Response.Write Year(Date) %>">  
<% Response.Write Year(Date) %>
  </OPTION>
<%
YearCounter = 2050
Do until YearCounter <=1990
%>
<OPTION VALUE="<% Response.Write YearCounter %>">  
<% Response.Write YearCounter %>
  </OPTION>
<%
YearCounter = YearCounter-1
loop
%>
</select>
年
<select name="AddMonth" size=1>
<OPTION VALUE="<% Response.Write Month(Date) %>">  
<% Response.Write Month(Date) %>
  </OPTION>
<%
MonthCounter = 12
Do until MonthCounter <=0
%>
<OPTION VALUE="<% Response.Write MonthCounter %>">  
<% Response.Write MonthCounter %>
  </OPTION>
<%
MonthCounter = MonthCounter-1
loop
%>
</select>
月
<select name="AddDay" size=1>
<OPTION VALUE="<% Response.Write Day(Date) %>">  
<% Response.Write Day(Date) %>
  </OPTION>
<%
DayCounter = 31
Do until DayCounter <=0
%>
<OPTION VALUE="<% Response.Write DayCounter %>">  
<% Response.Write DayCounter %>
  </OPTION>
<%
DayCounter = DayCounter-1
loop
%>
</select>
日 </td>
</tr>
</table>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=100% align=center>
<TR VALIGN="top" ALIGN="center">
<TD WIDTH=100% align=center >
<INPUT TYPE="submit" NAME="Query" VALUE="查询符合条件的财务记录" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</TD></TR></table>
</td></TR></table>
<br>
<% end if %>
<% if QueryLabel=2 then %>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr>
<td><font color=white size="2">选中</font></td>
<td><font color=white size="2">记录ID</font></td>
<td><font color=white size="2">记录经手人</font></td>
<td><font color=white size="2">部门</font></td>
<td><font color=white size="2">所属财务项目</font></td>
<td><font color=white size="2">款项A</font></td>
<td><font color=white size="2">款项B</font></td>
<td><font color=white size="2">款项C</font></td>
<td><font color=white size="2">款项D</font></td>
<td><font color=white size="2">合计</font></td>
<td><font color=white size="2">添加日期</font></td>
<td><font color=white size="2">最新修改日期</font></td>
</tr>
<%
Do until RSRecordResult.eof
response.write "<tr bgcolor=white><td><input type=radio name=RadioFinancialRecord value=" & RSRecordResult("ID") & "></td>"
response.write "<td>" & RSRecordResult("ID") & "</td>"
response.write "<td>" & RSRecordResult("Name") & "</td>"
response.write "<td>" & RSRecordResult("Department") & "</td>"
response.write "<td>" & RSRecordResult("ProjectName") & "</td>"
response.write "<td>" & RSRecordResult("FundTypeA") & "</td>"
response.write "<td>" & RSRecordResult("FundTypeB") & "</td>"
response.write "<td>" & RSRecordResult("FundTypeC") & "</td>"
response.write "<td>" & RSRecordResult("FundTypeD") & "</td>"
response.write "<td>" & RSRecordResult("Sum") & "</td>"
response.write "<td>" & RSRecordResult("AddDate") & "</td>"
response.write "<td>" & RSRecordResult("ModifyDate") & "</td></tr>"
RSRecordResult.Movenext
loop
%>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src=".././image/banner2.jpg" width="800" height="12"></td> </tr></table>
<p align=center>
<input type=submit name=SelectRecord value=  选中某条财务记录   style="border: 1px solid #3466BB; background-color: #FFFFFF; color: #3466BB">
<% end if %>
<% if QueryLabel=3 then %>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#164DA8" WIDTH=800 align=center>
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=20% bgcolor=#B5C7EF><img src="../image/finance1.jpg"></td>
<td>
<table CELLPADDING=1 CELLSPACING=1 BORDER=1 align=center width=100%>
<tr>
<td width=30%><font size="2">财务记录号</font></td>
<td> <% response.write RSThisRecord("ID") %> <input name=UpdateID type=hidden value="<% response.write RSThisRecord("ID") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">财务记录添加日期</font></td>
<td> <% response.write RSThisRecord("AddDate") %> </td>
</tr>
<tr>
<td width=30%><font size="2">经手人</font></td>
<td> <Select name=UpdateName>
<option value="<% response.write RSThisRecord("Name") %>">
<% response.write RSThisRecord("Name") %>
</option>
<%
Do until RSPersons.eof
response.write "<option value=" & RSPersons("Name") & ">"& RSPersons("Name") &"</option>"
RSPersons.movenext
loop
%>
</select> </td>
</tr>
<tr>
<td width=30%><font size="2">所属财务项目</font></td>
<td> <Select name=UpdateProjectName>
<option value="<% response.write RSThisRecord("ProjectName") %>">
<% response.write RSThisRecord("ProjectName") %>
</option>
<%
Do until RSFinancialProject.eof
response.write "<option value=" & RSFinancialProject("FinancialProjectName") & ">"& RSFinancialProject("FinancialProjectName") &"</option>"
RSFinancialProject.movenext
loop
%>
</select> </td>
</tr>
<tr>
<td width=30%><font size="2">款项A</font></td>
<td><input name=UpdateFundTypeA value="<% response.write RSThisRecord("FundTypeA") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">款项B</font></td>
<td><input name=UpdateFundTypeB value="<% response.write RSThisRecord("FundTypeB") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">款项C</font></td>
<td><input name=UpdateFundTypeC value="<% response.write RSThisRecord("FundTypeC") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">款项D</font></td>
<td><input name=UpdateFundTypeD value="<% response.write RSThisRecord("FundTypeD") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">摘要</font></td>
<td><input name=UpdateSummary value="<% response.write RSThisRecord("Summary") %>">
</td>
</tr>
<tr>
<td width=30%><font size="2">备注</font></td>
<td><input name=UpdateRemark value="<% response.write RSThisRecord("Remark") %>">
</td>
</tr>
</table>
<p align=center>
<input type=submit name=UpdateRecord value=  修改此条财务记录   style="border: 1px solid #3466BB; background-color: #FFFFFF; color: #3466BB">
<% end if %>
<br>
</FORM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -