134 lines
6.4 KiB
C#
134 lines
6.4 KiB
C#
using BLL;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.CNCCG.HSSE.CostGoods
|
|
{
|
|
public partial class CostSmallDetailView : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string CostSmallDetailId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["CostSmallDetailId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["CostSmallDetailId"] = value;
|
|
}
|
|
}
|
|
public static List<Model.HSSECostSmallDetailOutput> hSSECostSmallDetailOutputs = new List<HSSECostSmallDetailOutput>();
|
|
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
|
|
this.CostSmallDetailId = Request.Params["CostSmallDetailId"];
|
|
if (hSSECostSmallDetailOutputs != null)
|
|
{
|
|
hSSECostSmallDetailOutputs = new List<Model.HSSECostSmallDetailOutput>();
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(this.CostSmallDetailId))
|
|
{
|
|
Model.CostGoods_CostSmallDetail costSmallDetail = BLL.CostSmallDetailService.GetCostSmallDetailById(this.CostSmallDetailId);
|
|
if (costSmallDetail != null)
|
|
{
|
|
this.txtCostSmallDetailCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostSmallDetailId);
|
|
if (costSmallDetail.Months != null)
|
|
{
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM}", costSmallDetail.Months);
|
|
}
|
|
if (!string.IsNullOrEmpty(costSmallDetail.UnitId))
|
|
{
|
|
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(costSmallDetail.UnitId);
|
|
if (unit != null)
|
|
{
|
|
this.drpUnitId.Text = unit.UnitName;
|
|
}
|
|
}
|
|
if (costSmallDetail.ReportDate != null)
|
|
{
|
|
this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.ReportDate);
|
|
}
|
|
//this.txtCompileMan.Text = costSmallDetail.CompileMan;
|
|
//if (costSmallDetail.CompileDate != null)
|
|
//{
|
|
// this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.CompileDate);
|
|
//}
|
|
//this.txtCheckMan.Text = costSmallDetail.CheckMan;
|
|
//if (costSmallDetail.CheckDate != null)
|
|
//{
|
|
// this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.CheckDate);
|
|
//}
|
|
//this.txtApproveMan.Text = costSmallDetail.ApproveMan;
|
|
//if (costSmallDetail.ApproveDate != null)
|
|
//{
|
|
// this.txtApproveDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.ApproveDate);
|
|
//}
|
|
var costGoods_CostSmallDetailItems = from x in Funs.DB.CostGoods_CostSmallDetailItem where x.CostSmallDetailId == this.CostSmallDetailId orderby x.CostType select x;
|
|
var constTypeList = CostTypeService.GetCostTypeList();
|
|
foreach (var item in costGoods_CostSmallDetailItems)
|
|
{
|
|
HSSECostSmallDetailOutput hSSECost = new HSSECostSmallDetailOutput();
|
|
hSSECost.CostSmallDetailItemId = item.CostSmallDetailItemId;
|
|
hSSECost.CostTypeCode = item.CostType;
|
|
hSSECost.CostTypeName = constTypeList.FirstOrDefault(x => x.CostTypeCode == item.CostType)?.CostTypeName;
|
|
hSSECost.CostMoney = item.CostMoney;
|
|
hSSECost.Remark = constTypeList.FirstOrDefault(x => x.CostTypeCode == item.CostType)?.Remark;
|
|
hSSECostSmallDetailOutputs.Add(hSSECost);
|
|
}
|
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(costSmallDetail.ProjectId);
|
|
DateTime? date = Funs.GetNewDateTime(costSmallDetail.Months.Value.Year + "-" + costSmallDetail.Months.Value.Month + "-01");
|
|
if (project != null && date.HasValue)
|
|
{
|
|
List<Model.CostGoods_CostSmallDetailItem> projectDetails = BLL.CostSmallDetailItemService.GetCostDetailsByUnitId(this.CurrUser.LoginProjectId, costSmallDetail.UnitId, project != null ? project.StartDate : null, date);
|
|
|
|
foreach (var item in hSSECostSmallDetailOutputs)
|
|
{
|
|
var a = Grid1.FindRow(item.CostSmallDetailItemId);
|
|
item.SumCostMoney = (from x in projectDetails where x.CostType == item.CostTypeCode select x.CostMoney ?? 0).Sum() + item.CostMoney;
|
|
}
|
|
Grid1.DataSource = hSSECostSmallDetailOutputs;
|
|
Grid1.DataBind();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(this.CostSmallDetailId))
|
|
{
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostSmallDetailAttachUrl&menuId={1}", this.CostSmallDetailId, BLL.Const.ProjectCostSmallDetailMenuId)));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |