/// <summary> /// 计算合计 /// </summary> private void OutputSummaryData() { Grid1.CommitChanges(); decimal sumTotalMoney = 0, sumAuditTotalMoney = 0, totalMoney = 0, auditTotalMoney = 0, priceMoney = 0, auditPriceMoney = 0; int counts = 0, auditCounts = 0; for (int i = 0; i < Grid1.Rows.Count; i++) { counts = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[3].ToString()); priceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[4].ToString()); totalMoney = counts * priceMoney; sumTotalMoney += totalMoney; this.Grid1.Rows[i].Values[5] = totalMoney.ToString(); auditCounts = Funs.GetNewIntOrZero(this.Grid1.Rows[i].Values[6].ToString()); auditPriceMoney = Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[7].ToString()); auditTotalMoney = auditCounts * auditPriceMoney; sumAuditTotalMoney += auditTotalMoney; this.Grid1.Rows[i].Values[8] = auditTotalMoney.ToString(); } if (this.Grid1.Rows.Count > 0) { JObject summary = new JObject(); summary.Add("PriceMoney", "总计"); summary.Add("TotalMoney", sumTotalMoney); summary.Add("AuditTotalMoney", sumAuditTotalMoney); Grid1.SummaryData = summary; } else { Grid1.SummaryData = null; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.CostGoods_Expense expense = new Model.CostGoods_Expense { ProjectId = this.ProjectId }; //if (!string.IsNullOrEmpty(this.txtMonths.Text)) //{ // expense.Months = Funs.GetNewDateTime(this.txtMonths.Text + "-01"); //} if (this.drpYear.SelectedValue != BLL.Const._Null && this.drpMonths.SelectedValue != BLL.Const._Null) { expense.Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue); } expense.ExpenseCode = this.txtExpenseCode.Text.Trim(); if (this.drpUnitId.SelectedValue != BLL.Const._Null) { expense.UnitId = this.drpUnitId.SelectedValue; } expense.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim()); //expense.CheckMan = this.txtCheckMan.Text; //expense.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()); //expense.ApproveMan = this.txtApproveMan.Text; //expense.ApproveDate = Funs.GetNewDateTime(this.txtApproveDate.Text.Trim()); ////单据状态 expense.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { expense.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.ExpenseId)) { expense.ExpenseId = this.ExpenseId; BLL.ExpenseService.UpdateExpense(expense); BLL.LogService.AddSys_Log(this.CurrUser, expense.ExpenseCode, expense.ExpenseId, BLL.Const.ProjectExpenseMenuId, BLL.Const.BtnModify); BLL.ExpenseDetailService.DeleteCostDetailByExpenseId(this.ExpenseId); } else { this.ExpenseId = SQLHelper.GetNewID(typeof(Model.CostGoods_Expense)); expense.ExpenseId = this.ExpenseId; expense.CompileMan = this.CurrUser.UserName; expense.CompileDate = DateTime.Now; BLL.ExpenseService.AddExpense(expense); BLL.LogService.AddSys_Log(this.CurrUser, expense.ExpenseCode, expense.ExpenseId, BLL.Const.ProjectExpenseMenuId, BLL.Const.BtnAdd); } //保存费用明细 BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A1", Funs.GetNewDecimalOrZero(this.nbA1.Text), this.txtDefA1.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A2", Funs.GetNewDecimalOrZero(this.nbA2.Text), this.txtDefA2.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A3", Funs.GetNewDecimalOrZero(this.nbA3.Text), this.txtDefA3.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A4", Funs.GetNewDecimalOrZero(this.nbA4.Text), this.txtDefA4.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A5", Funs.GetNewDecimalOrZero(this.nbA5.Text), this.txtDefA5.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "A6", Funs.GetNewDecimalOrZero(this.nbA6.Text), this.txtDefA6.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "B1", Funs.GetNewDecimalOrZero(this.nbB1.Text), this.txtDefB1.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "B2", Funs.GetNewDecimalOrZero(this.nbB2.Text), this.txtDefB2.Text.Trim()); BLL.ExpenseDetailService.AddCostDetail(expense.ExpenseId, "B3", Funs.GetNewDecimalOrZero(this.nbB3.Text), this.txtDefB3.Text.Trim()); ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectExpenseMenuId, this.ExpenseId, (type == BLL.Const.BtnSubmit ? true : false), expense.ExpenseCode, "../CostGoods/ExpenseView.aspx?ExpenseId={0}"); }
/// <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(); this.PunishNoticeId = Request.Params["PunishNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.PunishNoticeId)) { Model.Check_PunishNotice punishNotice = BLL.PunishNoticeService.GetPunishNoticeById(this.PunishNoticeId); if (punishNotice != null) { this.txtPunishNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PunishNoticeId); if (punishNotice.PunishNoticeDate != null) { this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", punishNotice.PunishNoticeDate); } if (!string.IsNullOrEmpty(punishNotice.UnitId)) { var unit = BLL.UnitService.GetUnitByUnitId(punishNotice.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } Model.Sys_User user1 = BLL.UserService.GetUserByUserId(punishNotice.SignMan); if (user1 != null) { this.txtSignMan.Text = user1.UserName; } Model.Sys_User user2 = BLL.UserService.GetUserByUserId(punishNotice.ApproveMan); if (user2 != null) { this.txtApproveMan.Text = user2.UserName; } this.txtContractNum.Text = punishNotice.ContractNum; this.txtIncentiveReason.Text = punishNotice.IncentiveReason; this.txtBasicItem.Text = punishNotice.BasicItem; if (punishNotice.PunishMoney != null) { this.txtPunishMoney.Text = Convert.ToString(punishNotice.PunishMoney); this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text));//转换大写 } this.AttchUrl = punishNotice.AttachUrl; //this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttchUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(punishNotice.FileContents); if (!string.IsNullOrEmpty(punishNotice.Currency)) { this.txtCurrency.Text = punishNotice.Currency; } this.txtPunishName.Text = punishNotice.PunishName; } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectPunishNoticeMenuId; this.ctlAuditFlow.DataId = this.PunishNoticeId; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.Check_IncentiveNotice incentiveNotice = new Model.Check_IncentiveNotice { ProjectId = this.ProjectId, IncentiveNoticeCode = this.txtIncentiveNoticeCode.Text.Trim(), UnitId = this.drpUnit.SelectedValue, IncentiveDate = Funs.GetNewDateTime(this.txtIncentiveDate.Text.Trim()) }; if (this.drpTeamGroup.SelectedValue != BLL.Const._Null) { incentiveNotice.TeamGroupId = this.drpTeamGroup.SelectedValue; } if (this.drpPerson.SelectedValue != BLL.Const._Null) { incentiveNotice.PersonId = this.drpPerson.SelectedValue; } incentiveNotice.BasicItem = this.txtBasicItem.Text.Trim(); if (this.drpRewardType.SelectedValue != BLL.Const._Null) { incentiveNotice.RewardType = this.drpRewardType.SelectedValue; } incentiveNotice.IncentiveMoney = Funs.GetNewDecimalOrZero(this.txtPayMoney.Text.Trim()); incentiveNotice.TitleReward = this.txtTitleReward.Text.Trim(); incentiveNotice.MattleReward = this.txtMattleReward.Text.Trim(); incentiveNotice.FileContents = HttpUtility.HtmlEncode(this.txtFileContents.Text); incentiveNotice.AttachUrl = this.AttachUrl; incentiveNotice.CompileMan = this.CurrUser.UserId; incentiveNotice.CompileDate = Funs.GetNewDateTime(this.txtIncentiveDate.Text.Trim()); if (this.drpSignMan.SelectedValue != BLL.Const._Null) { incentiveNotice.SignMan = this.drpSignMan.SelectedValue; } if (this.drpApproveMan.SelectedValue != BLL.Const._Null) { incentiveNotice.ApproveMan = this.drpApproveMan.SelectedValue; } incentiveNotice.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { incentiveNotice.States = this.ctlAuditFlow.NextStep; } incentiveNotice.Currency = this.txtCurrency.Text.Trim(); if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { incentiveNotice.IncentiveNoticeId = this.IncentiveNoticeId; BLL.IncentiveNoticeService.UpdateIncentiveNotice(incentiveNotice); BLL.LogService.AddSys_Log(this.CurrUser, incentiveNotice.IncentiveNoticeCode, incentiveNotice.IncentiveNoticeId, BLL.Const.ProjectIncentiveNoticeMenuId, BLL.Const.BtnModify); } else { this.IncentiveNoticeId = SQLHelper.GetNewID(typeof(Model.Check_IncentiveNotice)); incentiveNotice.IncentiveNoticeId = this.IncentiveNoticeId; BLL.IncentiveNoticeService.AddIncentiveNotice(incentiveNotice); BLL.LogService.AddSys_Log(this.CurrUser, incentiveNotice.IncentiveNoticeCode, incentiveNotice.IncentiveNoticeId, BLL.Const.ProjectIncentiveNoticeMenuId, BLL.Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectIncentiveNoticeMenuId, this.IncentiveNoticeId, (type == BLL.Const.BtnSubmit ? true : false), incentiveNotice.IncentiveNoticeCode, "../Check/IncentiveNoticeView.aspx?IncentiveNoticeId={0}"); }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.Accident_AccidentReportOther accidentReportOther = new Model.Accident_AccidentReportOther { ProjectId = this.CurrUser.LoginProjectId, AccidentReportOtherCode = this.txtAccidentReportOtherCode.Text.Trim(), AccidentReportOtherName = this.txtAccidentReportOtherName.Text.Trim() }; if (this.drpAccidentTypeId.SelectedValue != BLL.Const._Null) { accidentReportOther.AccidentTypeId = this.drpAccidentTypeId.SelectedValue; } accidentReportOther.Abstract = this.txtAbstract.Text.Trim(); accidentReportOther.AccidentDate = Funs.GetNewDateTime(this.txtAccidentDate.Text.Trim()); accidentReportOther.WorkArea = this.txtWorkArea.Text; accidentReportOther.PeopleNum = Funs.GetNewIntOrZero(this.txtPeopleNum.Text.Trim()); if (this.drpUnitId.SelectedValue != BLL.Const._Null) { accidentReportOther.UnitId = this.drpUnitId.SelectedValue; } accidentReportOther.WorkingHoursLoss = 0; accidentReportOther.EconomicLoss = Funs.GetNewDecimalOrZero(this.txtEconomicLoss.Text.Trim()); accidentReportOther.EconomicOtherLoss = Funs.GetNewDecimalOrZero(this.txtEconomicOtherLoss.Text.Trim()); accidentReportOther.ReportMan = this.txtReportMan.Text.Trim(); accidentReportOther.ReporterUnit = this.txtReporterUnit.Text.Trim(); accidentReportOther.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim()); accidentReportOther.ProcessDescription = this.txtProcessDescription.Text.Trim(); accidentReportOther.EmergencyMeasures = this.txtEmergencyMeasures.Text.Trim(); accidentReportOther.ImmediateCause = this.txtImmediateCause.Text.Trim(); accidentReportOther.IndirectReason = this.txtIndirectReason.Text.Trim(); accidentReportOther.CorrectivePreventive = this.txtCorrectivePreventive.Text.Trim(); accidentReportOther.FileContent = HttpUtility.HtmlEncode(this.txtFileContents.Text); if (this.drpCompileMan.SelectedValue != BLL.Const._Null) { accidentReportOther.CompileMan = this.drpCompileMan.SelectedValue; } accidentReportOther.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim()); accidentReportOther.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { accidentReportOther.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.AccidentReportOtherId)) { accidentReportOther.AccidentReportOtherId = this.AccidentReportOtherId; BLL.AccidentReportOtherService.UpdateAccidentReportOther(accidentReportOther); BLL.LogService.AddSys_Log(this.CurrUser, accidentReportOther.AccidentReportOtherCode, accidentReportOther.AccidentReportOtherId, BLL.Const.ProjectAccidentReportOtherMenuId, Const.BtnModify); } else { this.AccidentReportOtherId = SQLHelper.GetNewID(typeof(Model.Accident_AccidentReportOther)); accidentReportOther.AccidentReportOtherId = this.AccidentReportOtherId; BLL.AccidentReportOtherService.AddAccidentReportOther(accidentReportOther); BLL.LogService.AddSys_Log(this.CurrUser, accidentReportOther.AccidentReportOtherCode, accidentReportOther.AccidentReportOtherId, BLL.Const.ProjectAccidentReportOtherMenuId, Const.BtnAdd); } //保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.CurrUser.LoginProjectId, BLL.Const.ProjectAccidentReportOtherMenuId, this.AccidentReportOtherId, (type == BLL.Const.BtnSubmit ? true : false), accidentReportOther.AccidentReportOtherCode, "../Accident/AccidentReportOtherView.aspx?AccidentReportOtherId={0}"); }
/// <summary> /// 计算总价 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Text_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtCount.Text.Trim()) && !string.IsNullOrEmpty(this.txtPriceMoney.Text.Trim())) { int? count = Funs.GetNewInt(this.txtCount.Text.Trim()); decimal?price = Funs.GetNewDecimalOrZero(this.txtPriceMoney.Text.Trim()); this.txtTotalMoney.Text = Convert.ToString(count * price); } }
/// <summary> /// 输入框变化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Text_TextChanged(object sender, EventArgs e) { decimal? pMainIncome = 0, pConstructionIncome = 0, pSafetyCosts = 0; decimal? pEngineeringCost = 0, pSubUnitCost = 0, pAuditedSubUnitCost = 0; DateTime?Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue); var sumHSSECostManage = BLL.HSSECostManageService.GetListHSSECostManageByProjectIdMonth(this.ProjectId, Months); if (sumHSSECostManage.Count() > 0) { pMainIncome = sumHSSECostManage.Sum(x => x.MainIncome ?? 0); pConstructionIncome = sumHSSECostManage.Sum(x => x.ConstructionIncome ?? 0); pSafetyCosts = sumHSSECostManage.Sum(x => x.SafetyCosts ?? 0); } var sumHSSECostUnitManage = BLL.HSSECostUnitManageService.GetHSSECostUnitManageListByProjectIdUnitIdMonth(this.ProjectId, this.drpUnitId.SelectedValue, Months); if (sumHSSECostUnitManage.Count() > 0) { pEngineeringCost = sumHSSECostUnitManage.Sum(x => x.EngineeringCost ?? 0); pSubUnitCost = sumHSSECostUnitManage.Sum(x => x.SubUnitCost ?? 0); pAuditedSubUnitCost = sumHSSECostUnitManage.Sum(x => x.AuditedSubUnitCost ?? 0); } decimal?EngineeringCost = 0, AuditedSubUnitCost = 0; this.txtProjectMainIncome.Text = (pMainIncome + Funs.GetNewDecimalOrZero(this.txtMainIncome.Text)).ToString(); this.txtProjectConstructionIncome.Text = (pConstructionIncome + Funs.GetNewDecimalOrZero(this.txtConstructionIncome.Text)).ToString(); this.txtProjectSafetyCosts.Text = (pSafetyCosts + Funs.GetNewDecimalOrZero(this.txtSafetyCosts.Text)).ToString(); EngineeringCost = Funs.GetNewDecimalOrZero(this.txtEngineeringCost.Text); AuditedSubUnitCost = Funs.GetNewDecimalOrZero(this.txtAuditedSubUnitCost.Text); pEngineeringCost = pEngineeringCost + EngineeringCost; pAuditedSubUnitCost = pAuditedSubUnitCost + AuditedSubUnitCost; this.txtProjectEngineeringCost.Text = (pEngineeringCost).ToString(); this.txtProjectSubUnitCost.Text = (pConstructionIncome + Funs.GetNewDecimalOrZero(this.txtSubUnitCost.Text)).ToString(); this.txtProjectAuditedSubUnitCost.Text = (pAuditedSubUnitCost).ToString(); if (EngineeringCost.HasValue && EngineeringCost != 0 && AuditedSubUnitCost.HasValue) { this.txtCostRatio.Text = Math.Round((AuditedSubUnitCost / EngineeringCost * 100).Value, 2).ToString() + "%";; } else { this.txtCostRatio.Text = "0%"; } if (pEngineeringCost.HasValue && pEngineeringCost != 0 && pAuditedSubUnitCost.HasValue) { this.txtProjectCostRatio.Text = Math.Round((pAuditedSubUnitCost / pEngineeringCost * 100).Value, 2).ToString() + "%";; } else { this.txtProjectCostRatio.Text = "0%"; } }
/// <summary> /// 获取大写金额事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void txtPunishMoney_Blur(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtPunishMoney.Text)) { this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text)); } else { this.txtBig.Text = string.Empty; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.Accident_AccidentHandle accidentHandle = new Model.Accident_AccidentHandle { ProjectId = this.ProjectId, AccidentHandleCode = this.txtAccidentHandleCode.Text.Trim(), AccidentHandleName = this.txtAccidentHandleName.Text.Trim(), AccidentDate = Convert.ToDateTime(this.txtAccidentDate.Text.Trim()), AccidentDef = this.txtAccidentDef.Text.Trim(), MoneyLoss = Funs.GetNewDecimalOrZero(this.txtMoneyLoss.Text.Trim()), WorkHoursLoss = Funs.GetNewDecimalOrZero(this.txtWorkHoursLoss.Text.Trim()), MinorInjuriesPersonNum = Funs.GetNewIntOrZero(this.txtMinorInjuriesPersonNum.Text.Trim()), InjuriesPersonNum = Funs.GetNewIntOrZero(this.txtInjuriesPersonNum.Text.Trim()), DeathPersonNum = Funs.GetNewIntOrZero(this.txtDeathPersonNum.Text.Trim()), AccidentHandle = this.txtAccidentHandle.Text.Trim(), Remark = this.txtRemark.Text.Trim(), CompileMan = this.CurrUser.UserId, CompileDate = DateTime.Now, States = BLL.Const.State_0 }; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { accidentHandle.UnitId = this.drpUnitId.SelectedValue; } if (type == BLL.Const.BtnSubmit) { var flowOperate = Funs.DB.Sys_FlowOperate.FirstOrDefault(x => x.DataId == this.AccidentHandleId && x.State == BLL.Const.State_2 && x.IsClosed == true); if (flowOperate != null) { accidentHandle.States = BLL.Const.State_2; } else { accidentHandle.States = this.ctlAuditFlow.NextStep; } } if (!string.IsNullOrEmpty(this.AccidentHandleId)) { accidentHandle.AccidentHandleId = this.AccidentHandleId; BLL.AccidentHandleService.UpdateAccidentHandle(accidentHandle); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentHandleCode.Text, this.AccidentHandleId, BLL.Const.ProjectAccidentHandleMenuId, Const.BtnModify); } else { this.AccidentHandleId = SQLHelper.GetNewID(typeof(Model.Accident_AccidentHandle)); accidentHandle.AccidentHandleId = this.AccidentHandleId; BLL.AccidentHandleService.AddAccidentHandle(accidentHandle); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentHandleCode.Text, this.AccidentHandleId, BLL.Const.ProjectAccidentHandleMenuId, Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectAccidentHandleMenuId, this.AccidentHandleId, (type == BLL.Const.BtnSubmit ? true : false), accidentHandle.AccidentHandleName, "../Accident/AccidentHandleView.aspx?AccidentHandleId={0}"); }
/// <summary> /// 输入框变化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void nbB3_TextChanged(object sender, EventArgs e) { if (this.drpUnitId.SelectedValue != BLL.Const._Null) { this.nbProjectB3.Text = (Funs.GetNewDecimalOrZero(this.hdProjectB3.Text) + Funs.GetNewDecimalOrZero(this.nbB3.Text)).ToString(); this.nbB.Text = (Funs.GetNewDecimalOrZero(this.nbB1.Text) + Funs.GetNewDecimalOrZero(this.nbB2.Text) + Funs.GetNewDecimalOrZero(this.nbB3.Text)).ToString(); this.nbProjectB.Text = (Funs.GetNewDecimalOrZero(this.nbProjectB1.Text) + Funs.GetNewDecimalOrZero(this.nbProjectB2.Text) + Funs.GetNewDecimalOrZero(this.nbProjectB3.Text)).ToString(); this.nbAB.Text = (Funs.GetNewDecimalOrZero(this.nbA.Text) + Funs.GetNewDecimalOrZero(this.nbB.Text)).ToString(); this.nbProjectAB.Text = (Funs.GetNewDecimalOrZero(this.nbProjectA.Text) + Funs.GetNewDecimalOrZero(this.nbProjectB.Text)).ToString(); } else { this.nbB3.Text = string.Empty; Alert.ShowInTop("请先选择填报单位!", MessageBoxIcon.Warning); return; } }
/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem { CostManageId = this.CostManageId, InvestCostProject = this.drpInvestCostProject.SelectedValue, UseReason = this.txtUseReason.Text.Trim(), Counts = Funs.GetNewInt(this.txtCount.Text.Trim()), PriceMoney = Funs.GetNewDecimalOrZero(this.txtPriceMoney.Text.Trim()), }; if (!string.IsNullOrEmpty(this.CostManageItemId)) { costManageItem.CostManageItemId = this.CostManageItemId; BLL.CostManageItemService.UpdateCostManageItem(costManageItem); } else { this.CostManageItemId = SQLHelper.GetNewID(typeof(Model.CostGoods_CostManageItem)); costManageItem.CostManageItemId = this.CostManageItemId; BLL.CostManageItemService.AddCostManageItem(costManageItem); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); }
/// <summary> /// 检查并保存其他HSE管理活动集合 /// </summary> private void jerqueSaveMonthPlanList() { costManageItems.Clear(); JArray mergedData = Grid1.GetMergedData(); foreach (JObject mergedRow in mergedData) { string status = mergedRow.Value <string>("status"); JObject values = mergedRow.Value <JObject>("values"); int i = mergedRow.Value <int>("index"); Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem { CostManageItemId = this.Grid1.Rows[i].DataKeys[0].ToString(), InvestCostProject = values.Value <string>("InvestCostProject").ToString(), UseReason = values.Value <string>("UseReason").ToString(), Counts = Funs.GetNewIntOrZero(values.Value <string>("Counts").ToString()), PriceMoney = Funs.GetNewDecimalOrZero(values.Value <string>("PriceMoney").ToString()), AuditCounts = !string.IsNullOrEmpty(values.Value <string>("AuditCounts").ToString()) ? Funs.GetNewInt(values.Value <string>("AuditCounts").ToString()) : null, AuditPriceMoney = !string.IsNullOrEmpty(values.Value <string>("AuditPriceMoney").ToString()) ? Funs.GetNewDecimal(values.Value <string>("AuditPriceMoney").ToString()) : null }; costManageItems.Add(costManageItem); } }
/// <summary> /// 数据保存 /// </summary> /// <param name="type"></param> private void SaveData(string type) { if (this.drpAccidentTypeId.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择事故类型!", MessageBoxIcon.Warning); return; } if (this.rbIsNotConfirm.SelectedValue == "True") { if (this.drpUnitId2.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择事故责任单位!", MessageBoxIcon.Warning); return; } } else { if (this.drpUnitId.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择事故责任单位!", MessageBoxIcon.Warning); return; } } Model.Accident_AccidentReport accidentReport = new Model.Accident_AccidentReport { ProjectId = this.ProjectId, AccidentReportCode = this.txtAccidentReportCode.Text.Trim(), //accidentReport.AccidentReportType = this.drpAccidentReportType.SelectedValue; FileContent = HttpUtility.HtmlEncode(this.txtFileContents.Text) }; if (this.drpCompileMan.SelectedValue != BLL.Const._Null) { accidentReport.CompileMan = this.drpCompileMan.SelectedValue; } accidentReport.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim()); accidentReport.States = BLL.Const.State_0; accidentReport.AccidentReportName = this.txtAccidentReportName.Text.Trim(); if (this.drpAccidentTypeId.SelectedValue != BLL.Const._Null) { accidentReport.AccidentTypeId = this.drpAccidentTypeId.SelectedValue; if (this.rbIsNotConfirm.Hidden == false) { accidentReport.IsNotConfirm = Convert.ToBoolean(this.rbIsNotConfirm.SelectedValue); } } accidentReport.Abstract = this.txtAbstract.Text.Trim(); accidentReport.AccidentDate = Funs.GetNewDateTime(this.txtAccidentDate.Text.Trim()); accidentReport.WorkArea = this.txtWorkArea.Text; accidentReport.PeopleNum = Funs.GetNewIntOrZero(this.txtPeopleNum.Text.Trim()); if (accidentReport.IsNotConfirm == true) //待定事故 { accidentReport.UnitId = this.drpUnitId2.SelectedValue; accidentReport.NotConfirmWorkingHoursLoss = this.txtNotConfirmWorkingHoursLoss.Text.Trim(); accidentReport.NotConfirmEconomicLoss = this.txtNotConfirmEconomicLoss.Text.Trim(); accidentReport.NotConfirmEconomicOtherLoss = this.txtNotConfirmEconomicOtherLoss.Text.Trim(); } else { accidentReport.UnitId = this.drpUnitId.SelectedValue; accidentReport.WorkingHoursLoss = Funs.GetNewDecimalOrZero(this.txtWorkingHoursLoss.Text.Trim()); accidentReport.EconomicLoss = Funs.GetNewDecimalOrZero(this.txtEconomicLoss.Text.Trim()); accidentReport.EconomicOtherLoss = Funs.GetNewDecimalOrZero(this.txtEconomicOtherLoss.Text.Trim()); } accidentReport.ReportMan = this.txtReportMan.Text.Trim(); accidentReport.ReporterUnit = this.txtReporterUnit.Text.Trim(); accidentReport.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim()); accidentReport.ProcessDescription = this.txtProcessDescription.Text.Trim(); accidentReport.EmergencyMeasures = this.txtEmergencyMeasures.Text.Trim(); if (type == BLL.Const.BtnSubmit) { accidentReport.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.AccidentReportId)) { accidentReport.AccidentReportId = this.AccidentReportId; BLL.AccidentReport2Service.UpdateAccidentReport(accidentReport); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentReportCode.Text, this.AccidentReportId, BLL.Const.ProjectAccidentReportMenuId, Const.BtnModify); Model.Accident_AccidentReport a = BLL.AccidentReport2Service.GetAccidentReportById(this.AccidentReportId); if (type == BLL.Const.BtnSubmit && accidentReport.States == BLL.Const.State_2 && a.NotConfirmed == true) { //更新待定事故之前月报 DateTime startMonth = Convert.ToDateTime(a.AccidentDate.Value.Year + "-" + a.AccidentDate.Value.Month + "-01"); Model.Manager_MonthReportB startMonthReport = BLL.MonthReportBService.GetMonthReportByMonth(startMonth, this.ProjectId); if (startMonthReport != null) //事故当月月报 { Model.Manager_AccidentSortB sort = new Model.Manager_AccidentSortB(); if (a.AccidentTypeId == "1") { sort = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "死 亡 事 故" && x.MonthReportId == startMonthReport.MonthReportId select x).FirstOrDefault(); } else if (a.AccidentTypeId == "2") { sort = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "重 伤 事 故" && x.MonthReportId == startMonthReport.MonthReportId select x).FirstOrDefault(); } else if (a.AccidentTypeId == "3") { sort = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "轻 伤 事 故" && x.MonthReportId == startMonthReport.MonthReportId select x).FirstOrDefault(); } if (sort != null) { sort.Number += 1; sort.TotalNum += 1; sort.PersonNum += a.PeopleNum ?? 0; sort.TotalPersonNum += a.PeopleNum ?? 0; sort.LoseHours += Funs.GetNewIntOrZero((a.WorkingHoursLoss ?? 0).ToString()); sort.TotalLoseHours += Funs.GetNewIntOrZero((a.WorkingHoursLoss ?? 0).ToString()); sort.LoseMoney += (a.EconomicLoss ?? 0) + (a.EconomicOtherLoss ?? 0); sort.TotalLoseMoney += (a.EconomicLoss ?? 0) + (a.EconomicOtherLoss ?? 0); Funs.DB.SubmitChanges(); } List <Model.Manager_MonthReportB> monthReports = (from x in Funs.DB.Manager_MonthReportB where x.Months > startMonth && x.ProjectId == this.ProjectId select x).ToList(); foreach (var monthReport in monthReports) { if (monthReport != null) { Model.Manager_AccidentSortB sort1 = new Model.Manager_AccidentSortB(); if (a.AccidentTypeId == "1") { sort1 = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "死 亡 事 故" && x.MonthReportId == monthReport.MonthReportId select x).FirstOrDefault(); } else if (a.AccidentTypeId == "2") { sort1 = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "重 伤 事 故" && x.MonthReportId == monthReport.MonthReportId select x).FirstOrDefault(); } else if (a.AccidentTypeId == "3") { sort1 = (from x in Funs.DB.Manager_AccidentSortB where x.AccidentType == "轻 伤 事 故" && x.MonthReportId == monthReport.MonthReportId select x).FirstOrDefault(); } if (sort1 != null) { sort1.TotalNum += 1; sort1.TotalPersonNum += a.PeopleNum ?? 0; sort1.TotalLoseHours += Funs.GetNewIntOrZero((a.WorkingHoursLoss ?? 0).ToString()); sort1.TotalLoseMoney += (a.EconomicLoss ?? 0) + (a.EconomicOtherLoss ?? 0); Funs.DB.SubmitChanges(); } } } } } } else { this.AccidentReportId = SQLHelper.GetNewID(typeof(Model.Accident_AccidentReport)); accidentReport.AccidentReportId = this.AccidentReportId; if (accidentReport.IsNotConfirm == true) //待定事故 { accidentReport.NotConfirmed = true; } BLL.AccidentReport2Service.AddAccidentReport(accidentReport); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentReportCode.Text, this.AccidentReportId, BLL.Const.ProjectAccidentReportMenuId, Const.BtnAdd); } //保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectAccidentReportMenuId, this.AccidentReportId, (type == BLL.Const.BtnSubmit ? true : false), accidentReport.AccidentReportCode, "../Accident/AccidentReportView.aspx?AccidentReportId={0}"); }
/// <summary> /// 单价、工程量联动事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void txtQuantity_TextChanged(object sender, EventArgs e) { this.txtAuditTotalPrice.Text = (Funs.GetNewDecimalOrZero(this.txtAuditQuantity.Text) * Funs.GetNewDecimalOrZero(this.txtAuditPrice.Text)).ToString("#0.0000"); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.hdProjectA1.Text = "0"; this.hdProjectA2.Text = "0"; this.hdProjectA3.Text = "0"; this.hdProjectA4.Text = "0"; this.hdProjectA5.Text = "0"; this.hdProjectA6.Text = "0"; this.hdProjectB1.Text = "0"; this.hdProjectB2.Text = "0"; this.hdProjectB3.Text = "0"; this.InitDropDownList(); this.CostSmallDetailId = Request.Params["CostSmallDetailId"]; if (!string.IsNullOrEmpty(this.CostSmallDetailId)) { Model.CostGoods_CostSmallDetail costSmallDetail = BLL.CostSmallDetailService.GetCostSmallDetailById(this.CostSmallDetailId); if (costSmallDetail != null) { this.ProjectId = costSmallDetail.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } if (costSmallDetail.Months != null) { //this.txtMonths.Text = string.Format("{0:yyyy-MM}", costSmallDetail.Months); this.drpYear.SelectedValue = Convert.ToString(costSmallDetail.Months.Value.Year); this.drpMonths.SelectedValue = Convert.ToString(costSmallDetail.Months.Value.Month); } this.txtCostSmallDetailCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostSmallDetailId); if (!string.IsNullOrEmpty(costSmallDetail.UnitId)) { this.drpUnitId.SelectedValue = costSmallDetail.UnitId; } 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); //} decimal totalA = 0, totalB = 0, totalProjectA = 0, totalProjectB = 0; Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId); if (project != null && costSmallDetail.Months.HasValue) { List <Model.CostGoods_CostSmallDetailItem> projectDetails = BLL.CostSmallDetailItemService.GetCostDetailsByUnitId(this.CurrUser.LoginProjectId, costSmallDetail.UnitId, project != null ? project.StartDate : null, Convert.ToDateTime(costSmallDetail.Months)); List <Model.CostGoods_CostSmallDetailItem> details = BLL.CostSmallDetailItemService.GetCostSmallDetailItemByCostSmallDetailId(this.CostSmallDetailId); Model.CostGoods_CostSmallDetailItem a1 = details.FirstOrDefault(x => x.CostType == "A1"); this.hdProjectA1.Text = (from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectA2.Text = (from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectA3.Text = (from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectA4.Text = (from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectA5.Text = (from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectA6.Text = (from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectB1.Text = (from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectB2.Text = (from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum().ToString(); this.hdProjectB3.Text = (from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum().ToString(); if (a1 != null) { this.nbA1.Text = (a1.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA1.Text); this.nbProjectA1.Text = ((from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum() + a1.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA1.Text); this.txtDefA1.Text = a1.CostDef; } Model.CostGoods_CostSmallDetailItem a2 = details.FirstOrDefault(x => x.CostType == "A2"); if (a2 != null) { this.nbA2.Text = (a2.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA2.Text); this.nbProjectA2.Text = ((from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum() + a2.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA2.Text); this.txtDefA2.Text = a2.CostDef; } Model.CostGoods_CostSmallDetailItem a3 = details.FirstOrDefault(x => x.CostType == "A3"); if (a3 != null) { this.nbA3.Text = (a3.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA3.Text); this.nbProjectA3.Text = ((from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum() + a3.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA3.Text); this.txtDefA3.Text = a3.CostDef; } Model.CostGoods_CostSmallDetailItem a4 = details.FirstOrDefault(x => x.CostType == "A4"); if (a4 != null) { this.nbA4.Text = (a4.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA4.Text); this.nbProjectA4.Text = ((from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum() + a4.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA4.Text); this.txtDefA4.Text = a4.CostDef; } Model.CostGoods_CostSmallDetailItem a5 = details.FirstOrDefault(x => x.CostType == "A5"); if (a5 != null) { this.nbA5.Text = (a5.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA5.Text); this.nbProjectA5.Text = ((from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum() + a5.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA5.Text); this.txtDefA5.Text = a5.CostDef; } Model.CostGoods_CostSmallDetailItem a6 = details.FirstOrDefault(x => x.CostType == "A6"); if (a6 != null) { this.nbA6.Text = (a6.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA6.Text); this.nbProjectA6.Text = ((from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum() + a6.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA6.Text); this.txtDefA6.Text = a6.CostDef; } this.nbA.Text = totalA.ToString(); this.nbProjectA.Text = totalProjectA.ToString(); Model.CostGoods_CostSmallDetailItem b1 = details.FirstOrDefault(x => x.CostType == "B1"); if (b1 != null) { this.nbB1.Text = (b1.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB1.Text); this.nbProjectB1.Text = ((from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum() + b1.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB1.Text); this.txtDefB1.Text = b1.CostDef; } Model.CostGoods_CostSmallDetailItem b2 = details.FirstOrDefault(x => x.CostType == "B2"); if (b2 != null) { this.nbB2.Text = (b2.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB2.Text); this.nbProjectB2.Text = ((from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum() + b2.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB2.Text); this.txtDefB2.Text = b2.CostDef; } Model.CostGoods_CostSmallDetailItem b3 = details.FirstOrDefault(x => x.CostType == "B3"); if (b3 != null) { this.nbB3.Text = (b3.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB3.Text); this.nbProjectB3.Text = ((from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum() + b3.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB3.Text); this.txtDefB3.Text = b3.CostDef; } this.nbB.Text = totalB.ToString(); this.nbProjectB.Text = totalProjectB.ToString(); this.nbAB.Text = (totalA + totalB).ToString(); this.nbProjectAB.Text = (totalProjectA + totalProjectB).ToString(); } } } else { this.drpYear.SelectedValue = Convert.ToString(DateTime.Now.Year); this.drpMonths.SelectedValue = Convert.ToString(DateTime.Now.Month); //this.txtMonths.Text = DateTime.Now.ToString("yyyy-MM"); //this.txtCompileMan.Text = this.CurrUser.UserName; this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); //this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.txtCostSmallDetailCode.Text = CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectCostSmallDetailMenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostSmallDetailMenuId; this.ctlAuditFlow.DataId = this.CostSmallDetailId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { var updateCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId); if (updateCost != null) { updateCost.CostA1 = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim()); updateCost.CostA2 = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim()); updateCost.CostA3 = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim()); updateCost.CostA4 = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim()); updateCost.CostA5 = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim()); updateCost.CostA6 = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim()); updateCost.CostA7 = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim()); updateCost.CostA8 = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim()); updateCost.CostB1 = Funs.GetNewDecimalOrZero(this.txtB1.Text.Trim()); updateCost.CostB2 = Funs.GetNewDecimalOrZero(this.txtB2.Text.Trim()); updateCost.CostC1 = Funs.GetNewDecimalOrZero(this.txtC1.Text.Trim()); updateCost.CostD1 = Funs.GetNewDecimalOrZero(this.txtD1.Text.Trim()); updateCost.CostD2 = Funs.GetNewDecimalOrZero(this.txtD2.Text.Trim()); updateCost.CostD3 = Funs.GetNewDecimalOrZero(this.txtD3.Text.Trim()); updateCost.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text); updateCost.AuditCostA1 = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim()); updateCost.AuditCostA2 = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim()); updateCost.AuditCostA3 = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim()); updateCost.AuditCostA4 = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim()); updateCost.AuditCostA5 = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim()); updateCost.AuditCostA6 = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim()); updateCost.AuditCostA7 = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim()); updateCost.AuditCostA8 = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim()); updateCost.AuditedSubUnitCost = (updateCost.CostA1 + updateCost.CostA2 + updateCost.CostA3 + updateCost.CostA4 + updateCost.CostA5 + updateCost.CostA6 + updateCost.CostA7 + updateCost.CostA8) / 10000; updateCost.SubUnitCost = updateCost.AuditedSubUnitCost; if (this.drpAuditManId.SelectedValue != BLL.Const._Null) { updateCost.AuditManId = this.drpAuditManId.SelectedValue; } ////单据状态 updateCost.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { updateCost.States = BLL.Const.State_2; updateCost.StateType = "2"; Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate { FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)), MenuId = BLL.Const.ProjectHSSECostUnitManageAuditMenuId, DataId = this.HSSECostUnitManageId + "#2", ProjectId = this.ProjectId, Url = "../CostGoods/HSSECostUnitManageAuditView.aspx?HSSECostUnitManageId={0}", SortIndex = 1, OperaterTime = System.DateTime.Now, OperaterId = this.drpAuditManId.SelectedValue, AuditFlowName = "安全工程师审核", IsClosed = false, State = BLL.Const.State_1, }; Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate); Funs.DB.SubmitChanges(); } BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateCost); ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostUnitManageMenuId, this.HSSECostUnitManageId, (type == BLL.Const.BtnSubmit ? true : false), BLL.UnitService.GetUnitNameByUnitId(updateCost.UnitId) + "费用上报", "../CostGoods/HSSECostUnitManageView.aspx?HSSECostUnitManageId={0}"); if (type == BLL.Const.BtnSubmit) { var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate where x.DataId == this.HSSECostUnitManageId && (x.IsClosed == false || !x.IsClosed.HasValue) select x; if (updateNoClosedFlowOperate.Count() > 0) { foreach (var itemClosed in updateNoClosedFlowOperate) { itemClosed.OperaterId = this.CurrUser.UserId; itemClosed.IsClosed = true; Funs.DB.SubmitChanges(); } } } } }
/// <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(); this.IncentiveNoticeId = Request.Params["IncentiveNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { Model.Check_IncentiveNotice incentiveNotice = BLL.IncentiveNoticeService.GetIncentiveNoticeById(this.IncentiveNoticeId); if (incentiveNotice != null) { this.txtIncentiveNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.IncentiveNoticeId); if (!string.IsNullOrEmpty(incentiveNotice.UnitId)) { var unit = UnitService.GetUnitByUnitId(incentiveNotice.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } if (!string.IsNullOrEmpty(incentiveNotice.TeamGroupId)) { var teamGroup = TeamGroupService.GetTeamGroupById(incentiveNotice.TeamGroupId); if (teamGroup != null) { this.txtTeamGroup.Text = teamGroup.TeamGroupName; } } if (!string.IsNullOrEmpty(incentiveNotice.PersonId)) { var person = BLL.PersonService.GetPersonById(incentiveNotice.PersonId); if (person != null) { this.txtPerson.Text = person.PersonName; } } if (incentiveNotice.IncentiveDate != null) { this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", incentiveNotice.IncentiveDate); } this.txtBasicItem.Text = incentiveNotice.BasicItem; if (!string.IsNullOrEmpty(incentiveNotice.RewardType)) { Model.Sys_Const c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_RewardType).FirstOrDefault(x => x.ConstValue == incentiveNotice.RewardType); if (c != null) { this.txtRewardType.Text = c.ConstText; } } if (incentiveNotice.IncentiveMoney != null) { this.txtPayMoney.Text = Convert.ToString(incentiveNotice.IncentiveMoney); this.rbtnIncentiveWay1.Checked = true; this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPayMoney.Text));//转换大写 } if (!string.IsNullOrEmpty(incentiveNotice.TitleReward)) { this.txtTitleReward.Text = incentiveNotice.TitleReward; this.rbtnIncentiveWay2.Checked = true; } if (!string.IsNullOrEmpty(incentiveNotice.MattleReward)) { this.txtMattleReward.Text = incentiveNotice.MattleReward; this.rbtnIncentiveWay3.Checked = true; } this.AttachUrl = incentiveNotice.AttachUrl; this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(incentiveNotice.FileContents); if (!string.IsNullOrEmpty(incentiveNotice.Currency)) { this.txtCurrency.Text = incentiveNotice.Currency; } } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectIncentiveNoticeMenuId; this.ctlAuditFlow.DataId = this.IncentiveNoticeId; } }
/// <summary> /// 将Dataset的数据导入数据库 /// </summary> /// <param name="pds">数据集</param> /// <param name="Cols">数据集行数</param> /// <returns></returns> private bool AddDatasetToSQL(DataTable pds, int Cols) { string result = string.Empty; int ic, ir; ic = pds.Columns.Count; if (ic < Cols) { ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning); } ir = pds.Rows.Count; if (pds != null && ir > 0) { var accidentTypes = from x in Funs.DB.Sys_Const where x.GroupId == "0012" select x; for (int i = 0; i < ir; i++) { string row1 = pds.Rows[i][0].ToString(); string unitId = string.Empty; if (!string.IsNullOrEmpty(row1)) { var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == row1.Trim()); if (unit == null) { result += "第" + (i + 2).ToString() + "行," + "填报单位" + "," + "[" + row1 + "]不存在!" + "|"; } else { unitId = unit.UnitId; } } else { result += "第" + (i + 2).ToString() + "行," + "填报单位" + "," + "此项为必填项!" + "|"; } string row2 = pds.Rows[i][1].ToString(); if (string.IsNullOrEmpty(row2)) { result += "第" + (i + 2).ToString() + "行," + "编号" + "," + "此项为必填项!" + "|"; } string row3 = pds.Rows[i][2].ToString(); if (!string.IsNullOrEmpty(row3)) { try { Int32 year = Convert.ToInt32(row3.Trim()); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "[" + row3 + "]错误!" + "|"; } } else { result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "此项为必填项!" + "|"; } string row4 = pds.Rows[i][3].ToString(); if (!string.IsNullOrEmpty(row4)) { try { Int32 month = Convert.ToInt32(row4.Trim()); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "[" + row4 + "]错误!" + "|"; } } else { result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "此项为必填项!" + "|"; } ////判断是否 已存在该月份数据 var accidentCauseReport = BLL.AccidentCauseReportService.GetAccidentCauseReportByUnitIdAndYearAndMonth(unitId, Funs.GetNewIntOrZero(row3.Trim()), Funs.GetNewIntOrZero(row4.Trim())); if (accidentCauseReport != null) { result += "第" + (i + 2).ToString() + "行," + "已存在该月份月报!" + "|"; } string row5 = pds.Rows[i][4].ToString().Trim(); if (!string.IsNullOrEmpty(row5)) { try { Int32 deathAccident = Convert.ToInt32(row5); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "死亡事故数" + "," + "[" + row5 + "]错误!" + "|"; } } string row6 = pds.Rows[i][5].ToString().Trim(); if (!string.IsNullOrEmpty(row6)) { try { Int32 deathToll = Convert.ToInt32(row6); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "死亡人数" + "," + "[" + row6 + "]错误!" + "|"; } } string row7 = pds.Rows[i][6].ToString().Trim(); if (!string.IsNullOrEmpty(row7)) { try { Int32 injuredAccident = Convert.ToInt32(row7); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "重伤事故" + "," + "[" + row7 + "]错误!" + "|"; } } string row8 = pds.Rows[i][7].ToString().Trim(); if (!string.IsNullOrEmpty(row8)) { try { Int32 injuredToll = Convert.ToInt32(row8); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "重伤人数" + "," + "[" + row8 + "]错误!" + "|"; } } string row9 = pds.Rows[i][8].ToString().Trim(); if (!string.IsNullOrEmpty(row9)) { try { Int32 minorWoundAccident = Convert.ToInt32(row9); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "轻伤事故" + "," + "[" + row9 + "]错误!" + "|"; } } string row10 = pds.Rows[i][9].ToString().Trim(); if (!string.IsNullOrEmpty(row10)) { try { Int32 minorWoundToll = Convert.ToInt32(row10); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "轻伤人数" + "," + "[" + row10 + "]错误!" + "|"; } } string row11 = pds.Rows[i][10].ToString().Trim(); if (!string.IsNullOrEmpty(row11)) { try { Decimal averageTotalHours = Funs.GetNewDecimalOrZero(row11); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "平均工时总数" + "," + "[" + row11 + "]错误!" + "|"; } } string row12 = pds.Rows[i][11].ToString().Trim(); if (!string.IsNullOrEmpty(row12)) { try { Int32 averageManHours = Convert.ToInt32(row12); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "平均工时人数" + "," + "[" + row12 + "]错误!" + "|"; } } string row13 = pds.Rows[i][12].ToString().Trim(); if (!string.IsNullOrEmpty(row13)) { try { Int32 totalLossMan = Convert.ToInt32(row13); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "损失工时总数" + "," + "[" + row13 + "]错误!" + "|"; } } string row14 = pds.Rows[i][13].ToString().Trim(); if (!string.IsNullOrEmpty(row14)) { try { Int32 lastMonthLossHoursTotal = Convert.ToInt32(row14); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "上月损失工时总数" + "," + "[" + row14 + "]错误!" + "|"; } } string row15 = pds.Rows[i][14].ToString().Trim(); if (!string.IsNullOrEmpty(row15)) { try { Int32 knockOffTotal = Convert.ToInt32(row15); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "歇工总日数" + "," + "[" + row15 + "]错误!" + "|"; } } string row16 = pds.Rows[i][15].ToString().Trim(); if (!string.IsNullOrEmpty(row16)) { try { Int32 directLoss = Convert.ToInt32(row16); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "直接损失" + "," + "[" + row16 + "]错误!" + "|"; } } string row17 = pds.Rows[i][16].ToString().Trim(); if (!string.IsNullOrEmpty(row17)) { try { Int32 indirectLosses = Convert.ToInt32(row17); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "间接损失" + "," + "[" + row17 + "]错误!" + "|"; } } string row18 = pds.Rows[i][17].ToString().Trim(); if (!string.IsNullOrEmpty(row18)) { try { Int32 totalLoss = Convert.ToInt32(row18); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "总损失" + "," + "[" + row18 + "]错误!" + "|"; } } string row19 = pds.Rows[i][18].ToString().Trim(); if (!string.IsNullOrEmpty(row19)) { try { Int32 totalLossTime = Convert.ToInt32(row19); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "无损失工时总数" + "," + "[" + row19 + "]错误!" + "|"; } } //string row20 = pds.Rows[i][19].ToString().Trim(); string row21 = pds.Rows[i][20].ToString().Trim(); if (!string.IsNullOrEmpty(row21)) { if (accidentTypes.Where(x => x.ConstValue == row21.Trim()).FirstOrDefault() == null) { result += "第" + (i + 2).ToString() + "行," + "事故类别" + "," + "[" + row21 + "]不存在!" + "|"; } } else { result += "第" + (i + 2).ToString() + "行," + "事故类别" + "," + "此项为必填项!" + "|"; } string row22 = pds.Rows[i][21].ToString().Trim(); if (!string.IsNullOrEmpty(row22)) { try { Int32 death1 = Convert.ToInt32(row22); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失死亡数" + "," + "[" + row22 + "]错误!" + "|"; } } string row23 = pds.Rows[i][22].ToString().Trim(); if (!string.IsNullOrEmpty(row23)) { try { Int32 injuries1 = Convert.ToInt32(row23); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失重伤数" + "," + "[" + row23 + "]错误!" + "|"; } } string row24 = pds.Rows[i][23].ToString().Trim(); if (!string.IsNullOrEmpty(row24)) { try { Int32 minorInjuries1 = Convert.ToInt32(row24); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失轻伤数" + "," + "[" + row24 + "]错误!" + "|"; } } string row25 = pds.Rows[i][24].ToString().Trim(); if (!string.IsNullOrEmpty(row25)) { try { Int32 death2 = Convert.ToInt32(row25); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷死亡数" + "," + "[" + row25 + "]错误!" + "|"; } } string row26 = pds.Rows[i][25].ToString().Trim(); if (!string.IsNullOrEmpty(row26)) { try { Int32 injuries2 = Convert.ToInt32(row26); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷重伤数" + "," + "[" + row26 + "]错误!" + "|"; } } string row27 = pds.Rows[i][26].ToString().Trim(); if (!string.IsNullOrEmpty(row27)) { try { Int32 minorInjuries2 = Convert.ToInt32(row27); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷轻伤数" + "," + "[" + row27 + "]错误!" + "|"; } } string row28 = pds.Rows[i][27].ToString().Trim(); if (!string.IsNullOrEmpty(row28)) { try { Int32 death3 = Convert.ToInt32(row28); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷死亡数" + "," + "[" + row28 + "]错误!" + "|"; } } string row29 = pds.Rows[i][28].ToString().Trim(); if (!string.IsNullOrEmpty(row29)) { try { Int32 injuries3 = Convert.ToInt32(row29); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷重伤数" + "," + "[" + row29 + "]错误!" + "|"; } } string row30 = pds.Rows[i][29].ToString().Trim(); if (!string.IsNullOrEmpty(row30)) { try { Int32 minorInjuries3 = Convert.ToInt32(row30); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷轻伤数" + "," + "[" + row30 + "]错误!" + "|"; } } string row31 = pds.Rows[i][30].ToString().Trim(); if (!string.IsNullOrEmpty(row31)) { try { Int32 death4 = Convert.ToInt32(row31); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "光线不足死亡数" + "," + "[" + row31 + "]错误!" + "|"; } } string row32 = pds.Rows[i][31].ToString().Trim(); if (!string.IsNullOrEmpty(row32)) { try { Int32 injuries4 = Convert.ToInt32(row32); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "光线不足重伤数" + "," + "[" + row32 + "]错误!" + "|"; } } string row33 = pds.Rows[i][32].ToString().Trim(); if (!string.IsNullOrEmpty(row33)) { try { Int32 minorInjuries4 = Convert.ToInt32(row33); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "光线不足轻伤数" + "," + "[" + row33 + "]错误!" + "|"; } } string row34 = pds.Rows[i][33].ToString().Trim(); if (!string.IsNullOrEmpty(row34)) { try { Int32 death5 = Convert.ToInt32(row34); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理死亡数" + "," + "[" + row34 + "]错误!" + "|"; } } string row35 = pds.Rows[i][34].ToString().Trim(); if (!string.IsNullOrEmpty(row35)) { try { Int32 injuries5 = Convert.ToInt32(row35); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理重伤数" + "," + "[" + row35 + "]错误!" + "|"; } } string row36 = pds.Rows[i][35].ToString().Trim(); if (!string.IsNullOrEmpty(row36)) { try { Int32 minorInjuries5 = Convert.ToInt32(row36); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理轻伤数" + "," + "[" + row36 + "]错误!" + "|"; } } string row37 = pds.Rows[i][36].ToString().Trim(); if (!string.IsNullOrEmpty(row37)) { try { Int32 death6 = Convert.ToInt32(row37); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "现场指导错误死亡数" + "," + "[" + row37 + "]错误!" + "|"; } } string row38 = pds.Rows[i][37].ToString().Trim(); if (!string.IsNullOrEmpty(row38)) { try { Int32 injuries6 = Convert.ToInt32(row38); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "现场指导错误重伤数" + "," + "[" + row38 + "]错误!" + "|"; } } string row39 = pds.Rows[i][38].ToString().Trim(); if (!string.IsNullOrEmpty(row39)) { try { Int32 minorInjuries6 = Convert.ToInt32(row39); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "现场指导错误轻伤数" + "," + "[" + row39 + "]错误!" + "|"; } } string row40 = pds.Rows[i][39].ToString().Trim(); if (!string.IsNullOrEmpty(row40)) { try { Int32 death7 = Convert.ToInt32(row40); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设计有缺陷死亡数" + "," + "[" + row40 + "]错误!" + "|"; } } string row41 = pds.Rows[i][40].ToString().Trim(); if (!string.IsNullOrEmpty(row41)) { try { Int32 injuries7 = Convert.ToInt32(row41); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设计有缺陷重伤数" + "," + "[" + row41 + "]错误!" + "|"; } } string row42 = pds.Rows[i][41].ToString().Trim(); if (!string.IsNullOrEmpty(row42)) { try { Int32 minorInjuries7 = Convert.ToInt32(row42); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "设计有缺陷轻伤数" + "," + "[" + row42 + "]错误!" + "|"; } } string row43 = pds.Rows[i][42].ToString().Trim(); if (!string.IsNullOrEmpty(row43)) { try { Int32 death8 = Convert.ToInt32(row43); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "不懂操作死亡数" + "," + "[" + row43 + "]错误!" + "|"; } } string row44 = pds.Rows[i][43].ToString().Trim(); if (!string.IsNullOrEmpty(row44)) { try { Int32 injuries8 = Convert.ToInt32(row44); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "不懂操作重伤数" + "," + "[" + row44 + "]错误!" + "|"; } } string row45 = pds.Rows[i][44].ToString().Trim(); if (!string.IsNullOrEmpty(row45)) { try { Int32 minorInjuries8 = Convert.ToInt32(row45); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "不懂操作轻伤数" + "," + "[" + row45 + "]错误!" + "|"; } } string row46 = pds.Rows[i][45].ToString().Trim(); if (!string.IsNullOrEmpty(row46)) { try { Int32 death9 = Convert.ToInt32(row46); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "违反操作死亡数" + "," + "[" + row46 + "]错误!" + "|"; } } string row47 = pds.Rows[i][46].ToString().Trim(); if (!string.IsNullOrEmpty(row47)) { try { Int32 injuries9 = Convert.ToInt32(row47); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "违反操作重伤数" + "," + "[" + row47 + "]错误!" + "|"; } } string row48 = pds.Rows[i][47].ToString().Trim(); if (!string.IsNullOrEmpty(row48)) { try { Int32 minorInjuries9 = Convert.ToInt32(row48); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "违反操作轻伤数" + "," + "[" + row48 + "]错误!" + "|"; } } string row49 = pds.Rows[i][48].ToString().Trim(); if (!string.IsNullOrEmpty(row49)) { try { Int32 death10 = Convert.ToInt32(row49); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "没有安全操作死亡数" + "," + "[" + row49 + "]错误!" + "|"; } } string row50 = pds.Rows[i][49].ToString().Trim(); if (!string.IsNullOrEmpty(row50)) { try { Int32 injuries10 = Convert.ToInt32(row50); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "没有安全操作重伤数" + "," + "[" + row50 + "]错误!" + "|"; } } string row51 = pds.Rows[i][50].ToString().Trim(); if (!string.IsNullOrEmpty(row51)) { try { Int32 minorInjuries10 = Convert.ToInt32(row51); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "没有安全操作轻伤数" + "," + "[" + row51 + "]错误!" + "|"; } } string row52 = pds.Rows[i][51].ToString().Trim(); if (!string.IsNullOrEmpty(row52)) { try { Int32 death11 = Convert.ToInt32(row52); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "其他死亡数" + "," + "[" + row52 + "]错误!" + "|"; } } string row53 = pds.Rows[i][52].ToString().Trim(); if (!string.IsNullOrEmpty(row53)) { try { Int32 injuries11 = Convert.ToInt32(row53); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "其他重伤数" + "," + "[" + row53 + "]错误!" + "|"; } } string row54 = pds.Rows[i][53].ToString().Trim(); if (!string.IsNullOrEmpty(row54)) { try { Int32 minorInjuries11 = Convert.ToInt32(row54); } catch (Exception) { result += "第" + (i + 2).ToString() + "行," + "其他轻伤数" + "," + "[" + row54 + "]错误!" + "|"; } } } if (!string.IsNullOrEmpty(result)) { result = result.Substring(0, result.LastIndexOf("|")); ShowNotify(result, MessageBoxIcon.Warning); Session["errorInfos"] = result; } else { Session["errorInfos"] = null; ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { ShowNotify("导入数据为空!", MessageBoxIcon.Warning); } return(true); }
/// <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(); this.ExpenseId = Request.Params["ExpenseId"]; if (!string.IsNullOrEmpty(this.ExpenseId)) { Model.CostGoods_Expense expense = BLL.ExpenseService.GetExpenseById(this.ExpenseId); if (expense != null) { this.txtExpenseCode.Text = CodeRecordsService.ReturnCodeByDataId(this.ExpenseId); if (expense.Months != null) { this.txtMonths.Text = string.Format("{0:yyyy-MM}", expense.Months); } if (!string.IsNullOrEmpty(expense.UnitId)) { Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(expense.UnitId); if (unit != null) { this.drpUnitId.Text = unit.UnitName; } } if (expense.ReportDate != null) { this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", expense.ReportDate); } //this.txtCompileMan.Text = expense.CompileMan; //if (expense.CompileDate != null) //{ // this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", expense.CompileDate); //} //this.txtCheckMan.Text = expense.CheckMan; //if (expense.CheckDate != null) //{ // this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", expense.CheckDate); //} //this.txtApproveMan.Text = expense.ApproveMan; //if (expense.ApproveDate != null) //{ // this.txtApproveDate.Text = string.Format("{0:yyyy-MM-dd}", expense.ApproveDate); //} decimal totalA = 0, totalB = 0, totalProjectA = 0, totalProjectB = 0; Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(expense.ProjectId); List <Model.CostGoods_ExpenseDetail> projectDetails = BLL.ExpenseDetailService.GetCostDetailsByUnitId(expense.UnitId, project != null ? Convert.ToDateTime(project.StartDate) : Convert.ToDateTime("2000-01-01"), Convert.ToDateTime(expense.Months)); List <Model.CostGoods_ExpenseDetail> details = BLL.ExpenseDetailService.GetExpenseDetailsByExpenseId(this.ExpenseId); Model.CostGoods_ExpenseDetail a1 = details.FirstOrDefault(x => x.CostType == "A1"); if (a1 != null) { this.nbA1.Text = (a1.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA1.Text); this.nbProjectA1.Text = ((from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum() + a1.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA1.Text); this.txtDefA1.Text = a1.CostDef; } Model.CostGoods_ExpenseDetail a2 = details.FirstOrDefault(x => x.CostType == "A2"); if (a2 != null) { this.nbA2.Text = (a2.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA2.Text); this.nbProjectA2.Text = ((from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum() + a2.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA2.Text); this.txtDefA2.Text = a2.CostDef; } Model.CostGoods_ExpenseDetail a3 = details.FirstOrDefault(x => x.CostType == "A3"); if (a3 != null) { this.nbA3.Text = (a3.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA3.Text); this.nbProjectA3.Text = ((from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum() + a3.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA3.Text); this.txtDefA3.Text = a3.CostDef; } Model.CostGoods_ExpenseDetail a4 = details.FirstOrDefault(x => x.CostType == "A4"); if (a4 != null) { this.nbA4.Text = (a4.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA4.Text); this.nbProjectA4.Text = ((from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum() + a4.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA4.Text); this.txtDefA4.Text = a4.CostDef; } Model.CostGoods_ExpenseDetail a5 = details.FirstOrDefault(x => x.CostType == "A5"); if (a5 != null) { this.nbA5.Text = (a5.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA5.Text); this.nbProjectA5.Text = ((from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum() + a5.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA5.Text); this.txtDefA5.Text = a5.CostDef; } Model.CostGoods_ExpenseDetail a6 = details.FirstOrDefault(x => x.CostType == "A6"); if (a6 != null) { this.nbA6.Text = (a6.CostMoney ?? 0).ToString(); totalA += Funs.GetNewDecimalOrZero(this.nbA6.Text); this.nbProjectA6.Text = ((from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum() + a6.CostMoney ?? 0).ToString(); totalProjectA += Funs.GetNewDecimalOrZero(this.nbProjectA6.Text); this.txtDefA6.Text = a6.CostDef; } this.nbA.Text = totalA.ToString(); this.nbProjectA.Text = totalProjectA.ToString(); Model.CostGoods_ExpenseDetail b1 = details.FirstOrDefault(x => x.CostType == "B1"); if (b1 != null) { this.nbB1.Text = (b1.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB1.Text); this.nbProjectB1.Text = ((from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum() + b1.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB1.Text); this.txtDefB1.Text = b1.CostDef; } Model.CostGoods_ExpenseDetail b2 = details.FirstOrDefault(x => x.CostType == "B2"); if (b2 != null) { this.nbB2.Text = (b2.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB2.Text); this.nbProjectB2.Text = ((from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum() + b2.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB2.Text); this.txtDefB2.Text = b2.CostDef; } Model.CostGoods_ExpenseDetail b3 = details.FirstOrDefault(x => x.CostType == "B3"); if (b3 != null) { this.nbB3.Text = (b3.CostMoney ?? 0).ToString(); totalB += Funs.GetNewDecimalOrZero(this.nbB3.Text); this.nbProjectB3.Text = ((from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum() + b3.CostMoney ?? 0).ToString(); totalProjectB += Funs.GetNewDecimalOrZero(this.nbProjectB3.Text); this.txtDefB3.Text = b3.CostDef; } this.nbB.Text = totalB.ToString(); this.nbProjectB.Text = totalProjectB.ToString(); this.nbAB.Text = (totalA + totalB).ToString(); this.nbProjectAB.Text = (totalProjectA + totalProjectB).ToString(); } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectExpenseMenuId; this.ctlAuditFlow.DataId = this.ExpenseId; } }
///// <summary> ///// 附件 ///// </summary> //private string AttchUrl //{ // get // { // return (string)ViewState["AttchUrl"]; // } // set // { // ViewState["AttchUrl"] = value; // } //} #endregion #region 加载 /// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.InitDropDownList(); this.PunishNoticeId = Request.Params["PunishNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.PunishNoticeId)) { Model.Check_PunishNotice punishNotice = BLL.PunishNoticeService.GetPunishNoticeById(this.PunishNoticeId); if (punishNotice != null) { this.ProjectId = punishNotice.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } this.txtPunishNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PunishNoticeId); this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", punishNotice.PunishNoticeDate); if (!string.IsNullOrEmpty(punishNotice.UnitId)) { this.drpUnitId.SelectedValue = punishNotice.UnitId; } this.txtIncentiveReason.Text = punishNotice.IncentiveReason; this.txtBasicItem.Text = punishNotice.BasicItem; if (punishNotice.PunishMoney.HasValue) { this.txtPunishMoney.Text = Convert.ToString(punishNotice.PunishMoney); this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text)); } //this.AttchUrl = punishNotice.AttachUrl; //this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttchUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(punishNotice.FileContents); if (!string.IsNullOrEmpty(punishNotice.SignMan)) { this.drpSignMan.SelectedValue = punishNotice.SignMan; } if (!string.IsNullOrEmpty(punishNotice.ApproveMan)) { this.drpApproveMan.SelectedValue = punishNotice.ApproveMan; } this.txtContractNum.Text = punishNotice.ContractNum; if (!string.IsNullOrEmpty(punishNotice.Currency)) { this.txtCurrency.Text = punishNotice.Currency; } this.drpPunishName.SelectedValue = punishNotice.PunishName; } } else { this.drpSignMan.SelectedValue = this.CurrUser.UserId; this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectPunishNoticeMenuId, this.ProjectId); if (codeTemplateRule != null) { this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } ////自动生成编码 this.txtPunishNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectPunishNoticeMenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectPunishNoticeMenuId; this.ctlAuditFlow.DataId = this.PunishNoticeId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { if (string.IsNullOrEmpty(this.drpUnitId.SelectedValue)) { Alert.ShowInTop("请选择受罚单位", MessageBoxIcon.Warning); return; } Model.Check_PunishNotice punishNotice = new Model.Check_PunishNotice { ProjectId = this.ProjectId, PunishNoticeCode = this.txtPunishNoticeCode.Text.Trim() }; if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue)) { punishNotice.UnitId = this.drpUnitId.SelectedValue; } punishNotice.PunishName = this.drpPunishName.SelectedValue; punishNotice.PunishNoticeDate = Funs.GetNewDateTime(this.txtPunishNoticeDate.Text.Trim()); punishNotice.IncentiveReason = this.txtIncentiveReason.Text.Trim(); punishNotice.BasicItem = this.txtBasicItem.Text.Trim(); punishNotice.PunishMoney = Funs.GetNewDecimalOrZero(this.txtPunishMoney.Text.Trim()); punishNotice.FileContents = HttpUtility.HtmlEncode(this.txtFileContents.Text); //punishNotice.AttachUrl = this.AttchUrl; punishNotice.CompileMan = this.CurrUser.UserId; punishNotice.CompileDate = DateTime.Now; punishNotice.States = Const.State_0; if (this.drpSignMan.SelectedValue != BLL.Const._Null) { punishNotice.SignMan = this.drpSignMan.SelectedValue; } if (this.drpApproveMan.SelectedValue != BLL.Const._Null) { punishNotice.ApproveMan = this.drpApproveMan.SelectedValue; } punishNotice.ContractNum = this.txtContractNum.Text.Trim(); punishNotice.Currency = this.txtCurrency.Text.Trim(); if (type == BLL.Const.BtnSubmit) { punishNotice.States = this.ctlAuditFlow.NextStep; } punishNotice.PunishStates = punishNotice.States; if (punishNotice.States == Const.State_2) { punishNotice.PunishStates = Const.State_4; } if (!string.IsNullOrEmpty(this.PunishNoticeId)) { punishNotice.PunishNoticeId = this.PunishNoticeId; BLL.PunishNoticeService.UpdatePunishNotice(punishNotice); BLL.LogService.AddSys_Log(this.CurrUser, punishNotice.PunishNoticeCode, punishNotice.PunishNoticeId, BLL.Const.ProjectPunishNoticeMenuId, BLL.Const.BtnModify); } else { this.PunishNoticeId = SQLHelper.GetNewID(typeof(Model.Check_PunishNotice)); punishNotice.PunishNoticeId = this.PunishNoticeId; BLL.PunishNoticeService.AddPunishNotice(punishNotice); BLL.LogService.AddSys_Log(this.CurrUser, punishNotice.PunishNoticeCode, punishNotice.PunishNoticeId, BLL.Const.ProjectPunishNoticeMenuId, BLL.Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectPunishNoticeMenuId, this.PunishNoticeId, (type == BLL.Const.BtnSubmit ? true : false), punishNotice.PunishNoticeCode, "../Check/PunishNoticeView.aspx?PunishNoticeId={0}"); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); BLL.UserService.InitUserDropDownList(this.drpSignMan, this.CurrUser.LoginProjectId, true); BLL.UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true); Funs.FineUIPleaseSelect(this.drpTeamGroup); Funs.FineUIPleaseSelect(this.drpPerson); BLL.UserService.InitUserDropDownList(this.drpApproveMan, this.CurrUser.LoginProjectId, true); BLL.ConstValue.InitConstValueDropDownList(this.drpRewardType, BLL.ConstValue.Group_RewardType, true); BindGrid(string.Empty); this.IncentiveNoticeId = Request.Params["IncentiveNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.IncentiveNoticeId)) { Model.Check_IncentiveNotice incentiveNotice = BLL.IncentiveNoticeService.GetIncentiveNoticeById(this.IncentiveNoticeId); if (incentiveNotice != null) { this.ProjectId = incentiveNotice.ProjectId; this.txtIncentiveNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.IncentiveNoticeId); if (!string.IsNullOrEmpty(incentiveNotice.UnitId)) { this.drpUnit.SelectedValue = incentiveNotice.UnitId; BLL.TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroup, this.ProjectId, incentiveNotice.UnitId, true); if (!string.IsNullOrEmpty(incentiveNotice.TeamGroupId)) { this.drpTeamGroup.SelectedValue = incentiveNotice.TeamGroupId; } BLL.PersonService.InitPersonByProjectUnitDropDownList(this.drpPerson, this.ProjectId, incentiveNotice.UnitId, true); if (!string.IsNullOrEmpty(incentiveNotice.PersonId)) { this.drpPerson.SelectedValue = incentiveNotice.PersonId; } } this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", incentiveNotice.IncentiveDate); this.txtBasicItem.Text = incentiveNotice.BasicItem; if (!string.IsNullOrEmpty(incentiveNotice.RewardType)) { this.drpRewardType.SelectedValue = incentiveNotice.RewardType; } if (incentiveNotice.IncentiveMoney.HasValue) { this.txtPayMoney.Text = Convert.ToString(incentiveNotice.IncentiveMoney); this.rbtnIncentiveWay1.Checked = true; this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(this.txtPayMoney.Text));//转换大写 } if (!string.IsNullOrEmpty(incentiveNotice.TitleReward)) { this.txtTitleReward.Text = incentiveNotice.TitleReward; this.rbtnIncentiveWay2.Checked = true; } if (!string.IsNullOrEmpty(incentiveNotice.MattleReward)) { this.txtMattleReward.Text = incentiveNotice.MattleReward; this.rbtnIncentiveWay3.Checked = true; } this.AttachUrl = incentiveNotice.AttachUrl; this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(incentiveNotice.FileContents); if (!string.IsNullOrEmpty(incentiveNotice.SignMan)) { this.drpSignMan.SelectedValue = incentiveNotice.SignMan; } if (!string.IsNullOrEmpty(incentiveNotice.ApproveMan)) { this.drpApproveMan.SelectedValue = incentiveNotice.ApproveMan; } if (!string.IsNullOrEmpty(incentiveNotice.Currency)) { this.txtCurrency.Text = incentiveNotice.Currency; } } } else { this.drpSignMan.SelectedValue = this.CurrUser.UserId; this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectIncentiveNoticeMenuId, this.ProjectId); if (codeTemplateRule != null) { this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } ////自动生成编码 this.txtIncentiveNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectIncentiveNoticeMenuId, this.ProjectId, this.CurrUser.UnitId); } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectIncentiveNoticeMenuId; this.ctlAuditFlow.DataId = this.IncentiveNoticeId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }