Example #1
0
        public ActionResult Edit(string id = "")
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(View(new AgreeCompany()
                {
                    HotelId = UserContext.CurrentUser.HotelId
                }));
            }
            var info = AgreeCompanyBll.GetById(id);

            return(View(info));
        }
Example #2
0
        public ActionResult Delete(string id)
        {
            var apiResult = new APIResult();

            try
            {
                AgreeCompanyBll.Delete(id);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
Example #3
0
        public JsonResult Edit(AgreeCompany model)
        {
            var apiResult = new APIResult();

            try
            {
                AgreeCompanyBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
Example #4
0
        public string GetAgreeCompList(string searchName = null)
        {
            var list = AgreeCompanyBll.GetList(UserContext.CurrentUser.HotelId, searchName);

            return(JsonConvert.SerializeObject(list));
        }
Example #5
0
        public string GetList()
        {
            var models = AgreeCompanyBll.GetList(UserContext.CurrentUser.HotelId);

            return(JsonConvert.SerializeObject(models));
        }
Example #6
0
        public string GetPager(int page, int rows, long khlxId = 0, long khztId = 0, long khhyId = 0, long guestSourceId = 0, string searchName = null)
        {
            var pager = AgreeCompanyBll.GetPager(page, rows, UserContext.CurrentUser.HotelId, searchName, khlxId, khztId, khhyId, guestSourceId);

            return(JsonConvert.SerializeObject(pager));
        }
Example #7
0
        public ActionResult _Jz(long consumeId, int jstype)
        {
            var user    = UserContext.CurrentUser;
            var consume = PosConsumeBll.GetById(consumeId);

            var details_list = PosConsumeDetailBll.GetList(consumeId);

            details_list      = details_list.Where(a => a.ToRoomRegId == 0 && a.SourceRoomRegId == 0).ToList();
            ViewBag.WjsmxList = details_list;

            var roomRegId = consume.RoomRegId;
            var roomReg   = new Model.RoomReg()
            {
                Id = consume.RoomRegId, HotelId = user.HotelId
            };

            if (consume.RoomRegId != 0)
            {
                roomReg = RoomRegBll.GetById(consume.RoomRegId);
                if (roomReg == null)
                {
                    roomReg = new Model.RoomReg()
                    {
                        Id = consume.RoomRegId, HotelId = user.HotelId
                    }
                }
                ;
            }
            if (roomReg.CustomerType == 2)
            {
                //如果是连房成员,则需要获取主房登记id
                var zf = RoomRegBll.GetById(roomReg.ZfDjId);
                if (zf.CustomerType == 3)
                {
                    //主房如果是酒店会员
                    var member = MemberBll.GetById(long.Parse(zf.MemCompId));
                    if (member == null)
                    {
                        member = new Member();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 3, Data = JsonConvert.SerializeObject(member)
                    };
                }
                else if (zf.CustomerType == 4)
                {
                    //主房如果是协议单位
                    var comAgree = AgreeCompanyBll.GetById(zf.MemCompId);
                    if (comAgree == null)
                    {
                        comAgree = new AgreeCompany();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                    };
                }
                else
                {
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 1
                    };
                }
            }
            else if (roomReg.CustomerType == 3)
            {
                //如果是酒店会员
                var member = MemberBll.GetById(long.Parse(roomReg.MemCompId));
                if (member == null)
                {
                    member = new Member();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 3, Data = JsonConvert.SerializeObject(member)
                };
            }
            else if (roomReg.CustomerType == 4)
            {
                //如果是协议单位
                var comAgree = AgreeCompanyBll.GetById(roomReg.MemCompId);
                if (comAgree == null)
                {
                    comAgree = new AgreeCompany();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                };
            }
            else
            {
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 1
                };
            }
            //获取支付方式列表
            var payTypeList = PayTypeBll.GetList(user.HotelId, true, true);

            if (payTypeList == null)
            {
                payTypeList = new List <PayType>();
            }
            var payList = new List <RoomRegZwPaytypeHelp>();

            foreach (var item in payTypeList)
            {
                payList.Add(new RoomRegZwPaytypeHelp()
                {
                    Id      = item.Id.ToString(),
                    PayId   = item.Id.ToString(),
                    PayName = item.Name,
                    Money   = 0,
                });
            }
            ViewBag.PayList = payList;
            //获取卡类型
            var cardTypeList = CardTypeBll.GetList(UserContext.CurrentUser.HotelId);

            ViewBag.CardTypeList = cardTypeList;


            //ViewBag.WjsmxList = wjsmxList;
            //获取信用卡预授权
            var xykysqList = RoomRegXykBll.GetYsq(roomRegId);

            if (xykysqList == null || xykysqList.Count == 0)
            {
                xykysqList = new List <RoomRegXyk>();
            }
            ViewBag.Xykysq = xykysqList;
            ViewBag.jstype = jstype;
            return(View(consume));
        }
        /// <summary>
        /// 结账页面
        /// </summary>
        /// <param name="roomRegId"></param>
        /// <param name="models"></param>
        /// <returns></returns>
        public ActionResult _Jz(long roomRegId, int jstype)
        {
            var user    = UserContext.CurrentUser;
            var roomReg = RoomRegBll.GetById(roomRegId);

            if (roomReg == null)
            {
                roomReg = new Model.RoomReg()
                {
                    Id = roomRegId, HotelId = user.HotelId
                }
            }
            ;
            if (roomReg.CustomerType == 2)
            {
                //如果是连房成员,则需要获取主房登记id
                var zf = RoomRegBll.GetById(roomReg.ZfDjId);
                if (zf.CustomerType == 3)
                {
                    //主房如果是酒店会员
                    var member = MemberBll.GetById(long.Parse(zf.MemCompId));
                    if (member == null)
                    {
                        member = new Member();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 3, Data = JsonConvert.SerializeObject(member)
                    };
                }
                else if (zf.CustomerType == 4)
                {
                    //主房如果是协议单位
                    var comAgree = AgreeCompanyBll.GetById(zf.MemCompId);
                    if (comAgree == null)
                    {
                        comAgree = new AgreeCompany();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                    };
                }
                else
                {
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 1
                    };
                }
            }
            else if (roomReg.CustomerType == 3)
            {
                //如果是酒店会员
                var member = MemberBll.GetById(long.Parse(roomReg.MemCompId));
                if (member == null)
                {
                    member = new Member();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 3, Data = JsonConvert.SerializeObject(member)
                };
            }
            else if (roomReg.CustomerType == 4)
            {
                //如果是协议单位
                var comAgree = AgreeCompanyBll.GetById(roomReg.MemCompId);
                if (comAgree == null)
                {
                    comAgree = new AgreeCompany();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                };
            }
            else
            {
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 1
                };
            }
            //获取支付方式列表
            var payTypeList = PayTypeBll.GetList(user.HotelId, true, true);

            if (payTypeList == null)
            {
                payTypeList = new List <PayType>();
            }
            var payList = new List <RoomRegZwPaytypeHelp>();

            foreach (var item in payTypeList)
            {
                payList.Add(new RoomRegZwPaytypeHelp()
                {
                    Id      = item.Id.ToString(),
                    PayId   = item.Id.ToString(),
                    PayName = item.Name,
                    Money   = 0,
                });
            }
            ViewBag.PayList = payList;
            //获取卡类型
            var cardTypeList = CardTypeBll.GetList(UserContext.CurrentUser.HotelId);

            ViewBag.CardTypeList = cardTypeList;
            //获取未结账的联房数据
            //获取未结算明细
            //var wjsmxList = new List<RoomRegZw>();
            if (jstype == (int)JzType.将其他所有联房费用数据转到该房间有该房间结账)
            {
                var lfList = RoomRegBll.Fetch($"where ZfDjId={roomReg.ZfDjId}");
                //lfList = lfList.Where(m => m.CwState != 3 && m.CwState != 4 && m.CwState != 2).ToList();
                lfList = lfList.Where(m => m.CwState == 1).ToList();
                if (lfList == null || lfList.Count == 0)
                {
                    return(Content("无未结算的联房数据"));
                }
                foreach (var lf in lfList)
                {
                    //var wjsmx = RoomRegZwBll.GetFyListForBfjz(lf.Id);
                    //if (wjsmx != null)
                    //    wjsmxList.AddRange(wjsmx);
                    //计算汇总
                    if (lf.Id == roomRegId)
                    {
                        continue;
                    }
                    //roomReg.Yszk += lf.Yszk;
                    roomReg.FfMoney    += lf.FfMoney;
                    roomReg.SpMoney    += lf.SpMoney;
                    roomReg.SwpcMoney  += lf.SwpcMoney;
                    roomReg.QtMoney    += lf.QtMoney;
                    roomReg.HcMoney    += lf.HcMoney;
                    roomReg.YhMoney    += lf.YhMoney;
                    roomReg.ExpYhMoney += lf.ExpYhMoney;

                    roomReg.ZskMoney += lf.ZskMoney;
                    roomReg.ZtkMoney += lf.ZtkMoney;
                }
            }

            //ViewBag.WjsmxList = wjsmxList;
            //获取信用卡预授权
            var xykysqList = RoomRegXykBll.GetYsq(roomRegId);

            if (xykysqList == null || xykysqList.Count == 0)
            {
                xykysqList = new List <RoomRegXyk>();
            }
            ViewBag.Xykysq = xykysqList;
            ViewBag.jstype = jstype;
            return(View(roomReg));
        }
        /// <summary>
        /// 部分结账页面--与结账页面大体相同
        /// </summary>
        /// <param name="roomRegId"></param>
        /// <param name="models"></param>
        /// <returns></returns>
        public ActionResult _Bfjz(long roomRegId)
        {
            var user    = UserContext.CurrentUser;
            var roomReg = RoomRegBll.GetById(roomRegId);

            if (roomReg == null)
            {
                roomReg = new Model.RoomReg()
                {
                    Id = roomRegId, HotelId = user.HotelId
                }
            }
            ;
            if (roomReg.CustomerType == 2)
            {
                //如果是连房成员,则需要获取主房登记id
                var zf = RoomRegBll.GetById(roomReg.ZfDjId);
                if (zf.CustomerType == 3)
                {
                    //主房如果是酒店会员
                    var member = MemberBll.GetById(long.Parse(zf.MemCompId));
                    if (member == null)
                    {
                        member = new Member();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 3, Data = JsonConvert.SerializeObject(member)
                    };
                }
                else if (zf.CustomerType == 4)
                {
                    //主房如果是协议单位
                    var comAgree = AgreeCompanyBll.GetById(zf.MemCompId);
                    if (comAgree == null)
                    {
                        comAgree = new AgreeCompany();
                    }
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                    };
                }
                else
                {
                    ViewBag.CustomerType = new CustomerTypeHelp {
                        Type = 1
                    };
                }
            }
            else if (roomReg.CustomerType == 3)
            {
                //如果是酒店会员
                var member = MemberBll.GetById(long.Parse(roomReg.MemCompId));
                if (member == null)
                {
                    member = new Member();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 3, Data = JsonConvert.SerializeObject(member)
                };
            }
            else if (roomReg.CustomerType == 4)
            {
                //如果是协议单位
                var comAgree = AgreeCompanyBll.GetById(roomReg.MemCompId);
                if (comAgree == null)
                {
                    comAgree = new AgreeCompany();
                }
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 4, Data = JsonConvert.SerializeObject(comAgree)
                };
            }
            else
            {
                ViewBag.CustomerType = new CustomerTypeHelp {
                    Type = 1
                };
            }
            //获取支付方式列表
            var payTypeList = PayTypeBll.GetList(user.HotelId, true, true);

            if (payTypeList == null)
            {
                payTypeList = new List <PayType>();
            }
            var payList = new List <RoomRegZwPaytypeHelp>();

            foreach (var item in payTypeList)
            {
                payList.Add(new RoomRegZwPaytypeHelp()
                {
                    Id      = item.Id.ToString(),
                    PayId   = item.Id.ToString(),
                    PayName = item.Name,
                    Money   = 0,
                });
            }
            ViewBag.PayList = payList;
            //获取卡类型
            var cardTypeList = CardTypeBll.GetList(UserContext.CurrentUser.HotelId);

            ViewBag.CardTypeList = cardTypeList;
            return(View(roomReg));
        }