📄 sumdepreciationform.aspx.cs
字号:
//文件名:SumDepreciationForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class DepreciationManage_SumDepreciationForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("B3") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查询累计折旧
string MyConnectionString = ConfigurationManager.ConnectionStrings["MyAssetsDBConnectionString"].ConnectionString; ;
SqlConnection MyConnection = new SqlConnection(MyConnectionString);
MyConnection.Open();
DataTable MyQueryTable = new DataTable();
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 基本档案.使用部门";
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyQueryTable);
this.GridView1.DataSource = MyQueryTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印部门累计折旧汇总信息
Server.Transfer("~/DepreciationManage/SumDepreciationPrint.aspx");
}
public string MyPrintSQL
{//设置要传递到打印页的数据
get
{
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 基本档案.使用部门";
}
}
public String MyPrintDate
{//设置要传递到打印页的数据
get
{
return "计提日期:" + this.DropDownList1.SelectedValue.ToString() + "年" + this.DropDownList2.SelectedValue.ToString() + "月";
}
}
public String MyPrintTitle
{//设置要传递到打印页的数据
get
{
return Session["MyCompanyName"].ToString() + "月度累计折旧汇总表";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -