📄 partsubtractprint.aspx.cs
字号:
//文件名:PartSubtractPrint.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 PartManage_PartSubtractPrint : System.Web.UI.Page
{
private PartManage_PartSubtractForm MyQueryForm;
protected void Page_Load(object sender, EventArgs e)
{//将查询结果输出到Excel文件中
this.Label1.Text = Session["MyServiceName"].ToString() + "家电修理配件领用单";
MyQueryForm = (PartManage_PartSubtractForm)Context.Handler;
this.Label3.Text = "维修编号:"+MyQueryForm.MyPrint维修编号;
this.Label4.Text = "客户名称:" + MyQueryForm.MyPrint客户名称;
this.Label5.Text = "客户电话:" + MyQueryForm.MyPrint客户电话;
this.Label7.Text = "产品品牌:" + MyQueryForm.MyPrint产品品牌;
this.Label8.Text = "产品型号:" + MyQueryForm.MyPrint产品型号;
DataTable MyTable = new DataTable();
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyServiceDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
string MySQL = "SELECT 配件编号,配件名称,规格型号,计量单位,领用数量,计费单价,计费金额,领用人员,领用日期 FROM [配件领用] WHERE ([维修编号]='" + MyQueryForm.MyPrint维修编号 + "')";
MyConnection.Open();
SqlDataAdapter MyAdatper = new SqlDataAdapter(MySQL, MyConnection);
MyAdatper.Fill(MyTable);
this.GridView1.DataSource = MyTable;
this.GridView1.DataBind();
MySQL = "Select Sum(计费金额) FROM [配件领用] WHERE ([维修编号]='" + MyQueryForm.MyPrint维修编号 + "')";
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
this.Label2.Text = "配件领用合计金额:" + MyCommand.ExecuteScalar().ToString() + "元";
if (MyConnection.State == ConnectionState.Open)
MyConnection.Close();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{//在GridView控件单元格中设置短日期显示格式
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime MyDate = DateTime.Parse(e.Row.Cells[8].Text);
e.Row.Cells[8].Text = MyDate.ToShortDateString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -