Exemple #1
0
        private void CashPayment(string amount)
        {
            try
            {
                var cashPayment = new SalePayment()
                {
                    PaymentAmount = Convert.ToDecimal(amount)
                };
                cashPayment.Payment = new Payment()
                {
                    PaidAmount  = Convert.ToDecimal(amount),
                    PaymentDate = DateTime.Today,
                    PaymentType = 1
                };
                var outstandingAmount = _saleTransaction.AddPayment(cashPayment);

                if (outstandingAmount < 0)
                {
                    RaiseNotification("Info",
                                      string.Format("Balance amount is {0}", (-1.0m * outstandingAmount)));
                }

                if (outstandingAmount <= 0)
                {
                    CompleteTransaction(outstandingAmount * -1.0m);
                }


                PaymentAmount = outstandingAmount;

                log.Info(String.Format("Cash payment of {0} successfull", amount));
            }
            catch (Exception ex)
            {
                log.Error("Cash payment failed", ex);
            }
            finally
            {
            }
        }