?? addfinancialproject.asp
字號(hào):
<%@ Language=VBScript %>
<%
'判斷用戶是否登錄
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'判斷用戶是否具有財(cái)務(wù)管理員身份
if Session("IsFinancialManager")=False then
Response.Redirect "Finance.asp"
end if
'連接系統(tǒng)數(shù)據(jù)庫(kù)
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
Warning=false
'添加新財(cái)務(wù)項(xiàng)目
if not IsEmpty(Request.Form("AddProject")) then
TheFinancialProjectName=Request.Form("FinancialProjectName")
TheAddDate=Date
'校驗(yàn)用戶是否是財(cái)務(wù)部門的主管
if Session("Department")="財(cái)務(wù)部" and Session("Position")="主管" then
'從列表中選擇新財(cái)務(wù)項(xiàng)目的負(fù)責(zé)人
if Request.form("RadioFinancialManager")="FromList" then
TheFinancialManager=Request.form("SelectFinancialManager")
'校驗(yàn)用戶的輸入是否合乎要求
if len(trim(FinancialProjectName))=0 then
TheMessage="財(cái)務(wù)項(xiàng)目名稱不能為空,請(qǐng)重填新財(cái)務(wù)項(xiàng)目名稱"
Warning=true
else
'向數(shù)據(jù)庫(kù)添加新財(cái)務(wù)項(xiàng)目
conn.Execute(" insert into FinancialProject (FinancialProjectName, AddDate, FinancialManager) "_
& "values (" _
& "'" & TheFinancialProjectName &"', '" & TheAddDate &"', '" & TheFinancialManager & "') ")
TheMessage="財(cái)務(wù)項(xiàng)目已提交成功,請(qǐng)?zhí)顚?xiě)新財(cái)務(wù)項(xiàng)目"
Warning=false
end if
'用戶自己輸入新財(cái)務(wù)項(xiàng)目的負(fù)責(zé)人
else
Set RSDoExist=conn.execute("Select Name from PSLogins where Name='" _
& Request.form("TextFinancialManager")& "'")
'判斷用戶自己輸入新財(cái)務(wù)項(xiàng)目的負(fù)責(zé)人是否存在
if RSDoExist.eof then
TheMessage="您輸入的財(cái)務(wù)主管的姓名不存在(如果是新用戶請(qǐng)?zhí)砑佑脩粜畔?," _
& "無(wú)法添加財(cái)務(wù)項(xiàng)目。"
Warning=true
else
TheFinancialManager=RSDoExist("Name")
'向數(shù)據(jù)庫(kù)添加新財(cái)務(wù)項(xiàng)目
conn.Execute(" insert into FinancialProject (FinancialProjectName, AddDate, FinancialManager) "_
& "values (" _
& "'" & TheFinancialProjectName &"', '" & TheAddDate &"', '" & TheFinancialManager & "') ")
TheMessage="財(cái)務(wù)項(xiàng)目已提交成功,請(qǐng)?zhí)顚?xiě)新財(cái)務(wù)項(xiàng)目"
Warning=false
end if
end if
else
TheMessage="您不是財(cái)務(wù)部主管,無(wú)權(quán)添加財(cái)務(wù)項(xiàng)目"
Warning=true
end if
'刪除某個(gè)財(cái)務(wù)項(xiàng)目
elseif not IsEmpty(Request.Form("DeleteProject")) then
'判斷用戶是否是財(cái)務(wù)部門主管
if Session("Department")="財(cái)務(wù)部" and Session("Position")="主管" then
conn.execute ("delete from FinancialProject where FinancialProjectID="_
& Request.Form("RadioFinancialProject"))
TheMessage="您已經(jīng)刪除了此財(cái)務(wù)項(xiàng)目"
else
TheMessage="您不是財(cái)務(wù)部主管,無(wú)權(quán)刪除此財(cái)務(wù)項(xiàng)目"
Warning=true
end if
else
TheMessage = "請(qǐng)?jiān)谙旅嫣顚?xiě)新的財(cái)務(wù)項(xiàng)目"
end if
set RSPersons = conn.Execute("select Name from PSLogins order by Name")
set RSFinancialProjects=conn.Execute("select * from FinancialProject order by FinancialProjectName")
%>
<HTML>
<HEAD>
<TITLE>公司財(cái)務(wù)信息管理系統(tǒng) </TITLE>
<META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<BODY BGCOLOR="">
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr bgcolor=white><td valign=center ><img src="../ASPLogo3.jpg" width=796 height=100></td></tr>
</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>
<br>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr><td colspan=3>
<font color=white>
<P ALIGN="CENTER">公司內(nèi)部辦公信息管理系統(tǒng)->公司財(cái)務(wù)信息管理系統(tǒng)->添加財(cái)務(wù)記錄 ->添加財(cái)務(wù)項(xiàng)目[當(dāng)前用戶-<% response.write Session("Name") %>]
</font></td></tr>
<tr bgcolor=white >
<td><a href=".././html/home.asp"><font color="#104DAD">返回內(nèi)網(wǎng)主頁(yè)</font></a></td>
<td align=center>
<% if Warning=false then %>
<font color="#104DAD" ><% response.write TheMessage %></FONT>
<% else %>
<font color=Red ><% response.write TheMessage %></font>
<% end if %>
</td>
<td align=right><a href="AddFinancialRecord.asp"><font color="#104DAD">返回上一級(jí)網(wǎng)頁(yè)</font></a></td>
</tr>
</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>
<br>
<FORM ACTION="AddFinancialProject.asp" METHOD=POST>
<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=2 BORDER=0 align=center width=100% bgcolor=#B5C7EF>
<tr><td >選中</td><td >財(cái)務(wù)項(xiàng)目ID</td><td>財(cái)務(wù)項(xiàng)目名稱</td><td>添加日期</td><td>項(xiàng)目主管</td></tr>
<%
Do Until RSFinancialProjects.eof
Response.write "<tr bgcolor=white><td><input type=radio name=RadioFinancialProject value=" & RSFinancialProjects("FinancialProjectID") & "></td>"
Response.write "<td>" & RSFinancialProjects("FinancialProjectID") & "</td>"
Response.write "<td>" & RSFinancialProjects("FinancialProjectName") & "</td>"
Response.write "<td>" & RSFinancialProjects("AddDate") & "</td>"
Response.write "<td>" & RSFinancialProjects("FinancialManager") & "</td>"
RSFinancialProjects.movenext
loop
%>
<table>
<br>
<table CELLPADDING=1 CELLSPACING=1 BORDER=1 align=center width=100%>
<tr><td >財(cái)務(wù)項(xiàng)目名稱</td><td><INPUT TYPE="text" NAME="FinancialProjectName" VALUE="" size=50> </td></tr>
<tr><td width=25%><font color="#164DA8">此財(cái)務(wù)項(xiàng)目主管姓名</font></td><td>
<table width=100% border=1>
<tr><td width=55%>
<INPUT TYPE="radio" Checked NAME="RadioFinancialManager" VALUE="FromList" ><font color="#164DA8">從列表中選擇此財(cái)務(wù)項(xiàng)目主管</font>
</td><td>
<SELECT NAME="SelectFinancialManager" >
<%
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="#164DA8">輸入此財(cái)務(wù)項(xiàng)目主管</font>
</td><td>
<INPUT TYPE="text" NAME="TextFinancialManager" VALUE="" >
</td></tr></table>
</td></tr>
</table>
</td>
</TR>
</table>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=800 align=center>
<TR VALIGN="top" ALIGN="center">
<TD WIDTH=100% align=center >
<INPUT TYPE="submit" NAME="AddProject" VALUE="添加此財(cái)務(wù)項(xiàng)目" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
<INPUT TYPE="submit" NAME="DeleteProject" VALUE="刪除此財(cái)務(wù)項(xiàng)目" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</TD>
</TD>
</TR>
</table>
<br>
</FORM>
</BODY>
</HTML>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -