protected void Submitpayments(OutstandingPaymentItem orderSummary)
        {
            PaymentInfoList.Clear();
            try
            {
                using (var container = NestedContainer)
                {
                    var payInfo = Using<IPaymentPopup>(container).GetPayments(decimal.Parse(orderSummary.AmountDue), orderSummary.OrderId);
                    if (payInfo != null)
                    {
                        foreach (var paymentInfo in payInfo)
                        {
                            if (!PaymentInfoList.Contains(paymentInfo))
                                PaymentInfoList.Add(paymentInfo);
                        }
                    }
                    var order = Using<IMainOrderRepository>(container).GetById(orderSummary.OrderId);
                    var invoiceId = Using<IInvoiceRepository>(container).GetInvoiceByOrderId(order.Id).Id;
                    var orderWorkflow = Using<IOrderWorkflow>(container);
                    var posWorkflow = Using<IOrderPosWorkflow>(container);
                    Config config = Using<IConfigService>(container).Load();
                    if (order != null)
                    {
                        order.ChangeccId(GetConfigParams().CostCentreApplicationId);
                        foreach (var paymentInfo in PaymentInfoList.Where(p => p.PaymentModeUsed != PaymentMode.Credit))
                        {
                            paymentInfo.InvoiceId = invoiceId;
                            order.AddOrderPaymentInfoLineItem(paymentInfo);
                        }
                        if (order.DocumentReference.ToLower().StartsWith("sale"))
                             posWorkflow.Submit(order,config);
                            
                        else
                        {
                            orderWorkflow.Submit(order,config);
                        }
                        Load();
                    }

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void ReceivePayment(OutstandingPaymentItem summary)
        {
            if(summary.AmountDue.StartsWith("("))
            {
                MessageBox.Show("This item has been overpaid");
                return;
            }
            if (decimal.Parse(summary.AmountDue) <= 0)
            {
                MessageBox.Show( /*"Gross amount should be greater than zero"*/
                GetLocalText("sl.pos.receivepayments.messagebox.grossamountiszero")
               , "!" + GetLocalText("sl.payment.title") /*"Distributr: Payment Module"*/
               , MessageBoxButton.OK);
                return;
            }
            Submitpayments(summary);

        }