141 lines
5.1 KiB
C#
141 lines
5.1 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HSSE.CostGoods
|
|
{
|
|
public partial class CostManageView : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string CostManageId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["CostManageId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CostManageId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideRefreshReference();
|
|
string strProjectId = this.CurrUser.LoginProjectId;
|
|
this.CostManageId = Request.Params["CostManageId"] ?? SQLHelper.GetNewID();
|
|
var costManage = BLL.CostManageService.GetCostManageById(this.CostManageId);
|
|
if (costManage != null)
|
|
{
|
|
strProjectId = costManage.ProjectId;
|
|
this.drpUnit.Text = UnitService.GetUnitNameByUnitId(costManage.UnitId);
|
|
this.txtContractNum.Text = costManage.ContractNum;
|
|
this.txtCostManageDate.Text = string.Format("{0:yyyy-MM-dd}", costManage.CostManageDate);
|
|
this.txtProjectName.Text = ProjectService.GetProjectNameByProjectId(strProjectId);
|
|
this.txtHseCost.Text = ProjectUnitService.GetSumHSECost(strProjectId, costManage.UnitId).ToString();
|
|
this.txtGetCost.Text = CostManageService.GetSumHSECost(strProjectId, costManage.UnitId, this.CostManageId).ToString();
|
|
BindGrid();
|
|
BindGrid2();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 绑定Grid
|
|
/// <summary>
|
|
/// 绑定Grid
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
var costManageItems = BLL.CostManageItemService.GetCostManageItemByCostManageId(this.CostManageId);
|
|
this.Grid1.DataSource = costManageItems;
|
|
this.Grid1.PageIndex = 0;
|
|
this.Grid1.DataBind();
|
|
OutputSummaryData(costManageItems);
|
|
}
|
|
|
|
private void OutputSummaryData(List<Model.CostGoods_CostManageItem> getItem)
|
|
{
|
|
JObject summary = new JObject();
|
|
summary.Add("InvestCostProject", "本次申请合计金额(元)");
|
|
summary.Add("PriceMoney", getItem.Sum(x => x.PriceMoney ?? 0));
|
|
Grid1.SummaryData = summary;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region BindGrid2
|
|
/// <summary>
|
|
/// 绑定Grid
|
|
/// </summary>
|
|
private void BindGrid2()
|
|
{
|
|
var FlowOperates = from x in Funs.DB.CostGoods_CostManageFlowOperate
|
|
where x.CostManageId == this.CostManageId
|
|
select new
|
|
{
|
|
x.FlowOperateId,
|
|
x.CostManageId,
|
|
x.AuditFlowName,
|
|
x.SortIndex,
|
|
x.UnitId,
|
|
UnitName = Funs.DB.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
|
|
x.OperaterId,
|
|
OperaterName = Funs.DB.Person_Persons.First(u => u.PersonId == x.OperaterId).PersonName,
|
|
x.OperaterTime,
|
|
x.IsAgree,
|
|
x.Opinion,
|
|
x.IsClosed
|
|
};
|
|
|
|
this.Grid2.DataSource = FlowOperates.OrderByDescending(x => x.SortIndex);
|
|
this.Grid2.DataBind();
|
|
if (FlowOperates.FirstOrDefault(x => x.OperaterId != null) != null)
|
|
{
|
|
this.Grid2.Hidden = false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.CostManageId))
|
|
{
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageAttachUrl&menuId={1}&type=-1", this.CostManageId, BLL.Const.ProjectCostManageMenuId)));
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
} |