修改生态环保报表

This commit is contained in:
2023-07-12 17:07:47 +08:00
parent 4449a7754f
commit c13c5de7ec
18 changed files with 266 additions and 71 deletions
@@ -45,9 +45,15 @@ namespace FineUIPro.Web.ZHGL.Information
ddlYearId.DataSource = BLL.ConstValue.drpConstItemList(ConstValue.Group_0008);
ddlYearId.DataBind();
this.ddlQuarter.DataTextField = "ConstText";
ddlQuarter.DataValueField = "ConstValue";
ddlQuarter.DataSource = BLL.ConstValue.drpConstItemList(ConstValue.Group_0011);
ddlQuarter.DataBind();
this.ddlUnitId.Readonly = true;
string unitId = Request.Params["UnitId"];
string year = Request.QueryString["Year"];
string quarter = Request.QueryString["Quarter"];
this.EPSummaryReportId = Request.Params["EPSummaryReportId"];
if (!string.IsNullOrEmpty(this.EPSummaryReportId))
{
@@ -66,6 +72,10 @@ namespace FineUIPro.Web.ZHGL.Information
this.ddlUnitId.SelectedValue = report.UnitId;
}
this.ddlYearId.SelectedValue = report.YearId.ToString();
if (report.Quarter.HasValue)
{
this.ddlQuarter.SelectedValue = report.Quarter.ToString();
}
this.txtReportDate.Text = report.ReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ReportDate) : "";
this.txtResponsiblePerson.Text = report.ResponsiblePerson;
this.txtResponsiblePersonTel.Text = report.ResponsiblePersonTel;
@@ -88,6 +98,7 @@ namespace FineUIPro.Web.ZHGL.Information
this.btnCopy.Hidden = false;
this.ddlUnitId.SelectedValue = unitId;
this.ddlYearId.SelectedValue = year;
this.ddlQuarter.SelectedValue = quarter;
this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
#region
@@ -97,19 +108,19 @@ namespace FineUIPro.Web.ZHGL.Information
string description4 = string.Empty;
string description5 = string.Empty;
string description6 = string.Empty;
string description7= string.Empty;
string description7 = string.Empty;
string description8 = string.Empty;
string description9 = string.Empty;
int date = Convert.ToInt32(this.ddlYearId.SelectedValue);
var projects = (from x in Funs.DB.Base_Project
where (x.ProjectState == BLL.Const.ProjectState_1 || x.ProjectState == null)
&& x.ProjectAttribute == "GONGCHENG"
&& x.StartDate.Value.Year <= date
select x).ToList();
foreach (var item in projects)
{
var report = Funs.DB.InformationProject_EPSummaryReport.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.YearId == date);
var report = Funs.DB.InformationProject_EPSummaryReport.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.YearId == date && x.Quarter.ToString() == quarter);
if (report != null)
{
description1 += item.ProjectName + "\r\n" + report.Description1 + "\r\n";
@@ -160,6 +171,15 @@ namespace FineUIPro.Web.ZHGL.Information
ShowNotify("请选择年度!", MessageBoxIcon.Warning);
return;
}
if (this.ddlQuarter.SelectedValue != BLL.Const._Null)
{
report.Quarter = Funs.GetNewIntOrZero(this.ddlQuarter.SelectedValue);
}
else
{
ShowNotify("请选择年度!", MessageBoxIcon.Warning);
return;
}
report.ResponsiblePerson = this.txtResponsiblePerson.Text.Trim();
report.ResponsiblePersonTel = this.txtResponsiblePersonTel.Text.Trim();
report.ContactPerson = this.txtContactPerson.Text.Trim();
@@ -174,9 +194,10 @@ namespace FineUIPro.Web.ZHGL.Information
report.Description7 = this.txtDescription7.Text.Trim();
report.Description8 = this.txtDescription8.Text.Trim();
report.Description9 = this.txtDescription9.Text.Trim();
int quarter = Funs.GetNewIntOrZero(ddlQuarter.SelectedValue);
if (string.IsNullOrEmpty(this.EPSummaryReportId))
{
var s = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearId(this.ddlUnitId.SelectedValue, Funs.GetNewIntOrZero(this.ddlYearId.SelectedValue));
var s = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearIdAndQuarters(this.ddlUnitId.SelectedValue, Funs.GetNewIntOrZero(this.ddlYearId.SelectedValue), quarter);
if (s != null)
{
ShowNotify("该单位的该年度的该生态环保工作总结报告已经存在,不能重复编制!", MessageBoxIcon.Warning);
@@ -247,12 +268,20 @@ namespace FineUIPro.Web.ZHGL.Information
/// <param name="e"></param>
protected void btnCopy_Click(object sender, EventArgs e)
{
int lastYear = 0;
int lastYear = 0, lastQuarter = 0;
int year = Convert.ToInt32(this.ddlYearId.SelectedValue);
lastYear = year - 1;
Model.Information_EPSummaryReport report = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearId(this.ddlUnitId.SelectedValue, lastYear);
int quarter = Convert.ToInt32(this.ddlQuarter.SelectedValue);
if (quarter == 1)
{
lastYear = year - 1;
lastQuarter = 4;
}
else
{
lastYear = year;
lastQuarter = quarter - 1;
}
Model.Information_EPSummaryReport report = BLL.EPSummaryReportService.GetEPSummaryReportByUnitIdAndYearIdAndQuarters(this.ddlUnitId.SelectedValue, lastYear, lastQuarter);
if (report != null)
{
Model.Information_EPSummaryReport newReport = new Model.Information_EPSummaryReport();