📄 addfinancialproject1.asp
字号:
<%@ Language=VBScript %>
<!--#include file="conn.asp"-->
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'判断用户是否具有财务管理员身份
if Session("IsFinancialManager")=False then
Response.Redirect "Finance.asp"
end if
Warning=false
'添加新财务项目
if not IsEmpty(Request.Form("AddProject")) then
TheFinancialProjectName=Request.Form("FinancialProjectName")
TheAddDate=Date
'校验用户是否是财务部门的主管
if Session("Department")="财务部" and Session("Position")="主管" then
'从列表中选择新财务项目的负责人
if Request.form("RadioFinancialManager")="FromList" then
TheFinancialManager=Request.form("SelectFinancialManager")
'校验用户的输入是否合乎要求
if len(trim(theFinancialProjectName))=0 then
TheMessage="财务项目名称不能为空,请重填新财务项目名称"
Warning=true
else
'向数据库添加新财务项目
conn.Execute(" insert into FinancialProject (FinancialProjectName, AddDate, FinancialManager) "_
& "values (" _
& "'" & TheFinancialProjectName &"', '" & TheAddDate &"', '" & TheFinancialManager & "') ")
TheMessage="财务项目已提交成功,请填写新财务项目"
Warning=false
end if
'用户自己输入新财务项目的负责人
else
Set RSDoExist=conn.execute("Select Name from UserInfo where Name='" _
& Request.form("TextFinancialManager")& "'")
'判断用户自己输入新财务项目的负责人是否存在
if RSDoExist.eof then
TheMessage="您输入的财务主管的姓名不存在(如果是新用户请添加用户信息)," _
& "无法添加财务项目。"
Warning=true
else
TheFinancialManager=RSDoExist("Name")
'向数据库添加新财务项目
conn.Execute(" insert into FinancialProject (FinancialProjectName, AddDate, FinancialManager) "_
& "values (" _
& "'" & TheFinancialProjectName &"', '" & TheAddDate &"', '" & TheFinancialManager & "') ")
TheMessage="财务项目已提交成功,请填写新财务项目"
Warning=false
end if
end if
else
TheMessage="您不是财务部主管,无权添加财务项目"
Warning=true
end if
'删除某个财务项目
elseif not IsEmpty(Request.Form("DeleteProject")) then
'判断用户是否是财务部门主管
if Session("Department")="财务部" and Session("Position")="主管" then
conn.execute("delete from FinancialProject where FinancialProjectID='"&Request.Form("RadioFinancialProject")&"'")
TheMessage="您已经删除了此财务项目"
else
TheMessage="您不是财务部主管,无权删除此财务项目"
Warning=true
end if
else
TheMessage = "请在下面填写新的财务项目"
end if
set RSPersons = conn.Execute("select Name from UserInfo order by Name")
set RSFinancialProjects=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 bgcolor=#9966FF cellspacing=1 cellpadding=2 align=center>
<tr bgcolor=white><td height="41" valign=center bgcolor="#9966FF" ><div align="center"><strong><font color="#FFFFFF" size="4">企业办公自动化系统</font></strong></div></td>
</tr>
</table>
<table width=800 border=0 bgcolor=#9933FF cellspacing=1 cellpadding=2 align=center>
<tr><td colspan=3>
<P ALIGN="CENTER"><font color="white">公司信息管理系统->公司财务管理系统->添加财务记录>添加财务项目当前用户:
<% response.write Session("Name") %>
</font>
</td></tr>
<tr bgcolor=white >
<td><a href=".././html/home.asp"><font color="#9900FF">返回主页</font></a></td>
<td align=center>
<% if Warning=false then %>
<font color="#9900FF" ><% response.write TheMessage %></FONT>
<% else %>
<font color=Red ><% response.write TheMessage %></font>
<% end if %>
</td>
<td align=right><a href="AddFinancialRecord.asp"><font color="#9933FF">返回上页</font></a></td>
</tr>
</table>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#16A84D" WIDTH=800 align=center>
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=20% bgcolor=#B5EFC7><img src="../image/HomepagePicture1.jpg" width="250" height="173"></td>
<td>
<table width="520" border="0">
<tr>
<td width="88"><div align="center">ID号</div></td>
<td width="110"><div align="center">项目名称</div></td>
<td width="99"><div align="center">添加时间</div></td>
<td width="99"><div align="center">项目主管</div></td>
<td width="102"><div align="center">删除</div></td>
</tr>
<tr>
<td><div align="center"><%=rs("FinancialProjectID")%></div></td>
<td><div align="center"><%=rs("FinancialProjectName")%></div></td>
<td><div align="center"><%=rs("AddDate")%></div></td>
<td><div align="center"><%=rs("FinancialManager")%></div></td>
<td><div align="center">删除</div></td>
</tr>
</table>
<FORM ACTION="AddFinancialProject.asp" METHOD=POST>
<table CELLPADDING=1 CELLSPACING=1 BORDER=1 bordercolor="#9966FF"align=center width=100%>
<tr><td width="109" ><div align="center">项目名称</div></td><td width="412"><INPUT TYPE="text" NAME="FinancialProjectName" VALUE="" size=50> </td></tr>
<tr>
<td><div align="center"><font color="#16A84D">主管姓名</font></div></td>
<td><table width=100% border=1>
<tr>
<td width=55%>
<INPUT TYPE="radio" Checked NAME="RadioFinancialManager" VALUE="FromList" >
<font color="#16A84D">选择此财务项目主管</font> </td>
<td>
<SELECT NAME="select" >
<%
Do Until RSPersons.EOF
%>
<OPTION VALUE="<% Response.Write RSPersons("Name") %>">
<% Response.Write RSPersons("Name") %>
</OPTION>
<%
RSPersons.Movenext
loop
%>
</SELECT>
</td>
</tr>
<tr>
<td>
<INPUT TYPE="radio" NAME="RadioFinancialManager" VALUE="Input" >
<font color="#16A84D">输入项目主管</font> </td>
<td>
<INPUT TYPE="text" NAME="TextFinancialManager2" VALUE="" >
</td>
</tr>
</table></td>
</tr>
<tr><td height="31" colspan="2"><input type="submit" name="AddProject" value="添加此项目">
<input type="submit" name="DeleteProject" value="删除此项目">
</td>
</tr>
</table>
</form>
</table>
/BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -