📄 financialreport.asp
字号:
<%@ Language=VBScript %>
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
ReportLabel=False
Warning=false
'判断当前页面状态是否是报表状态
if not IsEmpty(Request.Form("GoBack")) then
ReportLabel=False
end if
'生成报表
if not IsEmpty(Request.Form("Send")) then
'报表的排序方式
if Request.Form("ReportOrder")="Name" then
TheOrder="姓名"
elseif Request.Form("ReportOrder")="ProjectName" then
TheOrder="财务项目名称"
elseif Request.Form("ReportOrder")="AccountName" then
TheOrder="会计经手人"
else
TheOrder="记录添加日期"
end if
'报表是否有时间期限
if Request.Form("DateLimit")="Yes" then
StartDate=Request.Form("StartYear") & "-" & Request.Form("StartMonth") _
& "-" & Request.Form("StartDay")
EndDate= Request.Form("EndYear") & "-" & Request.Form("EndMonth") _
& "-" & Request.Form("EndDay")
TheTimeLimit="时间期限:从" & CStr(StartDate) & "到" & Cstr(EndDate) & " "
else
StartDate="1900-1-1"
EndDate="2100-1-1"
TheTimeLimit="时间期限:无 "
end if
'生成总流水帐报表
if Request.Form("FinancialReportType") = "AllFinancialRecord" then
if Session("Position")="经理" or (Session("Department")="财务部" and _
Session("Position")="主管") then
SqlString="select * from FinancialRecord where AddDate >=#" & StartDate _
& "# and AddDate<=#" & EndDate & "# order by " & Request.Form("ReportOrder")
Set RSAllFinancialRecord = conn.Execute(SqlString)
TheMessage = TheTimeLimit & "总流水帐报表按-" & TheOrder & "-排序如下"
label=true
ReportLabel=True
else
TheMessage="您不是[经理/财务部主管],无权生成总流水帐报表"
Warning=true
end if
'生成部门财务报表
elseif Request.Form("FinancialReportType") = "DepartmentFinancialRecord" then
if Session("Position")="经理" or (Session("Department")=Request.Form("DepartmentName") and _
Session("Position")="主管") then
Set RSAllFinancialRecord = conn.Execute("select * from FinancialRecord where Department = '" _
& Request.Form("DepartmentName") & "' and AddDate >=#" & StartDate & "# and AddDate<=#" _
& EndDate & "# order by " & Request.Form("ReportOrder"))
ReportLabel=true
TheMessage = TheTimeLimit & "部门-" & Request.Form("DepartmentName") & "-财务报表按-" _
& TheOrder & "-排序如下"
else
TheMessage="您不是[经理/此部门主管],无权生成部门财务报表"
Warning=true
end if
'生成项目财务报表
elseif Request.Form("FinancialReportType") = "FinancialProjectReport" then
Set RSFinancailManager=conn.execute("select FinancialManager from FinancialProject " _
& "where FinancialProjectName='"& Request.Form("ProjectName") & "'")
if Session("Name")=RSFinancailManager("FinancialManager") or Session("Position")="经理" then
Set RSAllFinancialRecord = conn.Execute("select * from FinancialRecord where ProjectName = '" _
& Request.Form("ProjectName") & "' and AddDate >=#" & StartDate & "# and AddDate<=#" _
& EndDate & "#order by " & Request.Form("ReportOrder"))
ReportLabel=true
TheMessage = TheTimeLimit & "项目-" & Request.Form("ProjectName") & "-财务报表按-" _
& TheOrder & "-排序如下"
else
TheMessage="您不是[经理 /此财务项目主管],无权生成总流水帐报表"
Warning=true
end if
'生成个人财务报表
else
if Session("Position")="经理" or Session("Name")=Request.Form("Person") then
Set RSAllFinancialRecord = conn.Execute("select * from FinancialRecord where Name = '" _
& Request.Form("Person") & "' and AddDate >=#" & StartDate & "# and AddDate<=#" & EndDate _
& "#order by " & Request.Form("ReportOrder"))
'Set RSAllFinancialRecord = conn.Execute("select * from FinancialRecord where Name = '" _
'& Request.Form("Person") & "' and AddDate>='" & StartDate & "' and AddDate<='" & EndDate _
'& "' order by " & Request.Form("ReportOrder"))
ReportLabel=true
TheMessage = TheTimeLimit & "用户-" & Request.Form("Person") & "-个人财务报表按-" _
& TheOrder & "-排序如下"
TheMessage="select * from FinancialRecord where Name = '" _
& Request.Form("Person") & "' and AddDate>='" & StartDate & "' and AddDate<='" & EndDate _
& "' order by " & Request.Form("ReportOrder")
else
TheMessage="您不是[经理/此个用户],无权生成此用户个人财务报表"
Warning=true
end if
end if
else
TheMessage = "请选择您要生成的报表类型"
end if
set RSDepartments = conn.Execute("select DepartmentName from Departments "_
& "order by DepartmentName")
set RSProjectName = conn.Execute("select * from FinancialProject order by FinancialProjectName")
set RSPerson = conn.Execute("select Name from PSLogins order by Name")
%>
<HTML>
<HEAD>
<TITLE>公司财务信息管理系统 </TITLE><META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<BODY BGCOLOR="">
<FORM ACTION="FinancialReport.asp" METHOD=POST>
<% if Reportlabel=False then %>
<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>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center >
<tr><td colspan=3>
<font color=white>
<P ALIGN=CENTER>公司内部办公信息管理系统->公司财务信息管理系统->生成财务报表 [当前用户- <% response.write Session("Name") %> ]
</font></td></tr>
<tr bgcolor=white >
<td><a href=.././html/home.asp><font color=#104DAD>返回内网主页</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=Finance.asp><font color=#104DAD>返回上一级网页</font></a></td>
</tr></table>
<table width=800 border=0 bordercolor=#164DA8 align=center cellpadding=0 cellspacing=0>
<tr><td height=10 colspan=4 valign=top bgcolor=#FFFFFF>
<img src=.././image/banner2.jpg width=800 height=12>
</td></tr></table>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor=#164DA8 WIDTH=800 align=center>
<TR VALIGN=center ALIGN=center>
<TD WIDTH=35% bgcolor=#B5C7EF>
<img src=../image/finance1.jpg></td><td>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=100% >
<tr><td colspan=4 align=center bgcolor=#B5C7EF><font color=#164DA8>报表类型</font></td>
</td></tr>
<tr><td ><INPUT TYPE=radio CHECKED NAME=FinancialReportType VALUE=AllFinancialRecord >总流水帐报表 </td>
<td><INPUT TYPE=radio NAME=FinancialReportType VALUE=DepartmentFinancialRecord >部门财务报表 </td>
<td><INPUT TYPE=radio NAME=FinancialReportType VALUE=FinancialProjectReport >项目财务报表 </td>
<td><INPUT TYPE=radio NAME=FinancialReportType VALUE=PersonalFinancialReport>个人财务报表</td>
</tr>
<tr><td> </td>
<td><SELECT NAME=DepartmentName >
<%
Do Until RSDepartments.EOF
Response.Write "<OPTION VALUE=" & RSDepartments("DepartmentName") & ">" & RSDepartments("DepartmentName") & "</OPTION>"
RSDepartments.Movenext
loop
Response.Write "</SELECT></td>"
Response.Write "<td><SELECT NAME=ProjectName >"
Do Until RSProjectName.EOF
Response.Write "<OPTION VALUE=" & RSProjectName("FinancialProjectName") & ">" & RSProjectName("FinancialProjectName") & "</OPTION>"
RSProjectName.Movenext
loop
%>
</SELECT></td>
<td><SELECT NAME=Person >
<%
Do Until RSPerson.EOF
Response.Write "<OPTION VALUE=" & RSPerson("Name") & ">" & RSPerson("Name") & "</OPTION>"
RSPerson.Movenext
loop
%>
</SELECT></td>
<tr>
</table><br>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=100% >
<tr><td colspan=4 align=center bgcolor=#B5C7EF><font color=#164DA8>排序方式</font></td>
</td></tr>
<tr><td><INPUT TYPE=radio CHECKED NAME=ReportOrder VALUE=Name >按经手人姓名排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=ProjectName >按项目排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=AccountName >按会计经手人排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=AddDate>按日期排序</td>
</tr>
</table><br>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=100% >
<tr><td colspan=2 align=center bgcolor=#B5C7EF><font color=#164DA8>时间期限</font></td></tr>
<tr><td><INPUT TYPE=radio CHECKED NAME=DateLimit VALUE=No >无时间限制 </td><td> </td></tr>
<tr><td><INPUT TYPE=radio NAME=DateLimit VALUE=Yes>有时间期限</td>
<td>
<table border=1 width=100%>
<tr><td>开始时间</td>
<td>
<select name="StartYear" 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>年
</td>
<td>
<select name="StartMonth" 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>
月</td>
<td>
<select name="StartDay" 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>
<tr><td>截至时间</td><td>
<select name="EndYear" 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>年</td><td>
<select name="EndMonth" 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>月</td><td>
<select name="EndDay" 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>
</td>
</tr>
</table>
</td></tr></table>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=800 align=center>
<TR VALIGN=top ALIGN=center><TD align=center >
<INPUT TYPE=submit NAME=Send VALUE=生成财务报表 style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</td></td></table>
<%
end if
%>
<br>
<% if ReportLabel=true then %>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr><td><font color=white><P ALIGN=CENTER><% response.write TheMessage %>
</font></td></tr>
<tr bgcolor=white ><td align=center><table width=800 bgcolor=#164DA8 border=0 cellspacing=1 cellpadding=2 align=center><tr>
<td><font color=white>记录ID</font></td>
<td><font color=white>经手人姓名</font></td>
<td><font color=white>部门</font></td>
<td><font color=white>财务项目名称</font></td>
<td align=right><font color=white>款项A(元)</font></td>
<td align=right><font color=white>款项B(元)</font></td>
<td align=right><font color=white>款项C(元)</font></td>
<td align=right><font color=white>款项D(元)</font></td>
<td align=right><font color=white>合计(元)</font></td>
<td><font color=white>会计经手人</font></td>
<td><font color=white>添加日期</font></td></tr>
<%
if not IsEmpty(RSAllFinancialRecord) then
SumFundTypeA=0
SumFundTypeB=0
SumFundTypeC=0
SumFundTypeD=0
SumSum=0
do Until RSAllFinancialRecord.eof
Response.write "<tr bgcolor=white><td>" & RSAllFinancialRecord("ID") & "</td><td>" _
& RSAllFinancialRecord("Name") & "</td><td>" _
& RSAllFinancialRecord("Department") & "</td><td>" _
& RSAllFinancialRecord("ProjectName") & "</td><td align=right>" _
& RSAllFinancialRecord("FundTypeA") & "</td><td align=right>" _
& RSAllFinancialRecord("FundTypeB") & "</td><td align=right>" _
& RSAllFinancialRecord("FundTypeC") & "</td><td align=right>" _
& RSAllFinancialRecord("FundTypeD") & "</td><td align=right>" _
& RSAllFinancialRecord("Sum") & "</td><td>" _
& RSAllFinancialRecord("AccountName") & "</td><td>" _
& RSAllFinancialRecord("AddDate") & "</td></tr>"
SumFundTypeA=SumFundTypeA+RSAllFinancialRecord("FundTypeA")
SumFundTypeB=SumFundTypeB+RSAllFinancialRecord("FundTypeB")
SumFundTypeC=SumFundTypeC+RSAllFinancialRecord("FundTypeC")
SumFundTypeD=SumFundTypeD+RSAllFinancialRecord("FundTypeD")
SumSum=SumSum+RSAllFinancialRecord("Sum")
RSAllFinancialRecord.Movenext
Loop
end if
%>
<tr bgcolor=white><td>合计</td><td> </td><td> </td><td> </td><td align=right><% response.write SumFundTypeA %></td><td align=right><% response.write SumFundTypeB %></td><td align=right><% response.write SumFundTypeC %></td><td align=right><% response.write SumFundTypeD %></td><td align=right><% response.write SumSum %></td><td> </td><td> </td></tr>
</table></td></tr></table>
<p align=center>
<input type=submit name=GoBack value=  生成新报表   style="border: 1px solid #3466BB; background-color: #FFFFFF; color: #3466BB">  
</p>
<%
end if
%>
</FORM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -