温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:固定资产管理系统源码
当前文件路径:DepreciationManage/DepreciationManage/SumDepreciationForm.aspx.cs

1//文件名:SumDepreciationForm.aspx.cs 2
using System; 3
using System.Data; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
13
using System.Data.SqlClient; 14
public partial class DepreciationManage_SumDepreciationForm : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
string MyForbidString = Session["MyForbid"].ToString(); 19
if (MyForbidString.IndexOf("B3") > 1) 20
{ 21
Server.Transfer("~/SystemManage/AllErrorHelp.aspx"); 22
} 23
} 24
protected void Button1_Click(object sender, EventArgs e) 25
{//查询累计折旧 26
string MyConnectionString = ConfigurationManager.ConnectionStrings["MyAssetsDBConnectionString"].ConnectionString; ; 27
SqlConnection MyConnection = new SqlConnection(MyConnectionString); 28
MyConnection.Open(); 29
DataTable MyQueryTable = new DataTable(); 30
string MySQL = "SELECT 基本档案.使用部门 AS 使用部门, SUM(基本档案.资产原值) AS 资产原值, SUM(基本档案.累计折旧) AS 累计折旧, SUM(累计折旧表.月度折旧额) AS 月度折旧额 FROM 基本档案 INNER JOIN 累计折旧表 ON 基本档案.资产编号 = 累计折旧表.资产编号 WHERE (折旧年份 =" + this.DropDownList1.SelectedValue.ToString() + ") AND (折旧月份=" + this.DropDownList2.SelectedValue.ToString() + ") GROUP BY 基本档案.使用部门"; 31
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection); 32
MyAdapter.Fill(MyQueryTable); 33
this.GridView1.DataSource = MyQueryTable; 34
this.GridView1.DataBind(); 35
if (MyConnection.State == ConnectionState.Open) 36
{ 37
MyConnection.Close(); 38
} 39
} 40
protected void Button2_Click(object sender, EventArgs e) 41
{//打印部门累计折旧汇总信息 42
Server.Transfer("~/DepreciationManage/SumDepreciationPrint.aspx"); 43
} 44
public string MyPrintSQL 45
{//设置要传递到打印页的数据 46
get 47
{ 48
return "SELECT 基本档案.使用部门 AS 使用部门, SUM(基本档案.资产原值) AS 资产原值, SUM(基本档案.累计折旧) AS 累计折旧, SUM(累计折旧表.月度折旧额) AS 月度折旧额 FROM 基本档案 INNER JOIN 累计折旧表 ON 基本档案.资产编号 = 累计折旧表.资产编号 WHERE (折旧年份 =" + this.DropDownList1.SelectedValue.ToString() + ") AND (折旧月份=" + this.DropDownList2.SelectedValue.ToString() + ") GROUP BY 基本档案.使用部门"; 49
} 50
} 51
public String MyPrintDate 52
{//设置要传递到打印页的数据 53
get 54
{ 55
return "计提日期:" + this.DropDownList1.SelectedValue.ToString() + "年" + this.DropDownList2.SelectedValue.ToString() + "月"; 56
} 57
} 58
public String MyPrintTitle 59
{//设置要传递到打印页的数据 60
get 61
{ 62
return Session["MyCompanyName"].ToString() + "月度累计折旧汇总表"; 63
} 64
} 65
} 66





}
}