116 lines
4.1 KiB
C#
116 lines
4.1 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.Customization.CNCEC4.ZHGL.Report
|
|
{
|
|
public partial class CostUseCondition :PageBase
|
|
{
|
|
/// <summary>
|
|
/// 定义集合
|
|
/// </summary>
|
|
private static List<Model.Report_CostUseConditionItem> itemLists = new List<Model.Report_CostUseConditionItem>();
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.txtM.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
|
BLL.UnitService.InitBranchUnitDropDownList(this.drpUnit, false);//分公司
|
|
BLL.ProjectService.InitProjectByUnitIdDropDownList(this.drpProjectId, this.drpUnit.SelectedValue, false);
|
|
|
|
//显示本单位信息
|
|
var thisUnit = BLL.CommonService.GetIsThisUnit();
|
|
if ((!string.IsNullOrEmpty(this.CurrUser.UnitId) && thisUnit.UnitId == this.CurrUser.UnitId) || this.CurrUser.UserId == BLL.Const.sysglyId || this.CurrUser.UserId == BLL.Const.hfnbdId)
|
|
{
|
|
this.drpUnit.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
this.drpUnit.Enabled = false;
|
|
this.drpUnit.SelectedValue = this.CurrUser.UnitId;
|
|
}
|
|
|
|
// 绑定表格
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
var costUse = BLL.CostUseConditionService.GetReportByMonths(this.drpProjectId.SelectedValue, Funs.GetNewDateTime(this.txtM.Text).Value.Year, Funs.GetNewDateTime(this.txtM.Text).Value.Month);
|
|
if (costUse != null)
|
|
{
|
|
BLL.UnitService.InitProjectUnitDropDownList(this.drpUnitId, this.drpProjectId.SelectedValue, true);
|
|
|
|
this.drpUnitId.SelectedValue = costUse.UnitId;
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", costUse.Months);
|
|
this.txtAmount.Text = costUse.Amount.HasValue ? costUse.Amount.ToString() : "";
|
|
|
|
itemLists.Clear();
|
|
itemLists = BLL.CostUseConditionItemService.GetReportItemByReportId(costUse.ReportId);
|
|
if (itemLists.Count > 0)
|
|
{
|
|
this.Grid1.DataSource = itemLists;
|
|
this.Grid1.DataBind();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.drpUnitId.SelectedValue = BLL.Const._Null;
|
|
this.txtMonths.Text = string.Empty;
|
|
this.txtAmount.Text = string.Empty;
|
|
itemLists.Clear();
|
|
this.Grid1.DataSource = itemLists;
|
|
this.Grid1.DataBind();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 项目下拉选择
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 所属单位下拉选择
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void drpUnitId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnit.SelectedValue != BLL.Const._Null)
|
|
{
|
|
this.drpProjectId.Items.Clear();
|
|
BLL.ProjectService.InitProjectByUnitIdDropDownList(this.drpProjectId, this.drpUnit.SelectedValue, false);
|
|
this.drpProjectId.SelectedIndex = 0;
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 月份下拉选择
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void txtM_TextChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |