Exemplo n.º 1
0
        void SelectPaymentMode(PaymentInfo itemToEdit)
        {
            _paymentModeModal = new PaymentModeModal();
            _paymentModeModal.Closed += new EventHandler(paymentModeModal_Closed);
            var pvm = _paymentModeModal.DataContext as PaymentModeViewModel;
            pvm.RunClearAndSetup();
            pvm.AmountPaid = _vm.AmountPaid;//carry this accross
            pvm.GrossAmount = _vm.TotalGross - _vm.AmountPaid;

            if (itemToEdit != null)
            {
                PaymentMode itemMode = itemToEdit.PaymentModeUsed;
                switch (itemMode)
                {
                    case PaymentMode.Cash:
                        pvm.CashAmount = itemToEdit.Amount;
                        pvm.GrossAmount += itemToEdit.Amount;
                        break;
                    case PaymentMode.Cheque:
                        pvm.ChequeAmount = itemToEdit.Amount;
                        pvm.GrossAmount += itemToEdit.Amount;
                        break;
                    //should not edit MMoney payment mode
                    //should not edit Credit
                }
            }
            //added to keep track of payments if someone goes back to the payments screen
            //pvm.CashAmount = _vm.CashAmount;
            //pvm.ChequeAmount = _vm.ChequeAmount;
            //pvm.ChequeNumber = _vm.ChequeNo;
            //pvm.MMoneyAmount = _vm.MMoneyAmount;
            //pvm.PaymentRef = _vm.MMoneyRefNo;

            pvm.TheOrder = _vm.OrderDocument;
            pvm.OrderOutletId = _vm.SelectedOutlet.Id;
            pvm.OrderDocReference = _vm.OrderId;
            pvm.InvoiceDocReference = _vm.InvoiceDocument.DocumentReference;
            pvm.SetUpSubscriber();
            pvm.CalcAmountPaid();

            if (_vm.bankBranch != null)
            {
                pvm.LoadForEditing(_vm.bankBranch);
            }

            _paymentModeModal.ShowDialog();
        }
Exemplo n.º 2
0
        void SelectPaymentMode()
        {
            try
            {
                _livm.LoadGetInvoiceAmountsCommand.Execute(null);
                _paymentModeModal = new PaymentModeModal();
                _paymentModeModal.Closed += new EventHandler(paymentModeModal_Closed);
                var pvm = _paymentModeModal.DataContext as PaymentModeViewModel;
                pvm.ClearAndSetup.Execute(null);
                _posvm.PaymentInfoList.Clear();
                pvm.AmountPaid = _livm.TotalPaid;
                pvm.GrossAmount = _livm.GrossTotal;
                pvm.SetAmntPaid(_livm.TotalPaid);

                pvm.GetOrder(_livm.OrderId);
                pvm.OrderOutletId = pvm.TheOrder.IssuedOnBehalfOf.Id;
                pvm.GetOrderOutlet();
                pvm.SetUpSubscriber();
                //pvm.Setup();
                _paymentModeModal.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }