/// <summary>
        /// 转账撤销的保存
        /// </summary>
        /// <returns></returns>
        public JsonResult ZzCxSave(List <RoomRegYzzHelp> models)
        {
            var apiResult = new APIResult();

            try
            {
                RoomRegZwBll.ZzCxSave(models);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public JsonResult BfjzSave(long roomRegId, List <RoomRegZw> models, decimal yhMoney, int type, decimal yisMoney, List <JzViewHelp> jzList, List <RoomRegZw> dwjzList)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                RoomRegZwBll.BfjzSave(roomRegId, models, yhMoney, type, yisMoney, jzList, dwjzList, user.HotelId, user.Id, user.Name);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public JsonResult ZzSave(long fromRoomRegId, long toRoomRegId, List <RoomRegZw> fyList, List <RoomRegSk> skList, List <RoomRegTk> tkList)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                RoomRegZwBll.ZzSave(fromRoomRegId, toRoomRegId, fyList, skList, tkList, user.Id, user.Name);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public JsonResult SaveRoomReg(long Id, string remark)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                RoomRegZwBll.SaveRoomReg(Id, remark);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        /// <summary>
        /// 未结退房
        /// </summary>
        /// <param name="roomRegId"></param>
        public JsonResult CxWjtf(long roomRegId, string reason)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                RoomRegZwBll.CxWjtf(roomRegId, reason, user.Id, user.Name, user.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public JsonResult BfjsCx(long jzdId)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                //撤销部分结账
                RoomRegZwBll.BfjzCx(jzdId, user.HotelId, user.Id, user.Name);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        public string GetFyListForBfjz(long roomRegId)
        {
            var list = RoomRegZwBll.GetFyListForBfjz(roomRegId);

            return(JsonConvert.SerializeObject(list));
        }
        /// <summary>
        /// 获取已转账明细
        /// </summary>
        /// <param name="roomRegId"></param>
        /// <returns></returns>
        public string GetYzzList(long roomRegId)
        {
            if (roomRegId == 0)
            {
                roomRegId = -1;
            }
            var datas = new List <RoomRegYzzHelp>();
            //获取费用数据
            var fyList = RoomRegZwBll.GetFyListForYzz(roomRegId);

            datas.AddRange(fyList);
            //获取收款数据
            var skList = RoomRegSkBll.GetListForYzz(roomRegId);

            if (skList != null && skList.Count > 0)
            {
                var sum = skList.Sum(m => m.Money);
                var sk  = new RoomRegYzzHelp()
                {
                    Id        = Guid.NewGuid().ToString(),
                    ZzTime    = string.Empty,
                    Name      = "收款",
                    Price     = string.Empty,
                    Quantity  = string.Empty,
                    Money     = $"汇总:{sum}",
                    DjNum     = string.Empty,
                    KdRemark  = string.Empty,
                    Remark    = string.Empty,
                    ZzHandler = string.Empty,
                    YsTime    = string.Empty,
                    children  = new List <RoomRegYzzHelp>()
                };
                foreach (var item in skList)
                {
                    sk.children.Add(new RoomRegYzzHelp()
                    {
                        RType        = FyAndStkTypeEnum.收款,
                        Id           = item.Id.ToString(),
                        RoomRegId    = item.RoomRegId.ToString(),
                        ZzTime       = TypeConvert.IntToDateTime(item.ZzTime).ToString("yyyy-MM-dd HH:mm"),
                        Name         = string.Empty,
                        Price        = string.Empty,
                        Quantity     = string.Empty,
                        Money        = item.Money.ToString(),
                        DjNum        = string.Empty,
                        KdRemark     = string.Empty,
                        Remark       = item.Remark,
                        ZzHandler    = item.ZzHandler,
                        YsTime       = item.YsTime,
                        OldRoomRegId = item.OldRoomRegId.ToString(),
                        Desc         = $"从房间【房号:{item.OldRoomNO},登记单:{item.OldDjdNum}】转到房间【{item.RoomNO},登记单:{item.DjdNum}】"
                    });
                }
                datas.Add(sk);
            }
            //获取退款数据
            var tkList = RoomRegTkBll.GetListYzz(roomRegId);

            if (tkList != null && tkList.Count > 0)
            {
                var sum = tkList.Sum(m => m.Money);
                var tk  = new RoomRegYzzHelp()
                {
                    Id        = Guid.NewGuid().ToString(),
                    ZzTime    = string.Empty,
                    Name      = "退款",
                    Price     = string.Empty,
                    Quantity  = string.Empty,
                    Money     = $"汇总:{sum}",
                    DjNum     = string.Empty,
                    KdRemark  = string.Empty,
                    Remark    = string.Empty,
                    ZzHandler = string.Empty,
                    YsTime    = string.Empty,
                    children  = new List <RoomRegYzzHelp>()
                };
                foreach (var item in tkList)
                {
                    tk.children.Add(new RoomRegYzzHelp()
                    {
                        RType        = FyAndStkTypeEnum.退款,
                        Id           = item.Id.ToString(),
                        RoomRegId    = item.RoomRegId.ToString(),
                        ZzTime       = TypeConvert.IntToDateTime(item.ZzTime).ToString("yyyy-MM-dd HH:mm"),
                        Name         = string.Empty,
                        Price        = string.Empty,
                        Quantity     = string.Empty,
                        Money        = item.Money.ToString(),
                        DjNum        = string.Empty,
                        KdRemark     = string.Empty,
                        Remark       = item.Remark,
                        ZzHandler    = item.ZzHandler,
                        YsTime       = item.YsTime,
                        OldRoomRegId = item.OldRoomRegId.ToString(),
                        Desc         = $"从房间【房号:{item.OldRoomNO},登记单:{item.OldDjdNum}】转到房间【{item.RoomNO},登记单:{item.DjdNum}】"
                    });
                }
                datas.Add(tk);
            }
            return(JsonConvert.SerializeObject(datas));
        }