Exemplo n.º 1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.CostGoods_CostSmallDetail costSmallDetail = new Model.CostGoods_CostSmallDetail
            {
                ProjectId = this.ProjectId
            };
            //if (!string.IsNullOrEmpty(this.txtMonths.Text))
            //{
            //    costSmallDetail.Months = Funs.GetNewDateTime(this.txtMonths.Text + "-01");
            //}
            if (this.drpYear.SelectedValue != BLL.Const._Null && this.drpMonths.SelectedValue != BLL.Const._Null)
            {
                costSmallDetail.Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue);
            }
            costSmallDetail.CostSmallDetailCode = this.txtCostSmallDetailCode.Text.Trim();
            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                costSmallDetail.UnitId = this.drpUnitId.SelectedValue;
            }
            costSmallDetail.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());

            //costSmallDetail.CheckMan = this.txtCheckMan.Text;
            //costSmallDetail.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
            //costSmallDetail.ApproveMan = this.txtApproveMan.Text;
            //costSmallDetail.ApproveDate = Funs.GetNewDateTime(this.txtApproveDate.Text.Trim());
            costSmallDetail.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                costSmallDetail.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CostSmallDetailId))
            {
                costSmallDetail.CostSmallDetailId = this.CostSmallDetailId;
                BLL.CostSmallDetailService.UpdateCostSmallDetail(costSmallDetail);
                BLL.LogService.AddSys_Log(this.CurrUser, costSmallDetail.CostSmallDetailCode, costSmallDetail.CostSmallDetailId, BLL.Const.ProjectCostSmallDetailMenuId, BLL.Const.BtnModify);
                BLL.CostSmallDetailItemService.DeleteCostSmallDetailItemByCostSmallDetailId(this.CostSmallDetailId);
            }
            else
            {
                this.CostSmallDetailId            = SQLHelper.GetNewID(typeof(Model.CostGoods_CostSmallDetail));
                costSmallDetail.CostSmallDetailId = this.CostSmallDetailId;
                //costSmallDetail.CompileMan = this.CurrUser.UserName;
                costSmallDetail.CompileDate = DateTime.Now;
                BLL.CostSmallDetailService.AddCostSmallDetail(costSmallDetail);
                BLL.LogService.AddSys_Log(this.CurrUser, costSmallDetail.CostSmallDetailCode, costSmallDetail.CostSmallDetailId, BLL.Const.ProjectCostSmallDetailMenuId, BLL.Const.BtnAdd);
            }
            //保存费用明细
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A1", Funs.GetNewDecimalOrZero(this.nbA1.Text), this.txtDefA1.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A2", Funs.GetNewDecimalOrZero(this.nbA2.Text), this.txtDefA2.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A3", Funs.GetNewDecimalOrZero(this.nbA3.Text), this.txtDefA3.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A4", Funs.GetNewDecimalOrZero(this.nbA4.Text), this.txtDefA4.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A5", Funs.GetNewDecimalOrZero(this.nbA5.Text), this.txtDefA5.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A6", Funs.GetNewDecimalOrZero(this.nbA6.Text), this.txtDefA6.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B1", Funs.GetNewDecimalOrZero(this.nbB1.Text), this.txtDefB1.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B2", Funs.GetNewDecimalOrZero(this.nbB2.Text), this.txtDefB2.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B3", Funs.GetNewDecimalOrZero(this.nbB3.Text), this.txtDefB3.Text.Trim());
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCostSmallDetailMenuId, this.CostSmallDetailId, (type == BLL.Const.BtnSubmit ? true : false), costSmallDetail.CostSmallDetailCode, "../CostGoods/CostSmallDetailView.aspx?CostSmallDetailId={0}");
        }
