private void SubmitPaymentAmount(PaymentType paymentType, ChangePaymentType changeTemplate, decimal paymentDueAmount, decimal tenderedAmount) { var returningAmount = _returningAmountViewModel.GetReturningAmount(tenderedAmount, paymentDueAmount, changeTemplate); var paidAmount = (changeTemplate == null) ? tenderedAmount - returningAmount : tenderedAmount; var paymentAmount = paymentDueAmount > paidAmount ? paymentDueAmount - paidAmount : _paymentEditor.GetRemainingAmount(); _orderSelectorViewModel.UpdateSelectedTicketPaidItems(); _paymentEditor.UpdateTicketPayment(paymentType, changeTemplate, paymentDueAmount, paidAmount, tenderedAmount); _numberPadViewModel.LastTenderedAmount = (paidAmount / _paymentEditor.ExchangeRate).ToString(LocalSettings.ReportCurrencyFormat); _tenderedValueViewModel.UpdatePaymentAmount(paymentAmount); if (returningAmount == 0 && _paymentEditor.GetRemainingAmount() == 0) { OnClosePaymentScreen(""); } else { if (returningAmount > 0) { _returningAmountViewModel.PublishEvent(EventTopicNames.Activate); } if (paymentDueAmount <= paidAmount) { _orderSelectorViewModel.PersistSelectedItems(); } _numberPadViewModel.ResetValues(); RaisePropertyChanged(() => SelectedTicketTitle); } }
private void OnSelectCalculationSelector(CalculationSelector calculationSelector) { foreach (var calculationType in calculationSelector.CalculationTypes) { var amount = calculationType.Amount; if (amount == 0) { amount = _tenderedValueViewModel.GetTenderedValue(); } if (calculationType.CalculationMethod == 0 || calculationType.CalculationMethod == 1) { amount = amount / _paymentEditor.ExchangeRate; } _paymentEditor.SelectedTicket.AddCalculation(calculationType, amount); } _tenderedValueViewModel.UpdatePaymentAmount(0); _orderSelectorViewModel.UpdateTicket(_paymentEditor.SelectedTicket); _numberPadViewModel.ResetValues(); }