public static frmPayment CreateInstance()
        {
            frmPayment theInstance = new frmPayment();

            theInstance.Form_Load();
            return(theInstance);
        }
Ejemplo n.º 2
0
        private void cbPayment_Click(Object eventSender, EventArgs eventArgs)
        {
            OrderedDictionary payments = null;
            frmPayment        pay      = frmPayment.CreateInstance();

            pay.TransactionAmount = m_total;
            pay.UpdateTotals();
            // We need a ticket number
            // Because it will be needed when sending it to
            // credit card processor
            if (MainModule.CurrentTicketID == 0)
            {
                MainModule.CurrentTicketID = MainModule.CreateTicket(m_CurrentCustomer, MainModule.CurrentPOS.POSID, MainModule.CurrentShift.UserID);
            }
            OrderedDictionary items = GetItems();

            if (items.Count > 0)
            {
                pay.ShowDialog();
                if (pay.PaymentDone)
                {
                    payments = pay.GetPayments();
                    if (MainModule.SaveSale(m_SubTotal, m_Taxes, m_total, payments, items, m_CurrentCustomer, MainModule.CurrentPOS.POSID, MainModule.CurrentShift.UserID))
                    {
                        Reset();
                        UpdateTotals();
                    }
                    else
                    {
                        MessageBox.Show("Error saving sale", Application.ProductName);
                    }
                }
            }
            else
            {
                MessageBox.Show("Error no items registered", Application.ProductName);
            }
        }