📄 cost_detail_save.asp
字号:
<!--#include file="sysconfig.asp"-->
<!--#include file="Inc/Config.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
server_vv=len(Request.ServerVariables("SERVER_NAME"))
server_v1=left(Cstr(Request.ServerVariables("HTTP_REFERER")),server_vv)
server_v2=left(Cstr("http://"&Request.ServerVariables("SERVER_NAME")),server_vv)
if server_v1<>server_v2 and server_v1<>"" and server_v2<>"" then
response.write("<script>alert('错误:禁止从站点外部提交数据!.')</script>")
response.end
end if
%>
<%
dim rs,sql,ErrMsg,FoundErr
dim id,guikou_id,danwei_id,xiangmu_id,cost_no,cost_number,pinmu,isok,admin,UpdateTime
FoundErr=false
id=Trim(Request.Form("id"))
guikou_id=trim(request.form("s1"))
danwei_id=trim(request.form("s2"))
xiangmu_id=trim(request.form("s3"))
cost_number=trim(request.form("cost_number"))
cost_no=trim(request.form("cost_no"))
pinmu=trim(request.form("pinmu"))
updatetime=trim(request.form("updatetime"))
admin=trim(request.form("admin"))
if request("isok")<>"" then
isok=1
else
isok=0
end if
if guikou_id="" then
founderr=true
errmsg=errmsg+"<li>未指定所属归口</li>"
end if
if danwei_id="" then
founderr=true
errmsg=errmsg+"<li>未指定所属单位</li>"
end if
if xiangmu_id="" then
founderr=true
errmsg=errmsg+"<li>未指定所属项目</li>"
end if
if cost_number="" then
founderr=true
errmsg="<li>金额不能为空</li>"
end if
if founderr=false then
if UpdateTime<>"" and IsDate(UpdateTime)=true then
UpdateTime=CDate(UpdateTime)
else
UpdateTime=now()
end if
set rs=server.createobject("adodb.recordset")
if request("action")="add" then
sql="select top 1 * from cost_detail"
rs.open sql,conn,1,3
rs.addnew
rs("cost_number_j")=0
rs("cost_number_r")=0
rs("admin_j")=admin
rs("admin_r")=admin
rs("UpdateTime_j")=now()
rs("UpdateTime_r")=now()
rs("isok")=0
rs("cost_delete")=0
rs.update
call SaveData()
rs.update
id=rs("id")
rs.close
set rs=nothing
elseif request("action")="Modify" then
if id<>"" then
sql="select * from cost_detail where id=" & id
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
call SaveData()
rs.update
rs.close
set rs=nothing
else
founderr=true
errmsg=errmsg+"<li>找不到,可能已经被其他人删除。</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>不能确定id的值</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
call WriteErrMsg()
end if
call CloseConn()
%>
<!-- #include file="Inc/Head.asp" -->
<BR>
<table cellpadding="2" cellspacing="1" border="0" width="510" align="center" class="a2">
<tr>
<td class="a1" height="25" align="center"><strong>添加 修改 支出</strong></td>
</tr>
<tr class="a4">
<td align="center">
<table class="border" align=center width="500" border="0" cellpadding="0" cellspacing="2" bordercolor="#999999">
<tr align=center bgcolor="#999999">
<td height="25" colspan="2" class="cost_no"><b>
<%if request("action")="add" then%>
添加
<%else%>
修改
<%end if%>
支出成功</b></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">预 算 ID:</td>
<td bgcolor="#E3E3E3"><%=id%></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">所属情况:</td>
<td bgcolor="#E3E3E3"> <%=guikou_id%>
<%set rsguikou=conn.execute("select * from guikou where id="&guikou_id&"")%> <%=rsguikou("guikou_name")%> <%=danwei_id%>
<%set rsdanwei=conn.execute("select * from danwei where id="&danwei_id&"")%> <%=rsdanwei("danwei_name")%> <%=xiangmu_id%>
<%set rsxiangmu=conn.execute("select * from xiangmu where id="&xiangmu_id&"")%> <%=rsxiangmu("xiangmu_name")%></td>
</tr>
<tr>
<td width="120" height="22" align="right" bgcolor="#C0C0C0">计认编号:</td>
<td width="374" bgcolor="#E3E3E3"><%=cost_no%></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">支出金额:</td>
<td bgcolor="#E3E3E3"><%=cost_number%> </td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">支出品目:</td>
<td bgcolor="#E3E3E3"><%=pinmu%> </td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">是否确认:</td>
<td bgcolor="#E3E3E3"><% if isok<>1 then%>
没有
<%else%> <%end if%>
确认</td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">添加人员:</td>
<td bgcolor="#E3E3E3"><%=admin%></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="#C0C0C0">录入时间:</td>
<td bgcolor="#E3E3E3"><%=updatetime%></td>
</tr>
<tr>
<td height="22" colspan="2" bgcolor="#E3E3E3" class="tdbg"> <p align="center">
【<a href="cost_detail_edit.asp?id=<%=id%>">修改或确认</a>】 【<a href="cost_detail_add.asp">继续添加支出</a>】 【<a href="cost_detail.asp">支出管理</a>】 </p></td>
</tr>
</table>
</td>
</tr>
</table>
<BR>
<%htmlend%>
<%
else
WriteErrMsg
end if
sub SaveData()
rs("guikou_id")=guikou_id
rs("danwei_id")=danwei_id
rs("xiangmu_id")=xiangmu_id
if isok=1 then
rs("cost_no_r")=cost_no
rs("cost_number_r")=cost_number
rs("pinmu_r")=pinmu
rs("isok")=isok
rs("admin_r")=admin
rs("UpdateTime_r")=UpdateTime
else
rs("cost_no_j")=cost_no
rs("cost_number_j")=cost_number
rs("pinmu_j")=pinmu
rs("isok")=isok
rs("admin_j")=admin
rs("UpdateTime_j")=UpdateTime
end if
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -