protected override object Convert(object value, Type targetType, object parameter) { if (!(value is long id)) { return(Binding.DoNothing); } if (id == 0) { return("[UNKNOWN]"); } //var bk = value as Book; //if (bk == null) return Binding.DoNothing; var to = Takeout.GetById(id); if (to == null) { return("[UNKNOWN]"); } var borrower = Borrower.GetById(to.BorrowerId); if (borrower == null) { return("[UNKNOWN]"); } return(borrower.Fullname.ToUpper()); }
public BillModel(Takeout source, ICollection <TakeoutDetail> details, RoomInfoModel roomInfo, bool IsForm = false) : this(source) { List <BillDetailsModel> billDetailsModelList = new List <BillDetailsModel>(); if (null != details && details.Count > 0) { foreach (var item in details.Where(x => x.State == 0 || x.State == 2)) { Res.View.Models.BillDetailsModel model = new Res.View.Models.BillDetailsModel(); Product product = Resources.GetRes().Products.Where(x => x.ProductId == item.ProductId).FirstOrDefault(); model.Price = item.Price; model.TotalPrice = item.TotalPrice; model.Count = item.Count; model.ProductName0 = product.ProductName0; model.ProductName1 = product.ProductName1; model.ProductName2 = product.ProductName2; billDetailsModelList.Add(model); } if (IsForm) { billDetailsModelList.Reverse(); } } this.BillDetailsModelList = billDetailsModelList; this.RoomInfo = roomInfo; }
/// <summary> /// 快速复制外卖信息 /// </summary> /// <param name="source"></param> /// <param name="IsIncludeRef"></param> /// <returns></returns> public static Takeout FastCopy(this Takeout source, bool IsIncludeRef = false) { Takeout newModel = new Takeout(); newModel.Address0 = source.Address0; newModel.Address1 = source.Address1; newModel.Address2 = source.Address2; newModel.AddTime = source.AddTime; newModel.AdminId = source.AdminId; newModel.BorrowPrice = source.BorrowPrice; newModel.DeviceId = source.DeviceId; newModel.FinishAdminId = source.FinishAdminId; newModel.FinishDeviceId = source.FinishDeviceId; newModel.FinishTime = source.FinishTime; newModel.IsPack = source.IsPack; newModel.KeepPrice = source.KeepPrice; newModel.Lang = source.Lang; newModel.MemberId = source.MemberId; newModel.MemberPaidPrice = source.MemberPaidPrice; newModel.Mode = source.Mode; newModel.Name0 = source.Name0; newModel.Name1 = source.Name1; newModel.Name2 = source.Name2; newModel.OriginalTotalPrice = source.OriginalTotalPrice; newModel.PaidPrice = source.PaidPrice; newModel.PersonCount = source.PersonCount; newModel.Phone = source.Phone; newModel.PrintCount = source.PrintCount; newModel.ReCheckedCount = source.ReCheckedCount; newModel.Remark = source.Remark; newModel.Request = source.Request; newModel.SendAdminId = source.SendAdminId; newModel.ServerTakeoutId = source.ServerTakeoutId; newModel.ServerTakeoutSessionId = source.ServerTakeoutSessionId; newModel.ServerTokenId = source.ServerTokenId; newModel.State = source.State; newModel.TakeoutId = source.TakeoutId; newModel.TotalPaidPrice = source.TotalPaidPrice; newModel.TotalPrice = source.TotalPrice; newModel.UpdateTime = source.UpdateTime; newModel.SendTime = source.SendTime; if (IsIncludeRef) { newModel.tb_admin = source.tb_admin; newModel.tb_admin1 = source.tb_admin1; newModel.tb_admin2 = source.tb_admin2; newModel.tb_device = source.tb_device1; newModel.tb_device1 = source.tb_device1; newModel.tb_member = source.tb_member; newModel.tb_takeoutdetail = source.tb_takeoutdetail; newModel.tb_takeoutpay = source.tb_takeoutpay; } return(newModel); }
/// <summary> /// 初始化 /// </summary> public void Init(object obj) { Takeout model = obj as Takeout; if (null != model.tb_takeoutdetail) { details = model.tb_takeoutdetail.ToList(); } else { details = new List <TakeoutDetail>(); } if (null != model.tb_takeoutpay) { payList = model.tb_takeoutpay.ToList(); } else { payList = new List <TakeoutPay>(); } this.tempPayList = payList.ToList(); takeout = model.FastCopy(); if (!string.IsNullOrWhiteSpace(takeout.Remark)) { this.ChangePaidPrice.Remark = takeout.Remark; } else { this.ChangePaidPrice.Remark = null; } takeout.tb_member = model.tb_member; Calc(); if (!IsScanReady) { IsScanReady = true; // 刷卡 Notification.Instance.NotificationCardReader += Instance_NotificationCardReader; } _element.RaiseEvent(new BoxRoutedEventArgs(PublicEvents.BoxEvent, null, null, null, BoxType.ChangePaidPrice, model)); }
private void RefreshHistory() { History.Clear(); Task.Factory.StartNew(() => { var to = Takeout.GetByBorrower(Borrower?.Id); to.ForEach(x => context.Post(d => History.Add((Takeout)d), x)); }); }
protected override object Convert(object value, Type targetType, object parameter) { var bk = value as Book; if (bk == null) { return(Binding.DoNothing); } return(Takeout.GetRatingByBook(bk.Id)); }
protected override object Convert(object value, Type targetType, object parameter) { var usr = value as User; if (usr == null) { return(null); } return(Takeout.GetByUser(usr.Id)); }
/// <summary> /// 清除引用 /// </summary> /// <param name="model"></param> public static void ClearReferences(this Takeout model) { model.tb_admin = null; model.tb_admin1 = null; model.tb_admin2 = null; model.tb_device = null; model.tb_device1 = null; model.tb_member = null; model.tb_takeoutdetail = null; model.tb_takeoutpay = null; }
protected override object Convert(object value, Type targetType, object parameter) { var bk = value as Book; if (bk == null) { return(Binding.DoNothing); } var to = Takeout.GetById(bk.TakeoutId); return(to); }
/// <summary> /// 初始化 /// </summary> public void Init(object obj) { this.PaidPrice = "0"; this.MemberPaidPrice = "0"; this.BalanceMode = 0; Takeout model = obj as Takeout; if (null != model.tb_takeoutdetail) { details = model.tb_takeoutdetail.ToList(); } else { details = new List <TakeoutDetail>(); } if (null != model.tb_takeoutpay) { payList = model.tb_takeoutpay.ToList(); } else { payList = new List <TakeoutPay>(); } this.tempPayList = payList.ToList(); takeout = model.FastCopy(); if (!string.IsNullOrWhiteSpace(takeout.Remark)) { this.ChangePaidPrice.Remark = takeout.Remark; } else { this.ChangePaidPrice.Remark = null; } takeout.tb_member = model.tb_member; Calc(); }
public TakeoutCheckoutReport(Takeout takeout, List <Product> productList, Printer printer, string PriceSymbol, long Lang = -1) { this.Takeout = takeout; this.ProductList = productList; this.Printer = printer; this.Lang = Lang; this.PriceSymbol = PriceSymbol; this.BillLang = takeout.Lang; WidhtMillimeters = 48; MarginsMillimeters = PaperMargins.None(); IsThermalPrinter = true; }
public BackstageTakeoutReport(Takeout takeout, List <Product> productList, Printer printer, List <Request> Requests, long Lang = -1) { this.Takeout = takeout; this.ProductList = productList; this.Printer = printer; this.Lang = Lang; this.Requests = Requests; this.BillLang = takeout.Lang; WidhtMillimeters = 72.1; MarginsMillimeters = PaperMargins.None(); IsThermalPrinter = true; }
/// <summary> /// 返回外卖 /// </summary> /// <returns></returns> public Takeout GetTakeout() { if (this.BillType != 2) { return(null); } Takeout newModel = new Takeout(); newModel.Address0 = this.Address0; newModel.Address1 = this.Address1; newModel.Address2 = this.Address2; newModel.AddTime = this.AddTime; newModel.AdminId = this.AdminId; newModel.BorrowPrice = this.BorrowPrice; newModel.DeviceId = this.DeviceId; newModel.FinishAdminId = this.FinishAdminId; newModel.FinishDeviceId = this.FinishDeviceId; newModel.FinishTime = this.FinishTime; newModel.IsPack = this.IsPack; newModel.KeepPrice = this.KeepPrice; newModel.Lang = this.Lang; newModel.MemberId = this.MemberId; newModel.MemberPaidPrice = this.MemberPaidPrice; newModel.Mode = this.Mode; newModel.Name0 = this.Name0; newModel.Name1 = this.Name1; newModel.Name2 = this.Name2; newModel.OriginalTotalPrice = this.OriginalTotalPrice; newModel.PaidPrice = this.PaidPrice; newModel.PersonCount = this.PersonCount; newModel.Phone = this.Phone; newModel.PrintCount = this.PrintCount; newModel.ReCheckedCount = this.ReCheckedCount; newModel.Remark = this.Remark; newModel.Request = this.Request; newModel.SendAdminId = this.SendAdminId; newModel.ServerTakeoutId = this.ServerTakeoutId; newModel.ServerTakeoutSessionId = this.ServerTakeoutSessionId; newModel.ServerTokenId = this.ServerTokenId; newModel.State = this.State; newModel.TakeoutId = this.Id; newModel.TotalPaidPrice = this.TotalPaidPrice; newModel.TotalPrice = this.TotalPrice; newModel.UpdateTime = this.UpdateTime; newModel.tb_member = this.tb_member; return(newModel); }
public TakeoutCheckoutMiddleReport(Takeout takeout, List <Product> productList, Printer printer, int heightMillimeters, string PriceSymbol, long Lang = -1) { this.Takeout = takeout; this.ProductList = productList; this.Printer = printer; this.Lang = Lang; this.PriceSymbol = PriceSymbol; this.BillLang = takeout.Lang; WidhtMillimeters = 200; HeightMillimeters = heightMillimeters - 10; MarginsMillimeters = PaperMargins.All(Length.Millimeters(5)); }
protected override object Convert(object value, Type targetType, object parameter) { var bk = value as Book; if (bk == null) { return(Binding.DoNothing); } var to = Takeout.GetById(bk.TakeoutId); if (to == null) { return("NO RECORD"); } return(to.TakeoutDate.ToString(Format)); }
public BillModel(Takeout source) { this.BillType = 2; this.Address1 = source.Address0; this.Address0 = source.Address1; this.Address2 = source.Address2; this.AddTime = source.AddTime; this.AdminId = source.AdminId; this.BorrowPrice = source.BorrowPrice; this.DeviceId = source.DeviceId; this.FinishAdminId = source.FinishAdminId; this.FinishDeviceId = source.FinishDeviceId; this.FinishTime = source.FinishTime; this.IsPack = source.IsPack; this.KeepPrice = source.KeepPrice; this.Lang = source.Lang; this.MemberId = source.MemberId; this.MemberPaidPrice = source.MemberPaidPrice; this.Mode = source.Mode; this.Name0 = source.Name0; this.Name1 = source.Name0; this.Name2 = source.Name2; this.OriginalTotalPrice = source.OriginalTotalPrice; this.PaidPrice = source.PaidPrice; this.PersonCount = source.PersonCount; this.Phone = source.Phone; this.PrintCount = source.PrintCount; this.ReCheckedCount = source.ReCheckedCount; this.Remark = source.Remark; this.Request = source.Request; this.SendAdminId = source.SendAdminId; this.ServerTakeoutId = source.ServerTakeoutId; this.ServerTakeoutSessionId = source.ServerTakeoutSessionId; this.ServerTokenId = source.ServerTokenId; this.State = source.State; this.Id = source.TakeoutId; this.TotalPaidPrice = source.TotalPaidPrice; this.TotalPrice = source.TotalPrice; this.UpdateTime = source.UpdateTime; this.tb_member = source.tb_member; }
private void TakeoutBooks(object obj) { foreach (var book in BookCart) { var to = new Takeout() { UserId = 0,//Session.Current.User.Id, BookId = book.Id, BorrowerId = Borrower.Id, TakeOutCondition = book.Condition, }; to.Save(); book.Update(nameof(Book.TakeoutId), to.Id); } BookCart.Clear(); BookCode = ""; Barcode = ""; Borrower = null; Messenger.Default.Broadcast(Messages.TakeoutsChanged); }
/// <summary> /// 查看数据 /// </summary> private void Check() { if (krpcbOrderType.SelectedIndex == 0) { StartLoad(this, null); Task.Factory.StartNew(() => { try { List <OrderDetail> orderdetails; List <OrderPay> orderpays; long orderId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrderId"].Value.ToString()); bool result = OperatesService.GetOperates().ServiceGetOrderDetail(orderId, out orderdetails, out orderpays); this.BeginInvoke(new Action(() => { if (result) { Order order = resultList.Where(x => x.Id == orderId).FirstOrDefault().GetOrder(); OrderDetailsWindow details = new OrderDetailsWindow(order, orderdetails, orderpays); details.StartLoad += (sender2, e2) => { StartLoad(sender2, null); }; details.StopLoad += (sender2, e2) => { StopLoad(sender2, null); }; details.ShowDialog(this); } else { KryptonMessageBox.Show(this, Resources.GetRes().GetString("GetFailed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } })); } catch (Exception ex) { this.BeginInvoke(new Action(() => { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("GetFailed")); })); } StopLoad(this, null); }); } else { StartLoad(this, null); Task.Factory.StartNew(() => { try { List <TakeoutDetail> takeoutdetails; List <TakeoutPay> takeoutpays; long takeoutId = long.Parse(krpdgList.SelectedRows[0].Cells["krpcmOrderId"].Value.ToString()); bool result = OperatesService.GetOperates().ServiceGetTakeoutDetail(takeoutId, out takeoutdetails, out takeoutpays); this.BeginInvoke(new Action(() => { if (result) { Takeout takeout = resultList.Where(x => x.Id == takeoutId).FirstOrDefault().GetTakeout(); TakeoutDetailsWindow details = new TakeoutDetailsWindow(takeout, takeoutdetails, takeoutpays); details.StartLoad += (sender2, e2) => { StartLoad(sender2, null); }; details.StopLoad += (sender2, e2) => { StopLoad(sender2, null); }; details.ShowDialog(this); } else { KryptonMessageBox.Show(this, Resources.GetRes().GetString("GetFailed"), Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } })); } catch (Exception ex) { this.BeginInvoke(new Action(() => { ExceptionPro.ExpLog(ex, new Action <string>((message) => { KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.OK, MessageBoxIcon.Warning); }), false, Resources.GetRes().GetString("GetFailed")); })); } StopLoad(this, null); }); } }
public void AddTakeout(Takeout to) { BookTakeouts.Add(to); }
public void RemoveTakeout(Takeout to) { BookTakeouts.Remove(to); }
/// <summary> /// 计算 /// </summary> /// <param name="details"></param> /// <param name="takeout"></param> /// <param name="IgnoreError"></param> /// <param name="OnlyTotal"></param> /// <param name="IgnoreNotConfirm"></param> /// <param name="IgnoreCanceld"></param> /// <param name="IgnoreCancelId"></param> private void Calc(out List <TakeoutDetail> details, out Takeout takeout, bool IgnoreError = true, bool OnlyTotal = false, bool IgnoreNotConfirm = true, bool IgnoreCanceld = true, long IgnoreCancelId = -999) { details = new List <TakeoutDetail>(); List <TakeoutDetail> detailsAll = new List <TakeoutDetail>(); takeout = new Takeout(); if (!OnlyTotal) { foreach (var item in Selected.CurrentSelectedList) { TakeoutDetail takeoutDetails = new TakeoutDetail(); takeoutDetails.ProductId = item.Product.ProductId; takeoutDetails.IsPack = item.OrderDetail.IsPack; takeoutDetails.Count = item.OrderDetail.Count; if (item.NewPrice.HasValue) { takeoutDetails.Price = item.NewPrice.Value; } else { takeoutDetails.Price = item.OrderDetail.Price; } takeoutDetails.TotalPrice = item.TotalPrice; takeoutDetails.OriginalTotalPrice = Math.Round(item.OrderDetail.Price * item.OrderDetail.Count); takeoutDetails.TotalCostPrice = Math.Round(item.Product.CostPrice * item.OrderDetail.Count); if (item.Product.CostPrice == 0 && null != item.Product.ProductParentId) { Product parentProduct = Resources.GetRes().Products.FirstOrDefault(x => x.ProductId == item.Product.ProductParentId); if (null != parentProduct) { double price = Math.Round(parentProduct.CostPrice / item.Product.ProductParentCount, 2); takeoutDetails.TotalCostPrice = Math.Round(price * takeoutDetails.Count, 2); } } takeoutDetails.TakeoutDetailId = item.OrderDetail.OrderDetailId; takeoutDetails.State = item.OrderDetail.State; takeoutDetails.Request = item.OrderDetail.Request; if (item.IsNew) { details.Add(takeoutDetails); } detailsAll.Add(takeoutDetails); } } IEnumerable <TakeoutDetail> totalDetails = detailsAll; if (IgnoreNotConfirm) { totalDetails = totalDetails.Where(x => x.State != 1); } if (IgnoreCanceld) { totalDetails = totalDetails.Where(x => x.State != 3); } lastTotal = Math.Round(totalDetails.Sum(x => x.TotalPrice), 2); lastOriginalTotalPrice = Math.Round(totalDetails.Sum(x => x.OriginalTotalPrice), 2); if (IgnoreCancelId != -999 && totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).Count() > 0) { lastTotal = Math.Round(lastTotal - totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).FirstOrDefault().TotalPrice, 2); lastOriginalTotalPrice = Math.Round(lastOriginalTotalPrice - totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).FirstOrDefault().OriginalTotalPrice, 2); } takeout.Lang = Language.LanguageMode; takeout.IsPack = 0; takeout.TotalPaidPrice = Math.Round(takeout.MemberPaidPrice + takeout.PaidPrice, 2); Selected.TotalPrice = takeout.TotalPrice = lastTotal; takeout.OriginalTotalPrice = lastOriginalTotalPrice; double balancePrice = 0; balancePrice = Math.Round(takeout.TotalPaidPrice - takeout.TotalPrice, 2); if (balancePrice > 0) { takeout.KeepPrice = balancePrice; takeout.BorrowPrice = 0; } else if (balancePrice < 0) { takeout.BorrowPrice = balancePrice; takeout.KeepPrice = 0; } else if (balancePrice == 0) { takeout.BorrowPrice = 0; takeout.KeepPrice = 0; } // 显示客显(实际客户需要支付的赊账) Common.GetCommon().OpenPriceMonitor(takeout.BorrowPrice.ToString()); // 刷新第二屏幕 if (FullScreenMonitor.Instance._isInitialized) { FullScreenMonitor.Instance.RefreshSecondMonitorList(new Res.View.Models.BillModel(takeout, details, null)); } if (OnlyTotal) { return; } }
public TakeoutCheckoutWindow(Takeout model, bool IsRechecked = false) { if (null != model.tb_takeoutdetail) { details = model.tb_takeoutdetail.ToList(); } else { details = new List <TakeoutDetail>(); } if (null != model.tb_takeoutpay) { payList = model.tb_takeoutpay.ToList(); } else { payList = new List <TakeoutPay>(); } this.tempPayList = payList.ToList(); takeout = model.FastCopy(); this.IsRechecked = IsRechecked; takeout.tb_member = model.tb_member; InitializeComponent(); this.Text = Resources.GetRes().GetString("CheckoutOrder"); krplTotalPrice.Text = Resources.GetRes().GetString("TotalPrice"); krplPaidPrice.Text = Resources.GetRes().GetString("PaidPrice"); krpbCheckout.Text = Resources.GetRes().GetString("CheckoutOrder"); krplBorrowPrice.Text = Resources.GetRes().GetString("OwedPrice"); krplKeepPrice.Text = Resources.GetRes().GetString("KeepPrice"); krplMemberPaidPrice.Text = Resources.GetRes().GetString("MemberPaidPrice"); krplTotalPaidPrice.Text = Resources.GetRes().GetString("TotalPaidPrice"); Assembly asm = Assembly.LoadFrom(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Res.dll")); this.Icon = new Icon(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.CheckoutOrder.ico")); payWindow = new PriceCommonChangeWindow("+", takeout.TotalPrice, tempPayList.Select(x => new CommonPayModel(x)).ToList(), true, true, Recalc); payWindow.StartLoad += (x, y) => { this.StartLoad(x, y); }; payWindow.StopLoad += (x, y) => { this.StopLoad(x, y); }; payWindow.TopLevel = false; pnPrice.Controls.Add(payWindow); payWindow.Show(); Calc(); // 刷卡 Notification.Instance.NotificationCardReader += Instance_NotificationCardReader; }
public TakeoutDetailsWindow(Takeout takeout, List <TakeoutDetail> takeoutdetails, List <TakeoutPay> payList) { this.takeout = takeout; this.resultList = takeoutdetails; this.payList = payList; InitializeComponent(); krpdgList.RecalcMagnification(); krpdgPayList.RecalcMagnification(); new CustomTooltip(this.krpdgList); this.Text = Resources.GetRes().GetString("OrderDetails"); ResetPage(); Assembly asm = Assembly.LoadFrom(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Res.dll")); krpbBeginPage.StateCommon.Back.Image = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.moveFirst.png")); krpbPrewPage.StateCommon.Back.Image = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.previous.png")); krpbNextPage.StateCommon.Back.Image = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.next.png")); krpbEngPage.StateCommon.Back.Image = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.moveLast.png")); krpbClickToPage.StateCommon.Back.Image = Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.select.png")); krpbBeginPage.StateCommon.Back.ImageStyle = krpbPrewPage.StateCommon.Back.ImageStyle = krpbNextPage.StateCommon.Back.ImageStyle = krpbEngPage.StateCommon.Back.ImageStyle = krpbClickToPage.StateCommon.Back.ImageStyle = PaletteImageStyle.CenterMiddle; krplPage.Text = Resources.GetRes().GetString("Page"); krplOrderNo.Text = Resources.GetRes().GetString("OrderNo"); krplTotalPrice.Text = Resources.GetRes().GetString("TotalPrice"); krplState.Text = Resources.GetRes().GetString("State"); krplAddTime.Text = Resources.GetRes().GetString("AddTime"); krplFinishTime.Text = Resources.GetRes().GetString("FinishTime"); krplBorrowPrice.Text = Resources.GetRes().GetString("OwedPrice"); krplKeepPrice.Text = Resources.GetRes().GetString("KeepPrice"); krplMemberName.Text = Resources.GetRes().GetString("MemberName"); krplMemberPaidPrice.Text = Resources.GetRes().GetString("MemberPaidPrice"); krplTotalPaidPrice.Text = Resources.GetRes().GetString("TotalPaidPrice"); krplPaidPrice.Text = Resources.GetRes().GetString("PaidPrice"); krplPhone.Text = Resources.GetRes().GetString("Phone"); krpcbMultipleLanguage.Text = Resources.GetRes().GetString("MultiLanguage"); krplName0.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("PersonName"), Resources.GetRes().GetMainLangByMainLangIndex(0).LangName); krplName1.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("PersonName"), Resources.GetRes().GetMainLangByMainLangIndex(1).LangName); krplName2.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("PersonName"), Resources.GetRes().GetMainLangByMainLangIndex(2).LangName); krplAddress0.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("Address"), Resources.GetRes().GetMainLangByMainLangIndex(0).LangName); krplAddress1.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("Address"), Resources.GetRes().GetMainLangByMainLangIndex(1).LangName); krplAddress2.Text = string.Format("{0}-{1}", Resources.GetRes().GetString("Address"), Resources.GetRes().GetMainLangByMainLangIndex(2).LangName); krptPhone.Text = takeout.Phone; krptName0.Text = takeout.Name0; krptName1.Text = takeout.Name1; krptName2.Text = takeout.Name2; krptAddress0.Text = takeout.Address0; krptAddress1.Text = takeout.Address1; krptAddress2.Text = takeout.Address2; krplOrderNoValue.Text = string.Format(": {0}", takeout.TakeoutId.ToString()); krplTotalPriceValue.Text = string.Format(": {0}", takeout.TotalPrice.ToString()); krplStateValue.Text = string.Format(": {0}", GetOrderState(takeout.State)); krplBorrowPriceValue.Text = string.Format(": {0}", takeout.BorrowPrice.ToString()); krplKeepPriceValue.Text = string.Format(": {0}", takeout.KeepPrice.ToString()); if (null == takeout.tb_member) { krplMemberNameValue.Text = ":"; } else { if (Resources.GetRes().MainLangIndex == 0) { krplMemberNameValue.Text = string.Format(": {0}", takeout.tb_member.MemberName0.ToString()); } else if (Resources.GetRes().MainLangIndex == 1) { krplMemberNameValue.Text = string.Format(": {0}", takeout.tb_member.MemberName1.ToString()); } else if (Resources.GetRes().MainLangIndex == 2) { krplMemberNameValue.Text = string.Format(": {0}", takeout.tb_member.MemberName2.ToString()); } } krplMemberPaidPriceValue.Text = string.Format(": {0}", takeout.MemberPaidPrice.ToString()); krplTotalPaidPriceValue.Text = string.Format(": {0}", takeout.TotalPaidPrice.ToString()); krplPaidPriceValue.Text = string.Format(": {0}", takeout.PaidPrice.ToString()); try { krplAddTimeValue.Text = string.Format(": {0}", DateTime.ParseExact(takeout.AddTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm")); if (null != takeout.FinishTime) { krplFinishTimeValue.Text = string.Format(":{0}", DateTime.ParseExact(takeout.FinishTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm")); } else { krplFinishTimeValue.Text = ";"; } } catch (Exception ex) { ExceptionPro.ExpLog(ex); } double balancePrice = Math.Round(takeout.TotalPaidPrice - takeout.TotalPrice, 2); // 客户给的钱减去原价, 剩余说明 有钱需要退回 if (balancePrice > 0) { this.krplKeepPriceValue.StateCommon.ShortText.Color1 = Color.Blue; } else if (balancePrice < 0) { this.krplBorrowPriceValue.StateCommon.ShortText.Color1 = Color.Red; } if (int.Parse(Resources.GetRes().GetString("HightFix")) != 0) { krplPage.StateCommon.Padding = new Padding(0, 0, 0, int.Parse(Resources.GetRes().GetString("HightFix")).RecalcMagnification2()); krptCurrentPage.Location = new Point(krptCurrentPage.Location.X, krptCurrentPage.Location.Y + int.Parse(Resources.GetRes().GetString("HightFix")).RecalcMagnification2()); } //增加右键 //打印 LoadContextMenu(kryptonContextMenuItemPrint, Resources.GetRes().GetString("Print"), Resources.GetRes().GetString("PrintDescription"), Image.FromStream(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.Print.png")), (sender, e) => { Print(); }); this.Icon = new Icon(asm.GetManifestResourceStream(@"Oybab.Res.Resources.Images.PC.OrderDetails.ico")); //初始化 Init(); ResetPage(); if (resultList.Count() > 0) { OpenPageTo(1, false); } OpenPageTo2(); }
/// <summary> /// 计算 /// </summary> /// <param name="details"></param> /// <param name="import"></param> /// <param name="IgnoreError"></param> /// <param name="OnlyTotal"></param> private void Calc(out List <TakeoutDetail> details, out Takeout takeout, bool IgnoreError = true, bool OnlyTotal = false, bool IgnoreNotConfirm = true, bool IgnoreCanceld = true, long IgnoreCancelId = -999) { details = new List <TakeoutDetail>(); List <TakeoutDetail> detailsAll = new List <TakeoutDetail>(); takeout = new Takeout(); if (!OnlyTotal) { foreach (var item in Selected.CurrentSelectedList) { TakeoutDetail orderDetails = new TakeoutDetail(); orderDetails.ProductId = item.Product.ProductId; orderDetails.IsPack = item.OrderDetail.IsPack; orderDetails.Count = item.OrderDetail.Count; if (item.NewPrice.HasValue) { orderDetails.Price = item.NewPrice.Value; } else { orderDetails.Price = item.OrderDetail.Price; } orderDetails.TotalPrice = item.TotalPrice; orderDetails.OriginalTotalPrice = Math.Round(item.OrderDetail.Price * item.OrderDetail.Count); orderDetails.TotalCostPrice = Math.Round(item.Product.CostPrice * item.OrderDetail.Count); if (item.Product.CostPrice == 0 && null != item.Product.ProductParentId) { Product parentProduct = Resources.Instance.Products.FirstOrDefault(x => x.ProductId == item.Product.ProductParentId); if (null != parentProduct) { double price = Math.Round(parentProduct.CostPrice / item.Product.ProductParentCount, 2); orderDetails.TotalCostPrice = Math.Round(price * orderDetails.Count, 2); } } orderDetails.TakeoutDetailId = item.OrderDetail.OrderDetailId; orderDetails.State = item.OrderDetail.State; orderDetails.Request = item.OrderDetail.Request; if (item.IsNew) { details.Add(orderDetails); } detailsAll.Add(orderDetails); } } //if (!OnlyTotal) //{ IEnumerable <TakeoutDetail> totalDetails = detailsAll; if (IgnoreNotConfirm) { totalDetails = totalDetails.Where(x => x.State != 1); } if (IgnoreCanceld) { totalDetails = totalDetails.Where(x => x.State != 3); } lastTotal = Math.Round(totalDetails.Sum(x => x.TotalPrice), 2); lastOriginalTotalPrice = Math.Round(totalDetails.Sum(x => x.OriginalTotalPrice), 2); if (IgnoreCancelId != -999 && totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).Count() > 0) { lastTotal = Math.Round(lastTotal - totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).FirstOrDefault().TotalPrice, 2); lastOriginalTotalPrice = Math.Round(lastOriginalTotalPrice - totalDetails.Where(x => x.TakeoutDetailId == IgnoreCancelId).FirstOrDefault().OriginalTotalPrice, 2); } //} takeout.Lang = Selected.LanguageMode; takeout.IsPack = 0; takeout.TotalPaidPrice = Math.Round(takeout.MemberPaidPrice + takeout.PaidPrice, 2); Selected.TotalPrice = takeout.TotalPrice = lastTotal; takeout.OriginalTotalPrice = lastOriginalTotalPrice; double balancePrice = 0; balancePrice = Math.Round(takeout.TotalPaidPrice - takeout.TotalPrice, 2); if (balancePrice > 0) { takeout.KeepPrice = balancePrice; takeout.BorrowPrice = 0; } else if (balancePrice < 0) { takeout.BorrowPrice = balancePrice; takeout.KeepPrice = 0; } else if (balancePrice == 0) { takeout.BorrowPrice = 0; takeout.KeepPrice = 0; } if (OnlyTotal) { return; } }