/// <summary> /// 保存 /// </summary> private void Save() { string[] list = Utils.GetFormValue("list").Split(','); IList <MTourOrderSales> ls = new List <MTourOrderSales>(); foreach (string item in list) { string[] cou = item.Split('|'); MTourOrderSales model = new MTourOrderSales { //订单编号 OrderId = cou[0], //收退款方式 CollectionRefundMode = Utils.GetInt(cou[1]), //收退款金额 CollectionRefundAmount = Utils.GetDecimal(cou[2]), //收退款类型 CollectionRefundState = EyouSoft.Model.EnumType.TourStructure.CollectionRefundState.收款, //登记人 Operator = SiteUserInfo.Name, //收退款人 CollectionRefundOperator = SiteUserInfo.Name, //登记人Id OperatorId = SiteUserInfo.UserId, //收退款人Id CollectionRefundOperatorID = SiteUserInfo.UserId, //收退款时间 CollectionRefundDate = DateTime.Now, IsCheck = Utils.GetInt(Utils.GetFormValue("ParentType")) == 1 ? !(new BComSetting().GetModel(CurrentUserCompanyID).FinancialIncomeReview) : false, }; if (model.IsCheck) { //审核人 model.Approver = SiteUserInfo.Name; //审核人id model.ApproverId = SiteUserInfo.UserId; //审核人部门 model.ApproverDeptId = SiteUserInfo.DeptId; //审核时间 model.ApproveTime = DateTime.Now; } ls.Add(model); } if (ls.Count > 0) { if (new BTourOrder().AddTourOrderSales(ls)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1")); } } }
/// <summary> /// 修改订单销售的收款/退款 /// </summary> /// <param name="tourOrderSales">订单销售收款/退款的实体</param> /// <returns> /// 1:更新成功 /// 0:更新失败 /// </returns> public bool UpdateTourOrderSales(MTourOrderSales tourOrderSales) { int flg = dal.UpdateTourOrderSales(tourOrderSales); if (flg == 1) { StringBuilder str = new StringBuilder(); str.AppendFormat("修改订单的{0},订单号:{1},修改后的金额:{2}。", tourOrderSales.CollectionRefundState, tourOrderSales.OrderId, tourOrderSales.CollectionRefundAmount); EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(str.ToString()); return(true); } return(false); }
/// <summary> /// 添加销售收款/退款 /// </summary> /// <param name="tourOrderSales">订单收款退款的集合</param> /// <returns>0:添加失败 1:添加成功</returns> public bool AddTourOrderSales(MTourOrderSales tourOrderSales) { int flg = dal.AddTourOrderSales(tourOrderSales); if (flg == 1) { //添加操作日志 StringBuilder str = new StringBuilder(); str.AppendFormat("添加订单的{0}。订单编号:{1},{2}金额:{3}。", tourOrderSales.CollectionRefundState, tourOrderSales.OrderId, tourOrderSales.CollectionRefundState, tourOrderSales.CollectionRefundAmount); EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(str.ToString()); return(true); } return(false); }
/// <summary> /// 获取参数并验证 /// </summary> /// <param name="model">赋值实体</param> /// <param name="msg">验证提示语</param> /// <returns></returns> private bool GetVal(MTourOrderSales model, out string msg) { msg = string.Empty; model = model ?? new MTourOrderSales(); CollectionRefundState ReturnOrSet = ShouTuiType == "1" ? CollectionRefundState.收款 : CollectionRefundState.退款; model.CollectionRefundDate = Utils.GetDateTime(Utils.GetFormValue("txt_collectionRefundDate")); if (model.CollectionRefundDate == DateTime.MinValue) { msg += ReturnOrSet + "时间不能为空!<br/>"; } //收退款金额 model.CollectionRefundAmount = Utils.GetDecimal(Utils.GetFormValue("txt_collectionRefundAmount")); if (model.CollectionRefundAmount <= 0) { msg += ReturnOrSet + "金额格式不正确!<br/>"; } //收退款方式 model.CollectionRefundMode = Utils.GetIntSign(Utils.GetFormValue("sel_collectionRefundMode"), -1); if (model.CollectionRefundMode < 0) { msg += ReturnOrSet + "方式异常!<br/>"; } if (Utils.GetFormValue("sellsFormKey").Length > 0) { //收退款人 model.CollectionRefundOperator = Request.Form[txt_Sells.SellsNameClient] ?? Utils.GetFormValue(Utils.GetFormValue("sellsFormKey") + txt_Sells.SellsNameClient); //收退款人ID model.CollectionRefundOperatorID = Request.Form[txt_Sells.SellsIDClient] ?? Utils.GetFormValue(Utils.GetFormValue("sellsFormKey") + txt_Sells.SellsIDClient); } if (model.CollectionRefundOperator.Length <= 0 || model.CollectionRefundOperatorID.Length <= 0) { msg += ReturnOrSet + "人异常,请单击选用按钮选取!<br/>"; } //退款类型 model.CollectionRefundState = ReturnOrSet; //备注 model.Memo = Utils.GetFormValue("txt_Memo"); //订单号 model.OrderId = Utils.GetFormValue("OrderId"); model.Operator = SiteUserInfo.Name; model.OperatorId = SiteUserInfo.UserId; return(msg.Length <= 0); }
/// <summary> /// 导游收入 添加 修改 /// </summary> /// <param name="orderID">订单号</param> /// <returns></returns> protected void AddAndUpdateGuidRealIncome(string orderID) { //导游现收 decimal GuideIncome = Utils.GetDecimal(Utils.GetFormValue("txtGuideIncome")); //导游实收 decimal realIncom = Utils.GetDecimal(Utils.GetFormValue("txtRealIncome")); //备注 string remarks = Utils.GetFormValue("txtConfirmRemark"); MTourOrderSales model = new MTourOrderSales(); IList <EyouSoft.Model.ComStructure.MComPayment> ls = new EyouSoft.BLL.ComStructure.BComPayment().GetList(CurrentUserCompanyID) ?? new List <EyouSoft.Model.ComStructure.MComPayment>(); ls = ls.Where(item => item.Name == "导游现收" && item.IsSystem).ToList(); if (ls != null && ls.Count > 0) { model.CollectionRefundMode = ls[0].PaymentId; model.CollectionRefundModeName = ls[0].Name; } model.OrderId = orderID; model.Operator = this.SiteUserInfo.Name; model.OperatorId = this.SiteUserInfo.UserId; model.CollectionRefundAmount = realIncom; model.CollectionRefundState = CollectionRefundState.收款; model.CollectionRefundDate = System.DateTime.Now; model.CollectionRefundOperator = this.SiteUserInfo.Name; model.CollectionRefundOperatorID = this.SiteUserInfo.UserId; model.IsGuideRealIncome = true; model.ShouKuanType = EyouSoft.Model.EnumType.FinStructure.ShouKuanType.导游实收; //修改导游收入 if (Utils.GetQueryStringValue("actionType") == "update") { if (new EyouSoft.BLL.TourStructure.BTourOrder().UpdateGuideRealIncome(orderID, GuideIncome, realIncom, remarks, model)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1", "修改成功!")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "修改失败!")); } } }
/// <summary> /// 保存 /// </summary> private void Save() { if (RequestType != "1" && RequestType != "2") { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "错误的请求")); } if (ShouTuiType != "1" && ShouTuiType != "2") { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "错误的请求")); } BTourOrder bll = new BTourOrder(); MTourOrderSales model = bll.GetTourOrderSalesById(Utils.GetFormValue("TourOrderSalesID")) ?? new MTourOrderSales(); string msg = string.Empty; string doType = Utils.GetQueryStringValue("doType"); if ((doType == "Add" || doType == "Updata") && !GetVal(model, out msg)) { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "操作失败!<br/>" + msg)); } switch (doType) { case "Add": if (!IsDengJiPrivs) { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "操作失败:无权限。")); } if (RequestType == "1") { //根据系统配置配置是否需要审核 MComSetting comModel = new BComSetting().GetModel(CurrentUserCompanyID); model.IsCheck = !comModel.FinancialIncomeReview; //如果默认为不需要审核 审核人默认为当前操作人 if (model.IsCheck) { model.Approver = SiteUserInfo.Name; model.ApproverId = SiteUserInfo.UserId; model.ApproverDeptId = SiteUserInfo.DeptId; model.ApproveTime = DateTime.Now; } } if (bll.AddTourOrderSales(model)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "添加失败!")); } break; case "Updata": if (!IsDengJiPrivs) { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "操作失败:无权限。")); } if (bll.UpdateTourOrderSales(model)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "修改失败!")); } break; case "Delete": if (!IsDengJiPrivs) { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "操作失败:无权限。")); } if (bll.DeleteTourOrderSales(Utils.GetFormValue("TourOrderSalesID"))) { AjaxResponse(UtilsCommons.AjaxReturnJson("1")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "删除失败!")); } break; case "ExamineV": if (!IsShenHePrivs) { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "操作失败:无权限。")); } model.Approver = SiteUserInfo.Name; model.ApproverId = SiteUserInfo.UserId; model.ApproverDeptId = SiteUserInfo.DeptId; model.ApproveTime = DateTime.Now; if (new BFinance().SetTourOrderSalesCheck(model)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "审核失败!")); } break; default: AjaxResponse(UtilsCommons.AjaxReturnJson("-1", "错误的请求!")); break; } }
/// <summary> /// 修改导游实收 /// </summary> /// <param name="orderId">订单编号</param> /// <param name="guideIncome">导游应收</param> /// <param name="guideRealIncome">导游实收</param> /// <param name="guideRemark">导游实收的备注</param> /// <param name="sales">导游收款的记录</param> /// <returns>1:成功 0:失败</returns> public bool UpdateGuideRealIncome(string orderId, decimal guideIncome, decimal guideRealIncome, string guideRemark, MTourOrderSales sales) { if (string.IsNullOrEmpty(orderId)) { throw new System.Exception("bll error:查询id为null。string.IsNullOrEmpty(id)==true."); } if (dal.UpdateGuideRealIncome(orderId, guideIncome, guideRealIncome, guideRemark, sales) == 1) { StringBuilder str = new StringBuilder(); str.AppendFormat("订单编号:{0},导游应收修改为:{1},导游实收:{2},备注:{3}", orderId, guideIncome, guideRealIncome, guideRemark); EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(str.ToString()); return(true); } return(false); }