protected void btnSave_Click(object sender, EventArgs e) { string msg = ""; string ResponsiblePerson = this.txtResponsiblePerson.Text.Trim(); string ClaimReason = this.txtClaimReason.Text.Trim(); if (!string.IsNullOrEmpty(ResponsiblePerson)) { //调用XMPremiumsAdd.aspx的ToSave函数 if (Session["SavePremiumsAddData"] != null) { XMPremiums data = (XMPremiums)Session["SavePremiumsAddData"]; string OrderCode = data.OrderCode; string wangwang = data.WantId; string ApplicationTypeId = data.PremiumsTypeId.ToString(); string PaymentPerson = data.PaymentPerson.ToString(); bool chk = (bool)data.IsEnable; string note = data.Note; string NickId = data.NoOrderNickId; XMPremiumsAdd PremiumsAddPage = new XMPremiumsAdd(); PremiumsAddPage.ToSave(ref msg, OrderCode, wangwang, ApplicationTypeId, PaymentPerson, chk, ID, ResponsiblePerson, ClaimReason, note, NickId, true); base.ShowMessage(msg); } } else { base.ShowMessage("责任人必须填写!"); } }
protected void btnSave_Click(object sender, EventArgs e) { string OrderCode = this.TxtOrderCode.Text.Trim(); string WangNo = this.TxtWangNo.Text.Trim(); string ApplicationType = this.DdApplicationType.SelectedValue; string PaymentPerson = this.DdlPaymentPerson.SelectedValue; if (PaymentPerson == "-1") { base.ShowMessage("请先选择赔付方!"); return; } var Premiums = base.XMPremiumsService.GetXMPremiumsListByQuestionDetailID(Id.ToString()); if (Premiums != null) { if (Premiums.ManagerStatus == Convert.ToInt32(StatusEnum.AlreadyCheck)) { base.ShowMessage("财务已审核的数据,不可编辑!"); return; } Premiums.OrderCode = OrderCode; //订单号 Premiums.WantId = WangNo; //旺旺号 Premiums.PremiumsTypeId = int.Parse(ApplicationType); //申请类型 Premiums.PaymentPerson = int.Parse(PaymentPerson); Premiums.UpdatorID = HozestERPContext.Current.User.CustomerID; Premiums.UpdateTime = DateTime.Now; base.XMPremiumsService.UpdateXMPremiums(Premiums); } else { XMPremiums XMPremium = new XMPremiums(); XMPremium.QuestionDetailID = Id.ToString(); XMPremium.OrderCode = OrderCode; //订单号 XMPremium.WantId = WangNo; //旺旺号 XMPremium.PaymentPerson = int.Parse(PaymentPerson); XMPremium.PremiumsTypeId = int.Parse(ApplicationType); //申请类型 XMPremium.ManagerStatus = Convert.ToInt32(StatusEnum.NotCheck); XMPremium.PremiumsStatus = Convert.ToInt32(StatusEnum.PremiumsNoHair); XMPremium.IsEnable = false; XMPremium.IsEvaluation = false; XMPremium.IsSingleRow = false; XMPremium.FinanceIsAudit = false; XMPremium.CreatorID = HozestERPContext.Current.User.CustomerID; XMPremium.CreateTime = DateTime.Now; XMPremium.UpdatorID = HozestERPContext.Current.User.CustomerID; XMPremium.UpdateTime = DateTime.Now; base.XMPremiumsService.InsertXMPremiums(XMPremium); } base.ShowMessage("保存成功!"); BindGrid(false); }
public bool AddClaimInfo(XMPremiums Info, int NickId) { var ClaimInfo = base.XMClaimInfoService.GetXMClaimInfoByPremiumsId(Info.Id); if (ClaimInfo != null) { var ClaimInfoDetail = base.XMClaimInfoDetailService.GetXMClaimInfoDetailListByClaimInfoID(ClaimInfo.Id); if (ClaimInfoDetail != null && ClaimInfoDetail.Count > 0) { var ConfirmCount = ClaimInfoDetail.Where(x => x.IsConfirm == true).ToList(); if (ConfirmCount != null && ConfirmCount.Count > 0) { return(false); } else { ClaimInfo.IsEnable = true; ClaimInfo.UpdateDate = DateTime.Now; ClaimInfo.UpdateID = HozestERPContext.Current.User.CustomerID; base.XMClaimInfoService.UpdateXMClaimInfo(ClaimInfo); foreach (var a in ClaimInfoDetail) { a.IsEnable = true; a.UpdateDate = DateTime.Now; a.UpdateID = HozestERPContext.Current.User.CustomerID; base.XMClaimInfoDetailService.UpdateXMClaimInfoDetail(a); } } } else { return(false); } } HozestERP.BusinessLogic.ManageProject.XMClaimInfo ONE = new HozestERP.BusinessLogic.ManageProject.XMClaimInfo(); HozestERP.BusinessLogic.ManageProject.XMClaimInfoDetail one = new HozestERP.BusinessLogic.ManageProject.XMClaimInfoDetail(); ONE.OrderCode = Info.OrderCode; ONE.PremiumsId = Info.Id; ONE.NickId = NickId; var OrderInfo = base.XMOrderInfoService.GetXMOrderInfoByOrderCode(Info.OrderCode); if (OrderInfo != null) { ONE.FullName = OrderInfo.FullName; ONE.Tel = OrderInfo.Mobile; ONE.NickId = (int)OrderInfo.NickID; } else { ONE.FullName = ""; //ONE.NickId = -1; } ONE.IsReturn = false; ONE.ReturnRef = ""; ONE.ClaimRef = AutoClaimRef(); ONE.IsEnable = false; ONE.CreateDate = ONE.UpdateDate = DateTime.Now; ONE.CreateID = ONE.UpdateID = HozestERPContext.Current.User.CustomerID; base.XMClaimInfoService.InsertXMClaimInfo(ONE); one.ClaimInfoID = ONE.Id; one.ClaimTypeID = (int)Info.PaymentPerson; var PremiumsDetailList = base.XMPremiumsDetailsService.GetXMPremiumsDetailsListByPremiumsId(Info.Id); if (PremiumsDetailList != null && PremiumsDetailList.Count > 0) { one.ClaimAcount = PremiumsDetailList.Sum(x => x.ProductNum * x.FactoryPrice); } //确认——除厂家,物流理赔外,默认确认 if (Info.PaymentPerson != 596 && Info.PaymentPerson != 597) { one.IsConfirm = true; //one.ConfirmDate = DateTime.Now; //one.ConfirmPerson = HozestERPContext.Current.User.CustomerID; } else { one.IsConfirm = false; } one.ResponsiblePerson = this.txtResponsiblePerson.Text.Trim(); one.Reason = this.txtClaimReason.Text.Trim(); one.IsEnable = false; one.CreateDate = one.UpdateDate = DateTime.Now; one.CreateID = one.UpdateID = HozestERPContext.Current.User.CustomerID; base.XMClaimInfoDetailService.InsertXMClaimInfoDetail(one); return(true); }
public void ToSave(string OrderCode, string wangwang, string ApplicationTypeId, string PaymentPerson, bool chk, int ID, string note, int NickId) { using (TransactionScope scope = new TransactionScope()) { try { string msg = ""; if (chk) { if (string.IsNullOrEmpty(OrderCode)) { msg = "订单号不能为空!"; base.ShowMessage(msg); return; } else { var OrderInfo = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode); if (OrderInfo == null) { msg = "该订单号的订单不存在!"; base.ShowMessage(msg); return; } } } else { if (NickId == -1) { msg = "无订单号赠品,赔付单必须选择店铺!"; base.ShowMessage(msg); return; } } if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson == "-1") { msg = "请先选择赔付方!"; base.ShowMessage(msg); return; } //财务未审核 bool FinanceIsAudit = false; //项目未审核 int ManagerStatus = 3; //项目id int projectID = 0; //平台id int platformTypeId = 0; if (ID == 0) { List <XMPremiumsDetails> list = new List <XMPremiumsDetails>(); if (Session["PremiumsDetailList"] != null) { list = (List <XMPremiumsDetails>)Session["PremiumsDetailList"]; } decimal priceAmount = (decimal)list.Sum(a => a.FactoryPrice * a.ProductNum); XMPremiums XMPremium = new XMPremiums(); if (chk) { XMPremium.OrderCode = OrderCode; //订单号 XMPremium.WantId = wangwang; //旺旺号 var OrderInfo = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode); projectID = OrderInfo.ProjectId; platformTypeId = (int)OrderInfo.PlatformTypeId; } else { XMPremium.OrderCode = "NoOrder" + DateTime.Now.ToString("yyMMddHHmmssfff");; XMPremium.WantId = ""; XMPremium.NoOrderNickId = NickId; var xmNick = XMNickService.GetXMNickByID(NickId); projectID = (int)xmNick.ProjectId; platformTypeId = (int)xmNick.PlatformTypeId; } var XMDeductionSetUp = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, platformTypeId); if (XMDeductionSetUp != null) { //根据项目限额,平台限额,自动设置审核进度 if (priceAmount <= XMDeductionSetUp.Deduction) { FinanceIsAudit = true; //项目审核 ManagerStatus = 4; } else if (priceAmount > XMDeductionSetUp.Deduction && priceAmount <= XMDeductionSetUp.Finance) { FinanceIsAudit = true; } } else { //通用 var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, 508); if (XMDeductionSetUpUsually != null) { //根据项目限额,平台限额,自动设置审核进度 if (priceAmount <= XMDeductionSetUpUsually.Deduction) { FinanceIsAudit = true; //项目审核 ManagerStatus = 4; } else if (priceAmount > XMDeductionSetUpUsually.Deduction && priceAmount <= XMDeductionSetUpUsually.Finance) { FinanceIsAudit = true; } } } if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson != "-1") { XMPremium.PaymentPerson = int.Parse(PaymentPerson);//赔付方 } else { XMPremium.PaymentPerson = null; } XMPremium.PremiumsTypeId = int.Parse(ApplicationTypeId);//申请类型 XMPremium.ManagerStatus = ManagerStatus; XMPremium.PremiumsStatus = Convert.ToInt32(StatusEnum.PremiumsNoHair); XMPremium.FinanceIsAudit = FinanceIsAudit; XMPremium.IsEnable = false; XMPremium.IsEvaluation = false; XMPremium.IsSingleRow = false; XMPremium.CreatorID = HozestERPContext.Current.User.CustomerID; XMPremium.CreateTime = DateTime.Now; XMPremium.UpdatorID = HozestERPContext.Current.User.CustomerID; XMPremium.UpdateTime = DateTime.Now; XMPremium.Note = note; base.XMPremiumsService.InsertXMPremiums(XMPremium); //更新ActivityExplanation string p = ""; foreach (XMPremiumsDetails one in list) { one.PremiumsId = XMPremium.Id; one.IsSingleRow = false; base.XMPremiumsDetailsService.InsertXMPremiumsDetails(one); if (one.Specifications != "") { p += one.PrdouctName + "(" + one.Specifications + ")" + "*" + one.ProductNum + "+"; } else { p += one.PrdouctName + "*" + one.ProductNum + "+"; } } if (p.Length > 0) { p = p.Substring(0, p.Length - 1); } XMPremium.ActivityExplanation = p; base.XMPremiumsService.UpdateXMPremiums(XMPremium); if (XMPremium.PremiumsTypeId == Convert.ToInt32(StatusEnum.ChildPayment))//赔付 { if (!AddClaimInfo(XMPremium, NickId)) { msg = "理赔管理中已有该理赔,不能新增修改;若要操作,请先删除!"; base.ShowMessage(msg); return; } } if (ApplicationTypeId != Convert.ToInt32(StatusEnum.ChildPayment).ToString()) { this.wangwang.Value = wangwang; this.btnSave.Visible = false; this.txtScalpingCode.Value = XMPremium.OrderCode; BindGrid(); } msg = "保存成功!"; base.ShowMessage(msg); scope.Complete(); } else { string p = ""; var premiumdetails = base.XMPremiumsDetailsService.GetXMPremiumsDetailsListByPremiumsId(ID); foreach (var a in premiumdetails) { if (a.Specifications != "") { p += a.PrdouctName + "(" + a.Specifications + ")" + "*" + a.ProductNum + "+"; } else { p += a.PrdouctName + "*" + a.ProductNum + "+"; } } if (p.Length > 0) { p = p.Substring(0, p.Length - 1); } decimal priceAmount = (decimal)premiumdetails.Sum(a => a.FactoryPrice); var OrderInfo = XMOrderInfoService.GetXMOrderByOrderCode(OrderCode); int paramPlatformTypeId = -1; int paramProjectId = -1; if (OrderInfo != null) { paramPlatformTypeId = (int)OrderInfo.PlatformTypeId; paramProjectId = OrderInfo.ProjectId; } var XMDeductionSetUp = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(paramProjectId, 476, paramPlatformTypeId); //根据项目限额,平台限额,自动设置审核进度 if (XMDeductionSetUp != null) { if (priceAmount <= XMDeductionSetUp.Deduction) { FinanceIsAudit = true; //项目审核 ManagerStatus = 4; } else if (priceAmount > XMDeductionSetUp.Deduction && priceAmount <= XMDeductionSetUp.Finance) { FinanceIsAudit = true; } } else { //通用 var XMDeductionSetUpUsually = XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(projectID, 476, 508); if (XMDeductionSetUpUsually != null) { //根据项目限额,平台限额,自动设置审核进度 if (priceAmount <= XMDeductionSetUpUsually.Deduction) { FinanceIsAudit = true; //项目审核 ManagerStatus = 4; } else if (priceAmount > XMDeductionSetUpUsually.Deduction && priceAmount <= XMDeductionSetUpUsually.Finance) { FinanceIsAudit = true; } } } var XMPremium = base.XMPremiumsService.GetXMPremiumsById(ID); XMPremium.OrderCode = OrderCode; //订单号 XMPremium.WantId = wangwang; //旺旺号 XMPremium.ActivityExplanation = p; if (ApplicationTypeId == Convert.ToInt32(StatusEnum.ChildPayment).ToString() && PaymentPerson != "-1") { XMPremium.PaymentPerson = int.Parse(PaymentPerson);//赔付方 } else { XMPremium.PaymentPerson = null; } if (!chk) { XMPremium.NoOrderNickId = NickId; } XMPremium.PremiumsTypeId = int.Parse(ApplicationTypeId);//申请类型 XMPremium.UpdatorID = HozestERPContext.Current.User.CustomerID; XMPremium.UpdateTime = DateTime.Now; XMPremium.Note = note; XMPremium.ManagerStatus = ManagerStatus; XMPremium.FinanceIsAudit = FinanceIsAudit; base.XMPremiumsService.UpdateXMPremiums(XMPremium); if (XMPremium.PremiumsTypeId == Convert.ToInt32(StatusEnum.ChildPayment)) { if (!AddClaimInfo(XMPremium, NickId)) { msg = "理赔管理中已有该理赔,不能新增修改;若要操作,请先删除!"; base.ShowMessage(msg); return; } } if (ApplicationTypeId != Convert.ToInt32(StatusEnum.ChildPayment).ToString()) { this.wangwang.Value = wangwang; } base.ShowMessage("修改成功!"); scope.Complete(); } } catch (Exception err) { this.ProcessException(err); } } }