Ejemplo n.º 1
0
        /// <summary>
        /// 获取收退款明细
        /// </summary>
        /// <returns></returns>
        public string GetStkList(long consumeId)
        {
            var datas = new List <RoomRegStkViewHelp>();
            //获取收款数据
            var skList = PosConsumeSkBll.GetList(consumeId);

            if (skList != null && skList.Count > 0)
            {
                var sum = skList.Sum(m => m.Money);
                var sk  = new RoomRegStkViewHelp()
                {
                    Type     = 0,
                    Id       = Guid.NewGuid().ToString(),
                    Name     = "收款",
                    Money    = $"汇总:{sum}",
                    children = new List <RoomRegStkViewHelp>()
                };
                foreach (var item in skList)
                {
                    sk.children.Add(new RoomRegStkViewHelp()
                    {
                        Type        = 1,
                        Id          = item.Id.ToString(),
                        Name        = string.Empty,
                        DjNum       = item.DjNum,
                        SgDh        = item.SgDh,
                        FsTime      = item.FsTime,
                        PayTypeName = item.PayTypeName,
                        RType       = item.RType.ToString(),
                        YhkId       = item.YhkId.ToString(),
                        Money       = item.Money.ToString(),
                        HandlerName = item.HandlerName,
                        Remark      = item.Remark,
                        KdRemark    = item.KdRemark,
                    });
                }
                datas.Add(sk);
            }


            return(Newtonsoft.Json.JsonConvert.SerializeObject(datas));
        }
Ejemplo n.º 2
0
        public string GetListByIds(long[] Ids)
        {
            var data        = PosConsumeBll.GetListByIds(Ids);
            var user        = UserContext.CurrentUser;
            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(JsonConvert.SerializeObject(outdata));
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        public string GetShiftHistoryList(long posId, PosConsumeSearchInfo search)
        {
            var shift_list = PosShiftBll.GetList(posId, search);
            var outdata    = new List <Dictionary <string, object> >();
            var user       = UserContext.CurrentUser;

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

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

            foreach (var item in shift_list)
            {
                var outitem = new Dictionary <string, object>();
                outitem["Id"]        = item.Id;
                outitem["PosId"]     = item.PosId;
                outitem["DjNum"]     = item.DjNum;
                outitem["ShiftId"]   = item.ShiftId;
                outitem["ShiftName"] = ShiftBll.GetById(item.ShiftId).Name;
                outitem["NightDate"] = item.NightDate;

                List <PosConsume> data = PosConsumeBll.GetListByPosShift(item.Id);

                outitem["childrenIds"] = string.Join(",", data.Select(a => a.Id).Distinct().ToArray());

                decimal roomAmount = 0;

                foreach (var consume in data)
                {
                    var details = PosConsumeDetailBll.GetList(consume.Id);
                    var sk_list = PosConsumeSkBll.GetList(consume.Id);


                    if (consume.RoomRegId == 0) //计算转房间账
                    {
                        foreach (var detail in details)
                        {
                            if (!detail.IsFree && detail.ToRoomRegId != 0)
                            {
                                roomAmount += detail.Amount;
                            }
                        }
                        if (!outitem.ContainsKey("RoomAmount"))
                        {
                            outitem["RoomAmount"] = roomAmount;
                        }
                        else
                        {
                            outitem["RoomAmount"] = Convert.ToDecimal(outitem["RoomAmount"]) + roomAmount;
                        }
                    }
                    else
                    {
                        if (!outitem.ContainsKey("RoomAmount"))
                        {
                            outitem["RoomAmount"] = consume.AmountSum;
                        }
                        else
                        {
                            outitem["RoomAmount"] = Convert.ToDecimal(outitem["RoomAmount"]) + consume.AmountSum;
                        }
                    }
                    if (!outitem.ContainsKey("Amount"))
                    {
                        outitem["Amount"] = consume.AmountSum;
                    }
                    else
                    {
                        outitem["Amount"] = Convert.ToDecimal(outitem["Amount"]) + consume.AmountSum;
                    }
                    if (!outitem.ContainsKey("JzskMoney"))
                    {
                        outitem["JzskMoney"] = consume.JzskMoney;
                    }
                    else
                    {
                        outitem["JzskMoney"] = Convert.ToDecimal(outitem["JzskMoney"]) + consume.JzskMoney;
                    }



                    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;
                                }
                            }
                        }
                    }
                }

                outdata.Add(outitem);
            }



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