示例#1
0
        public string GetList(long posId)
        {
            var models = PosConsumeBll.GetListByPos(posId);

            return(JsonConvert.SerializeObject(models));
        }
示例#2
0
        public string GetJJList(long posId, string isToday, PosConsumeSearchInfo search)
        {
            var user = UserContext.CurrentUser;
            List <PosConsume> data = new List <PosConsume>();

            if (search.hasValue())
            {
                data = PosConsumeBll.GetListByPos(posId, search);
            }
            else if (isToday == "Y")
            {
                data = PosConsumeBll.GetTodayListByPos(posId);
            }
            else
            {
                data = PosConsumeBll.GetListByPos(posId);
            }

            data = data.Where(a => a.PosShiftId == 0 && a.CwState == 1).ToList();

            var payTypeList = PayTypeBll.GetList(user.HotelId, true, true);

            if (payTypeList == null)
            {
                payTypeList = new List <PayType>();
            }
            var outdata = new List <Dictionary <string, object> >();

            foreach (var item in data)
            {
                var outitem = new Dictionary <string, object>();
                outitem["Id"]    = item.Id;
                outitem["PosId"] = item.PosId;
                if (item.RoomRegId != 0)
                {
                    var roomReg = RoomRegBll.GetById(item.RoomRegId);
                    outitem["RoomNo"]          = roomReg.RoomNO;
                    outitem["RoomRegIdStr"]    = item.RoomRegId.ToString();
                    outitem["RoomRegDanJuNum"] = roomReg.DanJuNum;
                }
                else
                {
                }

                var details = PosConsumeDetailBll.GetList(item.Id);
                var sk_list = PosConsumeSkBll.GetList(item.Id);
                var tk_list = PosConsumeTkBll.GetList(item.Id);

                decimal roomAmount = 0;
                if (item.RoomRegId == 0)
                {
                    foreach (var detail in details)
                    {
                        if (!detail.IsFree && detail.ToRoomRegId != 0)
                        {
                            roomAmount += detail.Amount;
                        }
                    }
                    outitem["RoomAmount"] = roomAmount;
                }
                else
                {
                    outitem["RoomAmount"] = item.AmountSum;
                }

                foreach (var o in sk_list)
                {
                    foreach (var payType in payTypeList)
                    {
                        if (o.PayTypeId == payType.Id)
                        {
                            var key = "Amount" + o.PayTypeName;
                            if (!outitem.ContainsKey(key))
                            {
                                outitem[key] = o.Money;
                            }
                            else
                            {
                                outitem[key] = Convert.ToDecimal(outitem[key]) + o.Money;
                            }
                        }
                    }
                }
                outitem["NightDate"] = item.NightDate;
                outitem["OrderNo"]   = item.OrderNo;
                outitem["OrderDate"] = item.OrderDate;
                outitem["OutTime"]   = item.OutTime;
                outitem["Amount"]    = item.Amount;
                outitem["JzskMoney"] = item.JzskMoney;
                outdata.Add(outitem);
            }



            return(Newtonsoft.Json.JsonConvert.SerializeObject(outdata));
        }