227 lines
11 KiB
C#
227 lines
11 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace FineUIPro.Web.Customization.CNCEC4.HSSE.Report
|
|
{
|
|
public partial class CostUseConditionEdit : PageBase
|
|
{
|
|
#region 定义变量
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string ReportId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ReportId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ReportId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义集合
|
|
/// </summary>
|
|
private static List<Model.Report_CostUseConditionItem> itemLists = new List<Model.Report_CostUseConditionItem>();
|
|
#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.GetHideReference();
|
|
BLL.UnitService.InitProjectUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
|
|
|
this.ReportId = Request.Params["reportId"];
|
|
if (!string.IsNullOrEmpty(this.ReportId))
|
|
{
|
|
var report = BLL.CostUseConditionService.GetReportById(this.ReportId);
|
|
if (report != null)
|
|
{
|
|
this.drpUnitId.SelectedValue = report.UnitId;
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", report.Months);
|
|
this.txtAmount.Text = report.Amount.HasValue ? report.Amount.ToString() : "";
|
|
|
|
itemLists.Clear();
|
|
itemLists = BLL.CostUseConditionItemService.GetReportItemByReportId(this.ReportId);
|
|
this.Grid1.DataSource = itemLists;
|
|
this.Grid1.DataBind();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
this.drpUnitId.SelectedValue = this.CurrUser.UnitId;
|
|
|
|
#region 初始化明细
|
|
itemLists.Clear();
|
|
Model.Report_CostUseConditionItem item1 = new Model.Report_CostUseConditionItem();
|
|
item1.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item1.SortId = 1;
|
|
item1.SortName = "一";
|
|
item1.Contents = "提取数(财资部提供)";
|
|
itemLists.Add(item1);
|
|
|
|
Model.Report_CostUseConditionItem item2 = new Model.Report_CostUseConditionItem();
|
|
item2.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item2.SortId = 2;
|
|
item2.SortName = "二";
|
|
item2.Contents = "实际支出数";
|
|
itemLists.Add(item2);
|
|
|
|
Model.Report_CostUseConditionItem item3 = new Model.Report_CostUseConditionItem();
|
|
item3.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item3.SortId = 3;
|
|
item3.SortName = "1";
|
|
item3.Contents = "完善、改造和维护安全防护设施设备支出";
|
|
itemLists.Add(item3);
|
|
|
|
Model.Report_CostUseConditionItem item4 = new Model.Report_CostUseConditionItem();
|
|
item4.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item4.SortId = 4;
|
|
item4.SortName = "2";
|
|
item4.Contents = "配备、维护、保养应急救援器材、设备支出和应急演练支出";
|
|
itemLists.Add(item4);
|
|
|
|
Model.Report_CostUseConditionItem item5 = new Model.Report_CostUseConditionItem();
|
|
item5.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item5.SortId = 5;
|
|
item5.SortName = "3";
|
|
item5.Contents = "开展重大危险源、风险分级管控和事故隐患整改支出、安全信息化建设支出";
|
|
itemLists.Add(item5);
|
|
|
|
Model.Report_CostUseConditionItem item6 = new Model.Report_CostUseConditionItem();
|
|
item6.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item6.SortId = 6;
|
|
item6.SortName = "4";
|
|
item6.Contents = "安全生产检查、评价支出";
|
|
itemLists.Add(item6);
|
|
|
|
Model.Report_CostUseConditionItem item7 = new Model.Report_CostUseConditionItem();
|
|
item7.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item7.SortId = 7;
|
|
item7.SortName = "5";
|
|
item7.Contents = "配备和更新现场作业人员安全防护用品支出";
|
|
itemLists.Add(item7);
|
|
|
|
Model.Report_CostUseConditionItem item8 = new Model.Report_CostUseConditionItem();
|
|
item8.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item8.SortId = 8;
|
|
item8.SortName = "6";
|
|
item8.Contents = "安全生产宣传、教育、培训支出";
|
|
itemLists.Add(item8);
|
|
|
|
Model.Report_CostUseConditionItem item9 = new Model.Report_CostUseConditionItem();
|
|
item9.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item9.SortId = 9;
|
|
item9.SortName = "7";
|
|
item9.Contents = "“四新”推广费用支出";
|
|
itemLists.Add(item9);
|
|
|
|
Model.Report_CostUseConditionItem item10 = new Model.Report_CostUseConditionItem();
|
|
item10.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item10.SortId = 10;
|
|
item10.SortName = "8";
|
|
item10.Contents = "安全设施及特种设备检测检查费";
|
|
itemLists.Add(item10);
|
|
|
|
Model.Report_CostUseConditionItem item11 = new Model.Report_CostUseConditionItem();
|
|
item11.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item11.SortId = 11;
|
|
item11.SortName = "9";
|
|
item11.Contents = "安全生产责任险";
|
|
itemLists.Add(item11);
|
|
|
|
Model.Report_CostUseConditionItem item12 = new Model.Report_CostUseConditionItem();
|
|
item12.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item12.SortId = 12;
|
|
item12.SortName = "10";
|
|
item12.Contents = "其他与安全生产直接相关的支出";
|
|
itemLists.Add(item12);
|
|
|
|
Model.Report_CostUseConditionItem item13 = new Model.Report_CostUseConditionItem();
|
|
item13.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item13.SortId = 13;
|
|
item13.SortName = "10-1";
|
|
item13.Contents = "其中为分包单位支付的安全生产费用";
|
|
itemLists.Add(item13);
|
|
|
|
Model.Report_CostUseConditionItem item14 = new Model.Report_CostUseConditionItem();
|
|
item14.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
item14.SortId = 14;
|
|
item14.SortName = "三";
|
|
item14.Contents = "期末安全生产费用余额";
|
|
itemLists.Add(item14);
|
|
|
|
this.Grid1.DataSource = itemLists;
|
|
this.Grid1.DataBind();
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
|
{
|
|
Alert.ShowInTop("请选择编制单位!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
Model.Report_CostUseCondition newReport = new Model.Report_CostUseCondition();
|
|
newReport.ProjectId = this.CurrUser.LoginProjectId;
|
|
newReport.UnitId = this.drpUnitId.SelectedValue;
|
|
newReport.Months = Funs.GetNewDateTime(this.txtMonths.Text.Trim());
|
|
newReport.Amount = Funs.GetNewDecimal(this.txtAmount.Text.Trim());
|
|
if (!string.IsNullOrEmpty(this.ReportId))
|
|
{
|
|
newReport.ReportId = this.ReportId;
|
|
BLL.CostUseConditionService.UpdateCostUseCondition(newReport);
|
|
}
|
|
else
|
|
{
|
|
newReport.ReportId = SQLHelper.GetNewID(typeof(Model.Report_CostUseCondition));
|
|
this.ReportId = newReport.ReportId;
|
|
BLL.CostUseConditionService.AddCostUseCondition(newReport);
|
|
}
|
|
BLL.CostUseConditionItemService.DeleteCostUseConditionItemByReportId(newReport.ReportId);
|
|
JArray teamGroupData = Grid1.GetMergedData();
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
|
{
|
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|
|
|
Model.Report_CostUseConditionItem newItem = new Model.Report_CostUseConditionItem();
|
|
newItem.ReportItemId = SQLHelper.GetNewID(typeof(Model.Report_CostUseConditionItem));
|
|
newItem.ReportId = this.ReportId;
|
|
newItem.SortId = Funs.GetNewInt(values.Value<string>("SortId"));
|
|
newItem.SortName = values.Value<string>("SortName");
|
|
newItem.Contents = values.Value<string>("Contents");
|
|
newItem.CurrentMonth = Funs.GetNewDecimal(values.Value<string>("CurrentMonth"));
|
|
newItem.CumulativeNum = Funs.GetNewDecimal(values.Value<string>("CumulativeNum"));
|
|
newItem.Remark = values.Value<string>("Remark");
|
|
|
|
BLL.CostUseConditionItemService.AddCostUseConditionItem(newItem);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |