/// <summary> /// 保存按钮点击事件执行方法 /// </summary> void BaoCun() { string msg = string.Empty; EyouSoft.Model.SourceStructure.MSource source = new EyouSoft.Model.SourceStructure.MSource(); EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.BLL.TourStructure.BSingleService bll = new EyouSoft.BLL.TourStructure.BSingleService(); MSingleServiceExtend model = new MSingleServiceExtend(); if (!String.IsNullOrEmpty(DanXiangYeWuId)) { model = bll.GetSingleServiceExtendByTourId(DanXiangYeWuId); model.TourId = DanXiangYeWuId; } if (Utils.GetQueryStringValue("submitplan") == "submit") { model.TourStatus = EyouSoft.Model.EnumType.TourStructure.TourStatus.待终审; if (model.PlanBaseInfoList != null && model.PlanBaseInfoList.Count > 0) { for (int i = 0; i < model.PlanBaseInfoList.Count; i++) { model.PlanBaseInfoList[i].Status = EyouSoft.Model.EnumType.PlanStructure.PlanState.已落实; } } } else { //联系人 string ContactName = Utils.GetFormValue(this.txtContactName.UniqueID); //订单编号 //string ordercode = Utils.GetFormValue(this.txtOrdercode.UniqueID); //客户电话 string ContactTel = Utils.GetFormValue(this.txtContactTel.UniqueID); //客户单位 string CustomUnit = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHMC); //客户单位编号 string CustomUnitID = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHBH); //毛利 string Profit = Utils.GetFormValue(this.txtProfit.UniqueID); //总支出 string TotalEx = Utils.GetFormValue(this.txtTotalEx.UniqueID); //总收入 string TotalIn = Utils.GetFormValue(this.txtTotalIn.UniqueID); //人数 string AdultCount = Utils.GetFormValue(this.txtAdultCount.UniqueID); //操作状态 string opeateStatu = Utils.GetFormValue(this.ddlopeaterStatus.UniqueID); if (opeateStatu != "") { model.TourStatus = (EyouSoft.Model.EnumType.TourStructure.TourStatus)EyouSoft.Common.Utils.GetInt(opeateStatu); } else { RCWE(UtilsCommons.AjaxReturnJson("0", "无法修改已落实的数据!")); } #region 游客信息附件 string[] agrUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldagrUpload = Utils.GetFormValues("hideagreement"); string agreement = string.Empty; if (oldagrUpload.Length > 0) { for (int i = 0; i < oldagrUpload.Length; i++) { agreement = oldagrUpload[i].Split('|')[1]; } } if (agrUpload.Length > 0) { for (int i = 0; i < agrUpload.Length; i++) { if (agrUpload[i].Trim() != "") { if (agrUpload[i].Split('|').Length > 1) { if (agrUpload[i].Length > 1) { agreement = agrUpload[i].Split('|')[1]; } } } } } #endregion model.TravellerFile = agreement; model.CompanyId = this.SiteUserInfo.CompanyId; model.ContactName = ContactName; model.ContactTel = ContactTel; model.ContactDepartId = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHBH); model.Operator = this.SiteUserInfo.Name; model.SellerName = Utils.GetFormValue(SellsSelect1.SellsNameClient); model.SellerId = Utils.GetFormValue(SellsSelect1.SellsIDClient); model.DeptId = Utils.GetInt(Utils.GetFormValue(this.hideDeptID.ClientID)); model.BuyCompanyId = CustomUnitID; model.BuyCompanyName = CustomUnit; model.OperatorId = this.SiteUserInfo.UserId; IList <MTourPlaner> planerlist = new List <MTourPlaner>(); MTourPlaner planer = null; string planernamestr = Utils.GetFormValue(SellsSelect2.SellsNameClient); string planerIdstr = Utils.GetFormValue(SellsSelect2.SellsIDClient); string planerptIdstr = Utils.GetFormValue(this.hidePlanerDeptID.ClientID); for (int i = 0; i < planerIdstr.Split(',').Length; i++) { planer = new MTourPlaner(); planer.PlanerId = planerIdstr.Split(',')[i]; planer.Planer = planernamestr.Split(',')[i]; planer.DeptId = Utils.GetInt(planerptIdstr.Split(',')[i]); planerlist.Add(planer); } model.TourPlanersList = planerlist; model.Adults = Utils.GetInt(AdultCount); model.ContactDepartId = this.hdContactdepartid.Value; //客户要求 model.TourTeamPriceList = GetCustomRequireList(); //供应商安排 model.PlanBaseInfoList = GetSourcePlanList(); //客户信息 model.TourOrderTravellerList = GetCustomList(); model.TourPay = Utils.GetDecimal(TotalEx); model.TourIncome = Utils.GetDecimal(TotalIn); model.TourProfit = Utils.GetDecimal(Profit); if (model.TourOrderTravellerList.Count == 0) { msg = UtilsCommons.AjaxReturnJson("0", "请至少填写一条客户信息"); RCWE(msg); } } model.OperatorDeptId = this.SiteUserInfo.DeptId; model.WeiTuoRiQi = Utils.GetDateTime(Utils.GetFormValue(txtWeiTuoRiQi.UniqueID), DateTime.Today); model.HeTongCode = Utils.GetFormValue(txtHeTongHao.HeTongCodeClientID); model.HeTongId = Utils.GetFormValue(txtHeTongHao.HeTongIdClientID); bool result = false; if (string.IsNullOrEmpty(DanXiangYeWuId)) { lock (PaiTuanXuHaoLockHelper) { result = bll.AddSingleService(model); } } else { result = bll.UpdateSingleService(model); } string type = string.IsNullOrEmpty(DanXiangYeWuId) ? "新增" : "修改"; if (Utils.GetQueryStringValue("submitplan") == "submit") { type = "提交"; } if (result) { msg = UtilsCommons.AjaxReturnJson("1", type + "成功!"); } else { msg = UtilsCommons.AjaxReturnJson("0", type + "失败!"); } RCWE(msg); }
/// <summary> /// 页面初始化 /// </summary> protected void InitInfo() { this.UploadControl1.CompanyID = this.SiteUserInfo.CompanyId; if (string.IsNullOrEmpty(DanXiangYeWuId)) { this.txtOpeator.Text = this.SiteUserInfo.Name; this.txtTotalIn.ReadOnly = true; this.txtTotalEx.ReadOnly = true; this.txtProfit.ReadOnly = true; return; } EyouSoft.BLL.TourStructure.BSingleService bll = new EyouSoft.BLL.TourStructure.BSingleService(); MSingleServiceExtend model = bll.GetSingleServiceExtendByTourId(DanXiangYeWuId); if (model == null) { RCWE("异常请求"); } this.status.Value = ((int)model.TourStatus).ToString(); this.txtContactName.Text = model.ContactName; this.txtContactTel.Text = model.ContactTel; this.CustomerUnitSelect1.CustomerUnitName = model.BuyCompanyName; this.CustomerUnitSelect1.CustomerUnitId = model.BuyCompanyId; this.SellsSelect1.SellsName = model.SellerName; this.SellsSelect1.SellsID = model.SellerId; this.SellsSelect2.SetTitle = "计调员"; if (model.TourPlanersList != null && model.TourPlanersList.Count > 0) { //this.SellsSelect2.SellsName = model.TourPlanersList[0].Planer; string planidlist = string.Empty; string plannamelist = string.Empty; string plandeptlist = string.Empty; for (int i = 0; i < model.TourPlanersList.Count; i++) { if (i == model.TourPlanersList.Count - 1) { planidlist += model.TourPlanersList[i].PlanerId; plannamelist += model.TourPlanersList[i].Planer; plandeptlist += model.TourPlanersList[i].DeptId; } else { planidlist += model.TourPlanersList[i].PlanerId + ","; plannamelist += model.TourPlanersList[i].Planer + ","; plandeptlist += model.TourPlanersList[i].DeptId + ","; } } this.SellsSelect2.SellsID = planidlist; this.SellsSelect2.SellsName = plannamelist; this.hidePlanerDeptID.Value = plandeptlist; } this.hideDeptID.Value = model.DeptId.ToString(); if (model.TourStatus != EyouSoft.Model.EnumType.TourStructure.TourStatus.销售未派计划 && model.TourStatus != EyouSoft.Model.EnumType.TourStructure.TourStatus.计调配置完毕) { this.ddlopeaterStatus.Items.Add(new ListItem { Value = ((int)model.TourStatus).ToString(), Text = model.TourStatus.ToString(), Selected = true }); } else { this.ddlopeaterStatus.Items.FindByValue(((int)model.TourStatus).ToString()).Selected = true;; } if (model.TourStatus == EyouSoft.Model.EnumType.TourStructure.TourStatus.计调配置完毕 || model.TourStatus == EyouSoft.Model.EnumType.TourStructure.TourStatus.待终审 || model.TourStatus == EyouSoft.Model.EnumType.TourStructure.TourStatus.封团 || model.TourStatus == EyouSoft.Model.EnumType.TourStructure.TourStatus.财务核算) { this.ddlopeaterStatus.Enabled = false; } this.txtWeiTuoRiQi.Text = model.WeiTuoRiQi.ToString("yyyy-MM-dd"); this.txtOpeator.Text = model.Operator; this.txtTotalIn.Text = Utils.FilterEndOfTheZeroDecimal(model.TourIncome); this.txtTotalEx.Text = Utils.FilterEndOfTheZeroDecimal(model.TourPay); this.txtAdultCount.Text = model.Adults.ToString(); this.txtProfit.Text = Utils.FilterEndOfTheZeroDecimal((model.TourIncome - model.TourPay)); this.txtTotalIn.ReadOnly = true; this.txtTotalEx.ReadOnly = true; this.txtProfit.ReadOnly = true; if (model.TravellerFile != "") { StringBuilder agreement = new StringBuilder(); agreement.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}' target='_blank'>游客附件</a><a href=\"javascript:void(0)\" onclick=\"SingleEditPage.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"hideagreement\" value='附件|{0}'/></span>", model.TravellerFile); this.lbFiles.Text = agreement.ToString(); } if (model.TourOrderTravellerList != null && model.TourOrderTravellerList.Count > 0) { this.SetCustomList = model.TourOrderTravellerList; CustomListCount = SetCustomList.Count; } if (model.TourTeamPriceList != null && model.TourTeamPriceList.Count > 0) { this.SetCusttomrequire = model.TourTeamPriceList; CustomRequireCount = SetCusttomrequire.Count; } if (model.PlanBaseInfoList != null && model.PlanBaseInfoList.Count > 0) { this.SetSourcePlan = model.PlanBaseInfoList; SourcePlanCount = SetSourcePlan.Count; } hdContactdepartid.Value = model.ContactDepartId; ltrOrderCode.Text = model.OrderCode; phOrderCode.Visible = true; txtHeTongHao.HeTongId = model.HeTongId; txtHeTongHao.HeTongCode = model.HeTongCode; string printPageHSD = new EyouSoft.BLL.ComStructure.BComSetting().GetPrintUri(SiteUserInfo.CompanyId, EyouSoft.Model.EnumType.ComStructure.PrintTemplateType.核算单); string heSuanDanLink = string.Format("<a target='_blank' href='{0}?referertype=2&tourid={1}' class='unbtn'>查看核算单</a>", printPageHSD, model.TourId); switch (model.TourStatus) { case EyouSoft.Model.EnumType.TourStructure.TourStatus.待终审: ltrCaoZuoTiShi.Text = heSuanDanLink + "当前业务状态为<b>待终审</b>。"; break; case EyouSoft.Model.EnumType.TourStructure.TourStatus.财务核算: ltrCaoZuoTiShi.Text = heSuanDanLink + "当前业务状态为<b>财务核算</b>。"; break; case EyouSoft.Model.EnumType.TourStructure.TourStatus.封团: ltrCaoZuoTiShi.Text = heSuanDanLink + "当前业务状态为<b>核算结束</b>。"; break; case EyouSoft.Model.EnumType.TourStructure.TourStatus.已取消: ltrCaoZuoTiShi.Text = "当前业务已取消。"; break; default: break; } bool _isCaoZuo = model.OperatorId == SiteUserInfo.UserId || model.SellerId == SiteUserInfo.UserId; if (!_isCaoZuo && model.TourPlanersList != null && model.TourPlanersList.Count > 0) { foreach (var item in model.TourPlanersList) { if (item.PlanerId == SiteUserInfo.UserId) { _isCaoZuo = true; break; } } } if (!_isCaoZuo) { phCaoZuo.Visible = false; if (string.IsNullOrEmpty(ltrCaoZuoTiShi.Text)) { ltrCaoZuoTiShi.Text = "你没有当前业务的操作权限。"; } } }