예제 #1
0
        public void Update(PosError pEvent)
        {
            if (prompt != null)
            {
                prompt.PromptText = pEvent.PromptText;
                prompt.EndInputAnimation();
                prompt.StartErrorAnimation();
            }

            if (PosHardware.Instance.LineDisplay != null)
            {
                PosHardware.Instance.LineDisplay.Clear();
            }
        }
예제 #2
0
        public void Apply()
        {
            if (PosContext.Instance.InputDouble() == 0)
            {
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.ClearPending();
                PosError error = new PosError(PosErrorCode.INVALID_INPUT);
                error.PromptText = PosContext.Instance.Parameters.getParam("InvalidInput");
                PosEventStack.Instance.PushEvent(error);
                PosContext.Instance.Operprompt.Update(error);
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.NextEvent();
                return;
            }

            this.applied = true;
            //Fixed value discount. For exampel .20 cts discount
            this.amount = PosContext.Instance.PosMath.Negate(PosContext.Instance.InputDouble());
            PosContext.Instance.ClearInput();
        }
예제 #3
0
        public override void Engage(int keyValue)
        {
            if (PosContext.Instance.Parameters.getParam("PromptForEmployee") == "FALSE")
            {
                this.States().Clear();
                PosEventStack.Instance.NextEvent();
                return;
            }

            switch (this.States().PeekState())
            {
            case ENTER_SALES_PERSON:

                // If previously entered salesman exists
                //  if (PosContext.Instance.CurrentEj.SalesPerson.Count > 0)
                //  {
                //      this.States().Clear();
                //      PosEventStack.Instance.NextEvent();
                //      return;
                //  }


                this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo");

                PosContext.Instance.Operprompt.Update(this);

                PosContext.Instance.ClearInput();
                this.States().PopState();

                this.States().PushState(GET_SALES_PERSON);


                //Try to load employee details
                try
                {
                    PosContext.Instance.CurrentPosDisplay.LoadEmployeeView();
                }
                catch
                {
                }

                break;



            case GET_SALES_PERSON:

                this.PopState();

                string salesPerson = PosContext.Instance.InputLine;

                if ((PosContext.Instance.CurrentEj.SalesPerson.Count > 0) &&
                    (string.IsNullOrEmpty(salesPerson.Trim())))
                {
                    this.States().Clear();
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.NextEvent();
                    return;
                }

                emp = new Employee();
                emp.Organization_no = PosSettings.Default.Organization;
                emp.Employee_no     = salesPerson;
                emp.LoadByEmployeeNo();

                if (string.IsNullOrEmpty(emp.FName))
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.INVALID_EMPLOYEE_NO);
                    this.PromptText = PosContext.Instance.Parameters.getParam("InvalidEmployeeNumber");
                    PosEventStack.Instance.PushEvent(error);
                    PosContext.Instance.Operprompt.Update(this);
                    PosContext.Instance.ClearInput();

                    this.States().PushState(GET_SALES_PERSON);
                    PosEventStack.Instance.NextEvent();
                    return;
                }

                PosContext.Instance.ClearInput();
                this.States().PopState();

                this.States().PushState(SET_SALES_PERSON_JOURNAL);
                PosEventStack.Instance.NextEvent();
                break;



            case SET_SALES_PERSON_JOURNAL:

                this.PopState();

                transSalesPerson                 = new TransSalesPerson();
                transSalesPerson.Trans_no        = PosContext.Instance.TrxNo;
                transSalesPerson.Organization_no = PosSettings.Default.Organization;
                transSalesPerson.Pos_no          = PosSettings.Default.Station;
                transSalesPerson.Store_no        = PosSettings.Default.Store;
                transSalesPerson.Employee_no     = emp.Employee_no;


                transSalesPerson.Add();

                PosContext.Instance.CurrentEj.EjAdd(this);


                this.States().Clear();
                this.promptText = "";
                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Receipt.Update(this);

                PosContext.Instance.ClearInput();
                // this.States().PushState(ENTER_SALES_PERSON);
                this.States().Clear();
                PosEventStack.Instance.NextEvent();

                break;

            default:
                break;
            }
        }
예제 #4
0
        public override void Engage(int keyValue)
        {
            switch (this.States().PeekState())
            {
            case PROMPT_AMOUNT:
                this.PopState();

                this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_AMOUNT);



                break;

            case PROMPT_CUSTOMER:
                this.PopState();

                this.PromptText = PosContext.Instance.Parameters.getParam("PromptCustomer");
                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_CUSTOMER);

                PosContext.Instance.CurrentPosDisplay.LoadCustomerSearch();

                break;

            case GET_AMOUNT:
                this.States().PopState();
                this.tenderAmount = PosContext.Instance.Input() / 100;
                PosContext.Instance.ClearInput();
                this.States().PushState(PROMPT_CUSTOMER);
                PosEventStack.Instance.NextEvent();
                break;

            case GET_CUSTOMER:


                // this.PopState();

                customer_tax_id = PosContext.Instance.InputLine;


                if (this.CustomerIsValid())
                {
                    this.PopState();
                }
                else
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.INVALID_CUSTOMER_NO);
                    this.PromptText = "";     //PosContext.Instance.Parameters.getParam("InvalidCustomer");
                    PosEventStack.Instance.PushEvent(error);
                    // PosContext.Instance.Operprompt.Update(this);
                    PosEventStack.Instance.NextEvent();
                    return;
                }

                EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer();
                cus.Organization_no = PosSettings.Default.Organization;
                cus.Tax_id          = this.customer_tax_id;
                cus.LoadByTaxID();



                Transaction trans = new Transaction(PosContext.Instance.TrxNo);
                trans.Organization_no = PosSettings.Default.Organization;
                trans.Store_no        = PosSettings.Default.Store;
                trans.Pos_no          = PosSettings.Default.Station;
                trans.Trans_no        = PosContext.Instance.TrxNo;
                trans.Load();
                trans.Customer_tax_id = cus.Tax_id;
                trans.UpdateCustomer();

                PosContext.Instance.EjCustomer = new EjCustomer(cus);
                PosContext.Instance.CurrentEj.EjAdd(this);

                PosContext.Instance.Receipt.Update(this);
                PosContext.Instance.Operprompt.Update(this);

                PosEventStack.Instance.NextEvent();

                break;


            default:
                break;
            }
        }
