📄 overtakestat_c.ascx.cs
字号:
namespace Botheighten.Yanghui.Web.Controls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Botheighten.Yanghui.BusinessFacade;
using Botheighten.Yanghui.Framework;
using Botheighten.Yanghui.BusinessRules;
/// <summary>
/// OverTakeStat_C 的摘要说明。
/// </summary>
public abstract class OverTakeStat_C : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DataGrid grid;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// 设计器支持所需的方法 - 不要使用
/// 代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.grid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.grid_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
/// <summary>
/// 产品Id
/// </summary>
public string MId
{
set
{
this.ViewState["ID"] = value;
}
get
{
return this.ViewState["ID"].ToString ();
}
}
public string From
{
set
{this.ViewState["from"]=value;}
get
{return this.ViewState["from"].ToString();}
}
public double Amount
{
get
{
if(this.ViewState["AmountAll"].ToString()!="")
return double.Parse(this.ViewState["AmountAll"].ToString());
else
return 0;
}
}
public string End
{
set
{this.ViewState["end"]=value;}
get
{return this.ViewState["end"].ToString();}
}
public void Bind()
{
string id=this.ViewState["ID"].ToString();
string from=this.ViewState["from"].ToString();
string end=this.ViewState["end"].ToString();
if(id!="")
{
DataTable dt=InventorySystem.GetOverTakeStatDetail(id,from,end);
Common.ReSet(this.grid,dt.DefaultView);
this.ViewState["AmountAll"]=dt.Compute("sum(AllA)","LineId="+id).ToString();
this.ViewState["QuantityAll"]=dt.Compute("sum(AllQ)","").ToString();
this.grid.DataSource=dt;
this.grid.DataBind();
}
}
private void grid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.Item)
{
if(e.Item.ItemIndex==0)
e.Item.Cells[0].Text = LineSystem.GetLineCode(e.Item.Cells[0].Text.Trim());
else
e.Item.Cells[0].Text ="";
string mid=e.Item.Cells[1].Text.Trim();
e.Item.Cells[1].Text =MaterielSystem.GetMaterielCode(mid);
}
if(e.Item.ItemType==ListItemType.Footer)
{
e.Item.Cells[1].Text ="小计:";
e.Item.Cells[2].Text = this.ViewState["QuantityAll"].ToString();
e.Item.Cells[3].Text = this.ViewState["AmountAll"].ToString();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -