增加集团报表
This commit is contained in:
@@ -18,7 +18,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
//Funs.DropDownPageSize(this.ddlPageSize);
|
||||
//权限按钮方法
|
||||
this.GetButtonPower();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
Grid1.PageSize = this.CurrUser.PageSize.Value;
|
||||
}
|
||||
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
//this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
string strSql = "select * from Environmental_OperationReport where 1=1 ";
|
||||
|
||||
strSql += " AND UnitId = '" + BLL.Const.UnitId_CWCEC + "'";
|
||||
strSql += " AND UnitId = '" + CommonService.GetThisUnitId() + "'";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
@@ -67,18 +67,25 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
listStr.Add(new SqlParameter("@Quarters", Funs.GetNewInt(this.drpQuarters.SelectedValue)));
|
||||
}
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
//SqlParameter[] parameter = listStr.ToArray();
|
||||
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
//Grid1.RecordCount = tb.Rows.Count;
|
||||
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
//var table = this.GetPagedDataTable(Grid1, tb);
|
||||
//Grid1.DataSource = table;
|
||||
//Grid1.DataBind();
|
||||
|
||||
Model.Environmental_OperationReport report = Funs.DB.Environmental_OperationReport.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.Quarters == Funs.GetNewInt(this.drpQuarters.SelectedValue) && e.Year == Funs.GetNewInt(this.drpYear.SelectedValue));
|
||||
if (report != null)
|
||||
{
|
||||
//根据主表id加载子表
|
||||
var reportItem = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == report.BusinessReportId)
|
||||
.OrderBy(x => x.SortIndex).ToList();
|
||||
|
||||
Grid1.DataSource = reportItem;
|
||||
Grid1.DataBind();
|
||||
|
||||
string upState = string.Empty;
|
||||
if (report.UpState == BLL.Const.UpState_3)
|
||||
{
|
||||
@@ -90,6 +97,14 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
this.Grid1.Title = "中央企业节能环保和经营状况季报" + this.drpQuarters.SelectedItem.Text + this.drpYear.SelectedItem.Text + upState;
|
||||
}
|
||||
else {
|
||||
|
||||
var upState = "(未上报)";
|
||||
|
||||
this.Grid1.Title = "中央企业节能环保和经营状况季报" + this.drpQuarters.SelectedItem.Text + this.drpYear.SelectedItem.Text + upState;
|
||||
this.Grid1.DataSource = null;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -123,8 +138,8 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
//this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
||||
//BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -163,7 +178,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}", BLL.Const.UnitId_CWCEC, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}", CommonService.GetThisUnitId(), this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, "编辑 - ")));
|
||||
}
|
||||
/// <summary>
|
||||
/// 双击事件
|
||||
@@ -199,7 +214,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
var operationReport = Funs.DB.Environmental_OperationReport.FirstOrDefault(s => s.BusinessReportId == id);
|
||||
if (operationReport != null)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}", BLL.Const.UnitId_CWCEC, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, id, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}", CommonService.GetThisUnitId(), this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, id, "编辑 - ")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,14 +225,19 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void btnUpdata_Click(object sender, EventArgs e)
|
||||
{
|
||||
var currUnitId = BLL.Const.UnitId_CWCEC;
|
||||
var currUnitId = CommonService.GetThisUnitId();
|
||||
var year = this.drpYear.SelectedValue;
|
||||
var quarter = this.drpQuarters.SelectedValue;
|
||||
|
||||
Model.Environmental_OperationReport report = Funs.DB.Environmental_OperationReport.Where(s => s.UnitId == currUnitId && s.Year.ToString() == year && s.Quarters.ToString() == quarter).FirstOrDefault();
|
||||
if (report != null)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}&type=Update", BLL.Const.UnitId_CWCEC, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, report.BusinessReportId, "编辑 - ")));
|
||||
if (report.UpState=="3")
|
||||
{
|
||||
ShowNotify("当前报表已经上报!不能重复上报。", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}&type=Update", CommonService.GetThisUnitId(), this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, report.BusinessReportId, "编辑 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -264,15 +284,22 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
var getD = Funs.DB.Environmental_OperationReport.FirstOrDefault(s => s.BusinessReportId == rowID);
|
||||
if (getD != null)
|
||||
{
|
||||
//先删子表
|
||||
var list = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == getD.BusinessReportId).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
Funs.DB.Environmental_OperationReportItem.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, null, getD.BusinessReportId, BLL.Const.OperationReportMenuId, BLL.Const.BtnDelete);
|
||||
|
||||
Funs.DB.Environmental_OperationReport.DeleteOnSubmit(getD);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -322,7 +349,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
}
|
||||
|
||||
var unitId = BLL.Const.UnitId_CWCEC;
|
||||
var unitId = CommonService.GetThisUnitId();
|
||||
var year = Funs.GetNewIntOrZero(drpYear.SelectedValue);
|
||||
var quarter = Funs.GetNewIntOrZero(drpQuarters.SelectedValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user