예제 #5
0
        public override void Engage(int keyValue)
        {
            switch (this.PeekState())
            {
            case ENTER_CASH_BACK_AMOUNT:                     // prompts for cash back

                if (PosContext.Instance.InputLine.Length > 0)
                {
                    splitAmount = Math.Round(double.Parse(PosContext.Instance.InputLine) / 100.00, 2);
                }
                else
                {
                    splitAmount = 0;
                    // tenderAmount = PosContext.Instance.CurrentEj.EjBalance();
                }

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptCashBack");
                //numbertype = EjLine.AMOUNT;
                //setType (PosNumberDialog.CURRENCY);
                //	PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Operprompt.Update(this);
                this.PushState(GET_CASH_BACK_AMOUNT);

                break;

            case ENTER_CHECK_NO:                              // prompts for check number

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptCheckNo");
                //	numbertype = EjLine.NUMBER;
                //	setType = PosNumberDialog.PosEventType.cl.CLEAR);
                PosContext.Instance.Operprompt.Update(this);
                this.PushState(GET_CHECK_NO);

                break;

            case GET_CASH_BACK_AMOUNT:                      // get the amount and save it

                this.PopState();
                cashBack = PosContext.Instance.PosMath.GetAmount(PosContext.Instance.InputDouble());
                if (this.AmountIsValid())                           //cashBackIsValid ())
                {
                    this.PopState();
                }
                else
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.CASH_EXCEEDED);
                    this.PromptText = PosContext.Instance.Parameters.getParam("CashLimitExceeded");
                    PosEventStack.Instance.PushEvent(error);
                    PosContext.Instance.Operprompt.Update(this);
                    PosEventStack.Instance.NextEvent();
                    return;
                }
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.NextEvent();

                break;

            case GET_CHECK_NO:

                this.PopState();
                checkNumber = PosContext.Instance.InputLine;
                if (CheckNumberIsValid())
                {
                    this.PopState();
                    this.PushState(TENDER_FINAL);
                }
                else
                {
                }
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.NextEvent();

                break;

            case TENDER_FINAL:                      // this completes the transaction


                this.transTender = new TransTender();

                // logic for cash back, assume amount () is either 0 or the amount, add it regardless

                if (splitAmount > 0.0)
                {
                    transTender.Amount = splitAmount + cashBack;
                }
                else
                {
                    transTender.Amount = PosContext.Instance.PosMath.Add(cashBack, PosContext.Instance.CurrentEj.EjBalance());                              // amount was requested cash back
                }


                transTender.Trans_no        = PosContext.Instance.TrxNo;
                transTender.Organization_no = PosSettings.Default.Organization;
                transTender.Store_no        = PosSettings.Default.Store;
                transTender.Pos_no          = PosSettings.Default.Station;
                transTender.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;
                transTender.Tender_desc     = PosContext.Instance.Parameters.getParam("CheckTender");
                transTender.Change_amount   = cashBack;
                transTender.Change_desc     = PosContext.Instance.Parameters.getParam("CashBack");
                transTender.Tendertype      = (int)TransTender.TenderTypes.CHECK;
                transTender.Data_capture    = checkNumber;
                transTender.Locale_language = "";
                transTender.Locale_country  = "";
                transTender.State           = (int)EjLineStates.IN_PROGRESS;


                if (PosContext.Instance.CurrentEj.EjBalance() <= transTender.Amount)
                {
                    this.tenderComplete = true;
                }
                else
                {
                    this.tenderComplete = false;
                }

                PosContext.Instance.CurrentEj.EjAdd(this);
                transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo;

                // if not training mode
                if (!PosContext.Instance.Training)
                {
                    transTender.Add();
                }

                PosContext.Instance.Receipt.Update(this);
                PosContext.Instance.Operprompt.Update(this);

                // finish up and resume the dialog

                this.States().Clear();
                PosContext.Instance.ClearInput();
                PosContext.Instance.InputLine = "";
                PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();

                break;

            default:
                break;
            }
        }
예제 #6
0
        public override void Engage(int keyValue)
        {
            if (PosContext.Instance.EjCustomer == null)
            {
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.ClearPending();
                PosError error = new PosError(PosErrorCode.SELECT_CUSTOMER);
                this.PromptText = PosContext.Instance.Parameters.getParam("SELECT_CUSTOMER");
                PosEventStack.Instance.PushEvent(error);
                PosEventStack.Instance.NextEvent();
                return;
            }


            if (PosContext.Instance.InputLine.Length > 0)
            {
                debtAmount = Math.Round(double.Parse(PosContext.Instance.InputLine) / 100.00, 2);
            }
            else
            {
                debtAmount = PosContext.Instance.CurrentEj.EjBalance();
            }

            PosContext.Instance.ClearInput();

            EclipsePos.Data.Customer cus = PosContext.Instance.EjCustomer.DataRecord() as EclipsePos.Data.Customer;


            // Check max debt limit
            if (cus.Current_debt + debtAmount > cus.Max_debt)
            {
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.ClearPending();
                PosError error = new PosError(PosErrorCode.INSUFFICIENT_CREDIT_LIMIT);
                this.PromptText = PosContext.Instance.Parameters.getParam("Insufficient_credit_limit");
                PosEventStack.Instance.PushEvent(error);
                PosEventStack.Instance.NextEvent();
                return;
            }

            // this completes the transaction


            this.transTender = new TransTender();


            transTender.Amount = debtAmount;

            transTender.Trans_no        = PosContext.Instance.TrxNo;
            transTender.Organization_no = PosSettings.Default.Organization;
            transTender.Store_no        = PosSettings.Default.Store;
            transTender.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;
            transTender.Tender_desc     = PosContext.Instance.Parameters.getParam("DebtTender");
            transTender.Change_amount   = 0;
            transTender.Change_desc     = "";
            transTender.Tendertype      = (int)TransTender.TenderTypes.CREDIT_ON_ACC;
            transTender.Data_capture    = "";
            transTender.Locale_language = "";
            transTender.Locale_country  = "";

            transTender.State = (int)EjLineStates.IN_PROGRESS;

            PosContext.Instance.CurrentEj.EjAdd(this);
            transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo;

            // if not training mode
            if (!PosContext.Instance.Training)
            {
                transTender.Add();
                this.priviousDebt = cus.Current_debt;

                cus.Current_debt += debtAmount;
                this.currentDebt  = cus.Current_debt;
                this.maxDebt      = cus.Max_debt;

                cus.UpdateCurrentDebt();
            }

            if (PosContext.Instance.CurrentEj.EjBalance() <= transTender.Amount)
            {
                this.tenderComplete = true;
            }
            else
            {
                this.tenderComplete = false;
            }



            PosContext.Instance.Receipt.Update(this);
            PosContext.Instance.Operprompt.Update(this);

            // finish up and resume the dialog

            this.States().Clear();
            PosContext.Instance.HomeGUI();
            PosEventStack.Instance.NextEvent();
        }