Exemplo n.º 2
0
 /// <summary>
 /// 修改安全费用投入登记
 /// </summary>
 /// <param name="costSmallDetail"></param>
 public static void UpdateCostSmallDetail(Model.CostGoods_CostSmallDetail costSmallDetail)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.CostGoods_CostSmallDetail newCostSmallDetail = db.CostGoods_CostSmallDetail.FirstOrDefault(e => e.CostSmallDetailId == costSmallDetail.CostSmallDetailId);
     if (newCostSmallDetail != null)
     {
         //newCostSmallDetail.ProjectId = costSmallDetail.ProjectId;
         newCostSmallDetail.CostSmallDetailCode = costSmallDetail.CostSmallDetailCode;
         newCostSmallDetail.UnitId = costSmallDetail.UnitId;
         newCostSmallDetail.States = costSmallDetail.States;
         // newCostSmallDetail.CompileMan = costSmallDetail.CompileMan;
         //newCostSmallDetail.CompileDate = costSmallDetail.CompileDate;
         newCostSmallDetail.Months     = costSmallDetail.Months;
         newCostSmallDetail.ReportDate = costSmallDetail.ReportDate;
         // newCostSmallDetail.CheckMan = costSmallDetail.CheckMan;
         newCostSmallDetail.CheckDate = costSmallDetail.CheckDate;
         // newCostSmallDetail.ApproveMan = costSmallDetail.ApproveMan;
         newCostSmallDetail.ApproveDate = costSmallDetail.ApproveDate;
         db.SubmitChanges();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 根据主键删除安全费用投入登记
 /// </summary>
 /// <param name="costSmallDetailId"></param>
 public static void DeleteCostSmallDetailById(string costSmallDetailId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.CostGoods_CostSmallDetail costSmallDetail = db.CostGoods_CostSmallDetail.FirstOrDefault(e => e.CostSmallDetailId == costSmallDetailId);
     if (costSmallDetail != null)
     {
         CodeRecordsService.DeleteCodeRecordsByDataId(costSmallDetailId); //删除编号
         CommonService.DeleteAttachFileById(costSmallDetailId);           //删除附件
         ///删除工程师日志收集记录
         var flowOperate = from x in db.Sys_FlowOperate where x.DataId == costSmallDetail.CostSmallDetailId select x;
         if (flowOperate.Count() > 0)
         {
             foreach (var item in flowOperate)
             {
                 BLL.HSSELogService.CollectHSSELog(costSmallDetail.ProjectId, item.OperaterId, item.OperaterTime, "33", "审核" + BLL.UnitService.GetUnitNameByUnitId(costSmallDetail.UnitId) + "的费用申请", Const.BtnDelete, 1);
             }
             ////删除流程表
             BLL.CommonService.DeleteFlowOperateByID(costSmallDetail.CostSmallDetailId);
         }
         db.CostGoods_CostSmallDetail.DeleteOnSubmit(costSmallDetail);
         db.SubmitChanges();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 添加安全费用投入登记
 /// </summary>
 /// <param name="costSmallDetail"></param>
 public static void AddCostSmallDetail(Model.CostGoods_CostSmallDetail costSmallDetail)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.CostGoods_CostSmallDetail newCostSmallDetail = new Model.CostGoods_CostSmallDetail
     {
         CostSmallDetailId   = costSmallDetail.CostSmallDetailId,
         ProjectId           = costSmallDetail.ProjectId,
         CostSmallDetailCode = costSmallDetail.CostSmallDetailCode,
         UnitId = costSmallDetail.UnitId,
         States = costSmallDetail.States,
         //newCostSmallDetail.CompileMan = costSmallDetail.CompileMan;
         CompileDate = costSmallDetail.CompileDate,
         Months      = costSmallDetail.Months,
         ReportDate  = costSmallDetail.ReportDate,
         //newCostSmallDetail.CheckMan = costSmallDetail.CheckMan;
         CheckDate = costSmallDetail.CheckDate,
         // newCostSmallDetail.ApproveMan = costSmallDetail.ApproveMan;
         ApproveDate = costSmallDetail.ApproveDate
     };
     db.CostGoods_CostSmallDetail.InsertOnSubmit(newCostSmallDetail);
     db.SubmitChanges();
     CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectCostSmallDetailMenuId, costSmallDetail.ProjectId, null, costSmallDetail.CostSmallDetailId, costSmallDetail.CompileDate);
 }
Exemplo n.º 5
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();
         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;
     }
 }