private void SubmitPaymentAmount(PaymentType paymentType, ChangePaymentType changeTemplate, decimal paymentDueAmount, decimal tenderedAmount) { _applicationStateSetter.SetLastPaidItems(OrderSelector.GetSelectedItems()); var returningAmount = DisplayReturningAmount(tenderedAmount, paymentDueAmount, changeTemplate); if (changeTemplate == null) { tenderedAmount -= returningAmount; } var paymentAccount = paymentType.Account ?? GetAccountForTransaction(paymentType, SelectedTicket.TicketResources); _ticketService.AddPayment(SelectedTicket, paymentType, paymentAccount, tenderedAmount); if (tenderedAmount > paymentDueAmount && changeTemplate != null) { _ticketService.AddChangePayment(SelectedTicket, changeTemplate, changeTemplate.Account, tenderedAmount - paymentDueAmount); } NumberPadViewModel.LastTenderedAmount = (tenderedAmount / ExchangeRate).ToString("#,#0.00"); UpdatePaymentAmount(GetRemainingAmount()); if (returningAmount == 0 && GetRemainingAmount() == 0) { ClosePaymentScreen(); } else { OrderSelector.PersistSelectedItems(); RefreshValues(); } }
public OrderSelectorViewModel(TenderedValueViewModel tenderedValueViewModel) { _tenderedValueViewModel = tenderedValueViewModel; Model = new OrderSelector(); Selectors = new ObservableCollection <SelectorViewModel>(); SelectMergedItemCommand = new DelegateCommand <SelectorViewModel>(OnMergedItemSelected); }
public OrderSelectorViewModel(TenderedValueViewModel tenderedValueViewModel) { _tenderedValueViewModel = tenderedValueViewModel; Model = new OrderSelector(); Selectors = new ObservableCollection<SelectorViewModel>(); SelectMergedItemCommand = new DelegateCommand<SelectorViewModel>(OnMergedItemSelected); }
public OrderSelectorViewModel(OrderSelector model, NumberPadViewModel numberPadViewModel) { _numberPadViewModel = numberPadViewModel; Model = model; Selectors = new ObservableCollection <SelectorViewModel>(); SelectMergedItemCommand = new DelegateCommand <SelectorViewModel>(OnMergedItemSelected); }
public OrderSelectorViewModel(OrderSelector model, NumberPadViewModel numberPadViewModel) { _numberPadViewModel = numberPadViewModel; Model = model; Selectors = new ObservableCollection<SelectorViewModel>(); SelectMergedItemCommand = new DelegateCommand<SelectorViewModel>(OnMergedItemSelected); }
void NumberPadViewModelResetValue(object sender, EventArgs e) { UpdatePaymentAmount(0); OrderSelector.ClearSelection(); RefreshValues(); RaisePropertyChanged(() => PaymentAmount); RaisePropertyChanged(() => TenderedAmount); }
private void ClosePaymentScreen() { OrderSelector.PersistTicket(); EventServiceFactory.EventService.PublishEvent(EventTopicNames.CloseTicketRequested); TenderedAmount = ""; ReturningAmount = ""; ReturningAmountVisibility = Visibility.Collapsed; IsChangeOptionsVisible = false; SelectedTicket = null; }
public void Prepare(Ticket selectedTicket) { ForeignCurrency = null; Debug.Assert(SelectedTicket == null); _applicationStateSetter.SetLastPaidItems(new List <PaidItem>()); Totals.Model = selectedTicket; SelectedTicket = selectedTicket; TicketRemainingValue = GetRemainingAmount(); UpdatePaymentAmount(0); OrderSelector.UpdateTicket(selectedTicket); RefreshValues(); NumberPadViewModel.LastTenderedAmount = PaymentAmount; CreateButtons(selectedTicket); }
private void OnSelectCalculationSelector(CalculationSelector calculationSelector) { foreach (var calculationType in calculationSelector.CalculationTypes) { var amount = calculationType.Amount; if (amount == 0) { amount = GetTenderedValue(); } if (calculationType.CalculationMethod == 0 || calculationType.CalculationMethod == 1) { amount = amount / ExchangeRate; } SelectedTicket.AddCalculation(calculationType, amount); } UpdatePaymentAmount(0); OrderSelector.UpdateTicket(SelectedTicket); RefreshValues(); }