예제 #7
0
        //
        //	  Gather input and create Credit Card tender record, TransTender.
        //	  MSR filters are applied along with check digit.
        //
        public override void Engage(int keyValue)
        {
            //MessageBox.Show("OK");
            //object obj2 = PosEventStack.Instance.Peek() as Object;
            //MessageBox.Show(obj2.ToString());

            keyValue = (int)PosContext.Instance.PosKeyValue;
            switch (this.States().PeekState())
            {
            case CHECK_CARD_NAME:

                if (!this.ValidCardType(keyValue))
                {
                    PosError error = new PosError(PosErrorCode.INVALID_CC);
                    PosEventStack.Instance.PushEvent(error);
                    PosEventStack.Instance.NextEvent();
                    return;
                }
                this.desc = this.cardMedia.Media_name;
                this.States().PopState();
                PosContext.Instance.ClearInput();
                this.PushState(TENDER_FINAL);
                PosEventStack.Instance.NextEvent();
                break;



                break;


            case TENDER_FINAL:        // this completes the transaction

                this.States().PopState();
                this.transTender = new TransTender();

                transTender.Trans_no        = PosContext.Instance.TrxNo;
                transTender.Organization_no = PosSettings.Default.Organization;
                transTender.Store_no        = PosSettings.Default.Store;
                transTender.Pos_no          = PosSettings.Default.Station;
                transTender.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;



                if (this.Results[Filter.DISPLAY_NAME] != null)
                {
                    transTender.Tender_desc = (string)this.Results[Filter.DISPLAY_NAME];
                }
                else
                {
                    transTender.Tender_desc = PosContext.Instance.Parameters.getParam("CreditTender") + " " + this.Desc; // "Not Known";
                }

                transTender.Data_capture = this.CCNumber + "," + this.ExprDate;

                // logic for cash back, assume amount () is either 0 or the amount, add it regardless
                // if it's 0 charge the full amount

                if (this.SplitAmount > 0.0)
                {
                    transTender.Amount = this.SplitAmount + this.CashBack;
                }
                else
                {
                    // add cash back into amount
                    transTender.Amount = PosContext.Instance.PosMath.Add(this.CashBack, PosContext.Instance.CurrentEj.EjBalance());
                }

                transTender.Change_amount   = this.CashBack;
                transTender.Change_desc     = PosContext.Instance.Parameters.getParam("CashBack");
                transTender.Locale_language = "";                // Application.l.localeLanguage ());
                transTender.Locale_country  = "";                // ().setLocaleCountry (Application.localeCountry ());
                this.PromptText             = transTender.Change_desc;

                transTender.State = (int)EjLineStates.IN_PROGRESS;

                //PosContext.Instance.CurrentEj.EjAdd(this);

                //	if (PosContext.Instance.CurrentEj.EjBalance() > 0.0)
                //	{
                //
                //	  this.PromptText = transTender.Change_desc;
                //	}
                //	else
                //	{
                //	  this.tenderComplete = true;
                //	}

                if (PosContext.Instance.CurrentEj.EjBalance() <= transTender.Amount)
                {
                    this.tenderComplete = true;
                }
                else
                {
                    this.tenderComplete = false;
                }

                PosContext.Instance.CurrentEj.EjAdd(this);
                transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo;


                // if not training mode
                if (!PosContext.Instance.Training)
                {
                    transTender.Add();
                }


                this.States().Clear();
                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Receipt.Update(this);

                PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();
                break;

            default:
                break;
            }

            return;
        }
