public string GetShiftDetails(long PosShiftId) { var user = UserContext.CurrentUser; List <PosConsume> data = new List <PosConsume>(); data = PosConsumeBll.GetListByPosShift(PosShiftId); var outdata = new List <Dictionary <string, object> >(); var payTypeList = PayTypeBll.GetList(user.HotelId, true, true); if (payTypeList == null) { payTypeList = new List <PayType>(); } 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)); }
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)); }