private void CashPay(object param) { //Process promotion and get the total value this.salesData.CalcTotalValue(this.SaleList, this.SaleListItems); // Get the total payed records PayProcessor payProcessor = new CashPayProcessor(this.SaleList.SheetID.ToString()); decimal payIn = payProcessor.GetTotalPayValue(); decimal inputAmount = payProcessor.GetPayItemValue(); // Bring up the payment UI var cashPayVM = new CashPayViewModel(payProcessor) { Purchase = this.SaleList.SaleValue - this.SaleList.DiscValue, OtherPayIn = payIn - inputAmount, NewPayIn = payIn, Change = this.SaleList.PayValue - (this.SaleList.SaleValue - this.SaleList.DiscValue), InputAmount = inputAmount.ToString() }; var cashPayWin = new CashPay(cashPayVM); if (cashPayWin.ShowDialog() == true) { this.SaleList.PayValue = cashPayVM.NewPayIn; this.salesData.UpdateSalesData(this.SaleList, this.SaleListItems); if (cashPayVM.Change >= 0) { salesData.MoveSaleListToHistory(this.SaleList.SheetID.ToString()); var saleList = salesData.GetCurrentSaleList(); this.SaleList.Copy(saleList); this.SaleListItems.Clear(); } } }
private void addDiscount(decimal value) { _order.Discount = value; _order.RefreshValues(); if (Context is CardPayVM) { CardPay.RefreshValues(); } else if (Context is CashPayVM) { CashPay.RefreshValues(); } if (_order.Id != 0) { MainVM DiscountMainVm; //5/18 fix ....for thread exception. DiscountMainVm = new MainVM(); //Task.Factory.StartNew(() => //{ DiscountMainVm.SaveOrderCommand.Execute(_order); //MainVM.Main.SaveOrderCommand.Execute(_order); //}); } }
/// <summary> /// 设置现金支付 /// </summary> /// <param name="cashPay"></param> /// <returns></returns> public async Task <bool> SetCashPay(CashPay cashPay, int opId, string opMan) { var n = _db.CHIS_Charge_Pay.Where(m => m.PayOrderId == cashPay.PayOrderId).Count(); if (cashPay.GetCashAmount - cashPay.ReturnCashAmount != cashPay.PayAmount) { throw new Exception("支付金额错误!收入找零与支出不对"); } if (n == 0) { await UpdatePayedAsync(cashPay.PayOrderId, FeeTypes.Cash, $"收:{cashPay.GetCashAmount};零:{cashPay.ReturnCashAmount}", true, opId, opMan); await _logger.WriteInfoAsync("CHARGE", "ChargePaymentSuccess", $"更新现金支付{cashPay.PayOrderId}"); } return(true); }