예제 #8
0
        public override void Engage(int keyValue)
        {
            switch (this.States().PeekState())
            {
            case PAID_IN:

                this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                desc            = PosContext.Instance.Parameters.getParam("PaidInAmount");
                sign            = 1.0;
                // PosContext.Instance.TransactionType = (int)Transaction.Types.PAID_IN;
                PosContext.Instance.Operprompt.Update(this);
                this.transType = (int)TotalType.PAID_IN;
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_AMOUNT);
                break;

            case PAID_OUT:

                this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                desc            = PosContext.Instance.Parameters.getParam("PaidOutAmount");
                sign            = -1.0;
                // PosContext.Instance.TransactionType = (int)Transaction.Types.PAID_OUT;
                PosContext.Instance.Operprompt.Update(this);
                this.transType = (int)TotalType.PAID_OUT;
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_AMOUNT);
                break;

            case LOAN:
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                desc            = PosContext.Instance.Parameters.getParam("LoanAmount");
                sign            = -1.0;
                //   PosContext.Instance.TransactionType = (int)Transaction.Types.LOAN;
                PosContext.Instance.Operprompt.Update(this);
                this.transType = (int)TotalType.LOAN;
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_AMOUNT);
                break;

            case PICKUP:
                this.promptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                desc            = PosContext.Instance.Parameters.getParam("Pickup");
                sign            = -1.0;
                // PosContext.Instance.TransactionType = (int)Transaction.Types.PICKUP;
                PosContext.Instance.Operprompt.Update(this);
                this.transType = (int)TotalType.PICK_UP;
                PosContext.Instance.ClearInput();
                this.States().PushState(GET_AMOUNT);
                break;


            case GET_AMOUNT:                     // prompts for amout tendered

                this.PopState();

                double inputAmt = PosContext.Instance.PosMath.GetAmount(PosContext.Instance.InputDouble());

                this.transAmount = PosContext.Instance.PosMath.Mult(inputAmt, sign);

                if (this.AmountIsValid())
                {
                    this.PopState();
                }
                else
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.CASH_EXCEEDED);
                    this.PromptText = PosContext.Instance.Parameters.getParam("CashLimitExceeded");
                    PosEventStack.Instance.PushEvent(error);
                    PosContext.Instance.Operprompt.Update(this);
                    PosEventStack.Instance.NextEvent();
                    return;
                }

                transBank = new TransBank();                           // create a bank record

                transBank.Bank_desc       = desc;
                transBank.Trans_no        = PosContext.Instance.TrxNo;
                transBank.Organization_no = PosSettings.Default.Organization;
                transBank.Store_no        = PosSettings.Default.Store;
                transBank.Pos_no          = PosSettings.Default.Station;
                transBank.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;
                transBank.Pay_type        = this.transType;
                transBank.Deposit_no      = 0;
                transBank.State           = 0;
                transBank.Drawer_no       = 0;                  // ().setDrawerNo (context ().drawerNo ());
                transBank.Locale_language = "";                 // ().setLocaleLanguage (Application.localeLanguage ());
                transBank.Locale_country  = "";                 //   ().setLocaleCountry (Application.localeCountry ());
                transBank.Amount          = this.transAmount;

                transBank.State = (int)EjLineStates.IN_PROGRESS;



                PosContext.Instance.CurrentEj.EjAdd(this);

                transBank.Seq_no = PosContext.Instance.CurrentEj.SeqNo;
                transBank.Add();

                PosContext.Instance.Receipt.Update(this);
                PosContext.Instance.Operprompt.Update(this);

                // PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();

                break;

            default:
                break;
            }
        }
예제 #9
0
        //
        //	  Gather input and create Credit Card tender record, TransTender.
        //	  MSR filters are applied along with check digit.
        //
        public override void Engage(int keyValue)
        {
            switch (this.PeekState())
            {
            case ENTER_CASH_BACK_AMOUNT:              // prompts for cash back amount

                if (PosContext.Instance.InputLine.Length > 0)
                {
                    this.SplitAmount = Math.Round(double.Parse(PosContext.Instance.InputLine), 2);
                }
                else
                {
                    this.SplitAmount = 0;
                }

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptCashBack");
                //this.setType (PosNumberDialog.CURRENCY);
                PosContext.Instance.Operprompt.Update(this);
                this.States().PushState(GET_CASH_BACK_AMOUNT);
                break;

            case ENTER_CARD_NAME:  // prompts for cash back amount
                //Try to load media prompt
                try
                {
                    int menuNo = int.Parse(PosContext.Instance.Parameters.getParam("CreditMediaMenuNo"));
                    PosContext.Instance.CurrentPosDisplay.LoadMenu(menuNo);
                }
                catch
                {
                }
                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptCardName");
                //this.setType (PosNumberDialog.CURRENCY);
                PosContext.Instance.Operprompt.Update(this);
                this.PopState();
                this.States().PushState(GET_CARD_NAME);
                break;

            /*	case ENTER_CC_NO:          // prompts for cc number
             *
             *              //results = new Hashtable ();
             *              PosContext.Instance.ClearInput();
             *              this.PromptText = PosContext.Instance.Parameters.getParam("PromptCCNo");
             *              //setType (PosNumberDialog.CLEAR);
             *              PosContext.Instance.Operprompt.Update(this);
             *              this.States().PushState(GET_CC_NO);
             *              break;
             *
             *      case ENTER_CC_EXPR:        // prompt for cc expiration date
             *
             *              PosContext.Instance.ClearInput();
             *              this.PromptText = PosContext.Instance.Parameters.getParam("PromptCCExpr");
             *              PosContext.Instance.Operprompt.Update(this);
             *              //setType (PosNumberDialog.CLEAR);
             *              this.States().PushState(GET_CC_EXPR);
             *              break;
             */
            case GET_CASH_BACK_AMOUNT:              // get the amount and save it

                this.PopState();
                this.CashBack = PosContext.Instance.PosMath.GetAmount(PosContext.Instance.InputDouble());
                if (this.AmountIsValid())
                {
                    this.PopState();
                }
                else
                {
                    // get out of this transaction and prompt error.
                    PosContext.Instance.ClearInput();
                    PosEventStack.Instance.ClearPending();
                    PosError error = new PosError(PosErrorCode.CASH_EXCEEDED);
                    this.PromptText = PosContext.Instance.Parameters.getParam("CashLimitExceeded");
                    PosEventStack.Instance.PushEvent(error);
                    PosContext.Instance.Operprompt.Update(this);
                    PosEventStack.Instance.NextEvent();
                    return;
                }
                PosContext.Instance.ClearInput();
                PosEventStack.Instance.NextEvent();
                break;

            case GET_CARD_NAME:  // get card name

                this.PopState();
                this.Desc = PosContext.Instance.InputLine.Trim();
                if (string.IsNullOrEmpty(this.Desc))
                {
                    return;
                }

                PosContext.Instance.ClearInput();
                this.States().PushState(TENDER_FINAL);
                PosEventStack.Instance.NextEvent();
                break;

            /*	case GET_CC_NO:  // get the CC number and save it
             *
             *              this.PopState();
             *              this.CCNumber = PosContext.Instance.InputLine;
             */
            //	for (int i=0;i<context ().msrFilters ().size (); i++)
            //	{


            //		Filter f = context ().msrFilters ().getFilter (i);

            // If a filter matched deterimine what it is and
            // extract the data

            //		if (f.apply (ccNumber (), results) == Filter.CHECKDIGIT_FAILED)
            //		{
            //			Log.warning ("CC check digit failed " + ccNumber ());

            // if the card is invalid, get all the way out of credit card and post
            // an invalid credit card message, they'll have to pay some other way.

            //			context ().clearInput ();
            //			context ().eventStack ().clearPending ();
            //			context ().eventStack ().pushEvent (new PosError (context (),  PosError.INVALID_CC));
            //			context ().operPrompt ().update ((PosError) context ().eventStack ().event ());
            //			return;
            //		}

            //	}

            // see if anything matched

            //  if (results.get (Filter.ACCT_NO) == null)
            //	{

            //		Log.warning ("Invalid CC number acct_no == null" + ccNumber ());

            // same as above, except no fields were picked up.

            //		context ().clearInput ();
            //		context ().eventStack ().clearPending ();
            //		context ().eventStack ().pushEvent (new PosError (context (),  PosError.INVALID_CC));
            //		context ().operPrompt ().update ((PosError) context ().eventStack ().event ());
            //		return;
            //	}
            //	else
            //	{
            //			this.PopState();
            //	}

            //		PosContext.Instance.ClearInput();
            //		PosEventStack.Instance.NextEvent();
            //		break;

            /*	case GET_CC_EXPR:  // this completes the transaction
             *
             *              this.PopState();
             *              this.ExprDate = PosContext.Instance.InputLine;
             *              PosContext.Instance.ClearInput();
             *              if (this.CCExprIsValid)
             *              {
             *                      this.PopState();
             *              }
             *              else
             *              {
             *              }
             *              PosEventStack.Instance.NextEvent();
             *              break;
             */
            case AUTHORIZE:

                this.PopState();
                //Random rand = new Random ();
                //int r = rand.nextInt () % 99999;
                //r *= (r < 0 ? -1 : 1);
                //authCode = Integer.toString (r);
                PosEventStack.Instance.NextEvent();
                break;

            case READ_ERROR:

                //Application.cancelTimers ();
                //context ().eventStack ().event ().setBlocked (false);
                PosContext.Instance.Operprompt.Update(this);
                this.CCNumber = "";
                this.PopState();
                break;

            case AUTHORIZATION_DECLINED:
                break;

            case TENDER_FINAL:        // this completes the transaction

                this.PopState();
                this.transTender = new TransTender();

                transTender.Trans_no        = PosContext.Instance.TrxNo;
                transTender.Organization_no = PosSettings.Default.Organization;
                transTender.Store_no        = PosSettings.Default.Store;
                transTender.Pos_no          = PosSettings.Default.Station;
                transTender.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;



                if (this.Results[Filter.DISPLAY_NAME] != null)
                {
                    transTender.Tender_desc = (string)this.Results[Filter.DISPLAY_NAME];
                }
                else
                {
                    transTender.Tender_desc = PosContext.Instance.Parameters.getParam("CreditTender") + " " + this.Desc; // "Not Known";
                }

                transTender.Data_capture = this.CCNumber + "," + this.ExprDate;

                // logic for cash back, assume amount () is either 0 or the amount, add it regardless
                // if it's 0 charge the full amount

                if (this.SplitAmount > 0.0)
                {
                    transTender.Amount = this.SplitAmount + this.CashBack;
                }
                else
                {
                    // add cash back into amount
                    transTender.Amount = PosContext.Instance.PosMath.Add(this.CashBack, PosContext.Instance.CurrentEj.EjBalance());
                }

                transTender.Change_amount   = this.CashBack;
                transTender.Change_desc     = PosContext.Instance.Parameters.getParam("CashBack");
                transTender.Locale_language = "";                // Application.l.localeLanguage ());
                transTender.Locale_country  = "";                // ().setLocaleCountry (Application.localeCountry ());
                this.PromptText             = transTender.Change_desc;

                transTender.State = (int)EjLineStates.IN_PROGRESS;

                //PosContext.Instance.CurrentEj.EjAdd(this);

                //	if (PosContext.Instance.CurrentEj.EjBalance() > 0.0)
                //	{
                //
                //	  this.PromptText = transTender.Change_desc;
                //	}
                //	else
                //	{
                //	  this.tenderComplete = true;
                //	}

                if (PosContext.Instance.CurrentEj.EjBalance() <= transTender.Amount)
                {
                    this.tenderComplete = true;
                }
                else
                {
                    this.tenderComplete = false;
                }

                PosContext.Instance.CurrentEj.EjAdd(this);
                transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo;


                // if not training mode
                if (!PosContext.Instance.Training)
                {
                    transTender.Add();
                }



                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Receipt.Update(this);

                PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();
                break;

            default:
                break;
            }

            return;
        }