⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 financialreport.asp

📁 办公自动化系统
💻 ASP
字号:
<%@ Language=VBScript %>
<!--#include file="conn.asp"-->
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if

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 UserInfo order by Name")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>

</HEAD>

<BODY BGCOLOR="">

<FORM ACTION="FinancialReport.asp"  METHOD=POST>
<% if Reportlabel=False  then %>
<table width="920" border="0" bordercolor="#16A84D" align="center" cellpadding="0" cellspacing="0">
<tr><td width="881" height="41" bgcolor="#9966FF"><div align="center"><font color="#FFFFFF" size="5"><strong>企业办公自动化系统</strong></font></div></td>
</tr></table>


<table width=920 border=0 bgcolor=#99CCFF cellspacing=1 cellpadding=2 align=center >
<tr bgcolor="#99CCFF"><td colspan=3>
<P ALIGN=CENTER><font color="#9900FF">企业</font><font color="#9900FF">信息管理系统->企业财务信息系统->生成财务报表当前用户:
    <% response.write Session("Name") %> 
    </font></td></tr>
<tr bgcolor=white >
<td><a href=../html/home.asp><font color=#9C00FF>返回主页</font></a></td>
<td  align=center> 
 <% if Warning=false then %>
 <font color="#9C00FF" ><% response.write TheMessage %></FONT>
 <% else %>
 <font color=Red ><% response.write TheMessage %></font>
 <% end if %>
</td>
<td  align=right><a href=Finance.asp><font color=#9C00FF>返回上页</font></a></td>
</tr></table> 
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor=#99CCFF WIDTH=920 align=center>
<TR VALIGN=center ALIGN=center>
<TD WIDTH=30% bgcolor="#99CCFF">
<img src="../image/HomepagePicture1.jpg" width="250" height="173"></td><td>

<table cellpadding=1 cellspacing=1 border=1 bordercolor=#9900FF align=center width=100%   >
<tr><td colspan=4 align=center bgcolor=#99CCFF><font color=#9900FF>报表类型</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>&nbsp</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=#9900FF align=center width=100%   >
<tr><td colspan=4 align=center bgcolor=#99CCFF><font color=#9900FF>排序方式</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=#9900FF align=center width=100%   >
<tr><td colspan=2 align=center bgcolor=#99CCFF><font color=#9900FF>期限</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) %>">p<% 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 %>p</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=920 align=center>
<TR VALIGN=top ALIGN=center><TD align=center >
<INPUT TYPE=submit NAME=Send VALUE=生成财务报表></td></td></table>

<%
end if
%>
                          
<br>

<% if ReportLabel=true then %>
<table width=920 border=0 bgcolor=#99CCFF cellspacing=1 cellpadding=2 align=center>
<tr><td width="855" bgcolor="#9900FF"><font color=white>
  <P ALIGN=CENTER><%response.write TheMessage%>
</font></td></tr>
<tr bgcolor=white ><td height="46"  align=center><table width=920 bgcolor=#9966FF border=0  cellspacing=1 cellpadding=2 align=center>
  <tr bgcolor="#9900FF">
<td width="36"><div align="center"><font color=white>ID</font></div></td>
<td width="53"><div align="center"><font color=white>经手人</font></div></td>
<td width="48"><div align="center"><font color=white>部门</font></div></td>
<td width="70"><font color=white>项目名称</font></td>
<td width="81" align=right><div align="center"><font color=white>款项A(元)</font></div></td>
<td width="81" align=right><div align="center"><font color=white>款项B(元)</font></div></td>
<td width="81" align=right><div align="center"><font color=white>款项C(元)</font></div></td>
<td width="81" align=right><div align="center"><font color=white>款项D(元)</font></div></td>
<td width="72" align=right><div align="center"><font color=white>合计(元)</font></div></td>
<td width="88"><div align="center"><font color=white>会计经手人</font></div></td>
<td width="89"><div align="center"><font color=white>日期</font></div></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><div align="center">合计</div></td><td><div align="center"></div></td><td><div align="center"></div></td><td><div align="center"></div></td><td align=right><div align="center">
        <% response.write SumFundTypeA %>
</div></td><td align=right><div align="center">
        <% response.write SumFundTypeB %>
</div></td><td align=right><div align="center">
        <% response.write SumFundTypeC %>
</div></td><td align=right><div align="center">
      <% response.write SumFundTypeD %>
</div></td><td align=right><div align="center">
      <% response.write SumSum %>
</div></td><td><div align="center"></div></td><td><div align="center"></div></td></tr>
</table></td></tr></table>
<p align=center>
<input type=submit name=GoBack value=生成新报表> 
</p>
<%
end if
%>                          

</FORM>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -