Exemplo n.º 1
0
 /** Save the transaction record */
 public override bool Save()
 {
     if (!PosContext.Instance.Training)
     {
         transTender.Add();
     }
     return(true);
 }
Exemplo n.º 2
0
 public override bool Save()
 {
     if (!PosContext.Instance.Training)
     {
         try
         {
             transTender.Add();
         }
         catch (Exception e)
         {
             MessageBox.Show(e.ToString());
         }
     }
     return(true);
 }
Exemplo n.º 3
0
        //
        // Get the currency record from the database from value (value is
        // configured in the key database). If the currency is found
        // start the alt currency dialog, which prompts for the amount
        // tenderd, and completes the transaction if the tendered amount
        // covers the sale, else split tender.

        public override void Engage(int keyValue)
        {
            switch (this.States().PeekState())
            {
            case ENTER_ALT_CURR_AMOUNT:                     // prompts for amount tendered
                /*	this.transTender = new TransTender ();  // create a tender record
                 *
                 *      transTender.Locale_language = "sg";
                 *      transTender.Locale_country = "sg";
                 *      transTender.Trans_id = PosContext.Instance.TrxNo;
                 *      transTender.Seq_no = PosContext.Instance.CurrentEj.Seq_no;
                 *      transTender.Tendertype = (int) TransTender.TenderTypes.ALT_CURRENCY;
                 *      transTender.Tender_desc = PosContext.Instance.Parameters.getParam("AltCurrencyDescription");
                 *      transTender.Data_capture = "XX"; //context ().altCurrency ().locale () + "," + context ().altCurrency ().conversionRate ());
                 *      ConvertedAmount = PosContext.Instance.PosMath.Mult(PosContext.Instance.CurrentEj.EjSubTotal(), PosContext.Instance.AltCurrency.Conversion_rate);
                 *      transTender.Amount = PosContext.Instance.PosMath.Mult( PosContext.Instance.CurrentEj.EjTotal(), PosContext.Instance.AltCurrency.Conversion_rate);
                 */
                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("AltCurrTenderPrompt");
                ConvertText     = PosContext.Instance.Parameters.getParam("ConvertedAltCurrency");
                PosContext.Instance.Operprompt.Update(this);
                //	PosContext.Instance.Receipt.Update(this);
                //	this.States().Clear();
                this.States().PushState(GET_ALT_CURR_AMOUNT);

                break;

            case GET_ALT_CURR_AMOUNT:                      // Pick up the amount from the input

                this.PopState();
                SplitAmount = Math.Round(PosContext.Instance.PosMath.Div(PosContext.Instance.InputDouble(), 100), 2);

                if (this.AmountIsValid())
                {
                    this.PopState();
                }
                else
                {
                    return;
                }

                PosContext.Instance.ClearInput();
                double amount      = this.SplitAmount;
                double localAmount = Math.Round(PosContext.Instance.PosMath.Mult(amount, PosContext.Instance.AltCurrency.Conversion_rate), 2);


                this.transTender = new TransTender();                           // create a tender record

                transTender.Organization_no = PosSettings.Default.Organization;
                transTender.Store_no        = PosSettings.Default.Store;
                transTender.Pos_no          = PosSettings.Default.Station;

                transTender.Locale_language = "";     // CultureInfo.CurrentCulture.Name;
                transTender.Locale_country  = "";
                transTender.Trans_no        = PosContext.Instance.TrxNo;
                transTender.Seq_no          = PosContext.Instance.CurrentEj.SeqNo;
                transTender.Tendertype      = (int)TransTender.TenderTypes.ALT_CURRENCY;
                transTender.Tender_desc     = PosContext.Instance.Parameters.getParam("AltCurrencyDescription");
                transTender.Data_capture    = PosContext.Instance.AltCurrencyCode.Currency_name + "," + PosContext.Instance.AltCurrency.Conversion_rate.ToString(); //context ().altCurrency ().locale () + "," + context ().altCurrency ().conversionRate ());
                this.convertedAmount        = localAmount;                                                                                                          //PosContext.Instance.PosMath.Mult(PosContext.Instance.CurrentEj.EjTotal(), PosContext.Instance.AltCurrency.Conversion_rate);

                transTender.Amount        = localAmount;
                transTender.Change_amount = PosContext.Instance.PosMath.Sub(localAmount, PosContext.Instance.CurrentEj.EjTotal());
                transTender.Change_desc   = PosContext.Instance.Parameters.getParam("Change");
                transTender.State         = (int)EjLineStates.IN_PROGRESS;

                // save the transaction

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


                PosContext.Instance.CurrentEj.EjAdd(this);
                PosContext.Instance.Receipt.Update(this);
                this.States().Clear();
                PosEventStack.Instance.NextEvent();
                break;
            }
        }
Exemplo n.º 4
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;
            }
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
        public override void Engage(int keyValue)
        {
            switch (this.PeekState())
            {
            case ENTER_AMOUNT:
                //Try to load media prompt
                try
                {
                    int menuNo = int.Parse(PosContext.Instance.Parameters.getParam("CashMediaMenuNo"));
                    PosContext.Instance.CurrentPosDisplay.LoadMenu(menuNo);
                }
                catch
                {
                }


                if (PosContext.Instance.CurrentEj.EjBalance() > 0)
                {
                    PosContext.Instance.ClearInput();
                    this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount");
                    PosContext.Instance.Operprompt.Update(this);

                    //Wait for the Enter key after after input amount
                    this.PopState();
                    this.PushState(GET_AMOUNT);
                    return;
                }
                else
                {
                    this.PopState();
                    this.tenderAmount = PosContext.Instance.CurrentEj.EjBalance();
                    PosContext.Instance.ClearInput();
                    this.PushState(TENDER_FINAL);
                    PosEventStack.Instance.NextEvent();
                }



                break;

            case GET_AMOUNT:

                this.PopState();

                if (PosContext.Instance.InputLine.Length > 0)
                {
                    this.tenderAmount = PosContext.Instance.PosMath.GetAmount(PosContext.Instance.InputDouble());
                }
                else
                {
                    this.tenderAmount = PosContext.Instance.CurrentEj.EjBalance();
                }

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

            case TENDER_FINAL:



                //double tenderTotal = 0;
                //double tenderAmount = 0;
                double change = 0;

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


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



                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.Locale_country  = RegionInfo.CurrentRegion.TwoLetterISORegionName;
                transTender.Locale_language = PosContext.Instance.Organization.Home_currency;
                transTender.Tendertype      = (int)TransTender.TenderTypes.CASH;
                transTender.Data_capture    = "";
                transTender.Amount          = tenderAmount;
                transTender.Tender_desc     = PosContext.Instance.Parameters.getParam("CashTender");
                transTender.Change_desc     = "";
                transTender.Change_amount   = 0;
                transTender.State           = (int)EjLineStates.IN_PROGRESS;
                //Check for balance due

                if (PosContext.Instance.CurrentEj.EjBalance() > tenderAmount)
                {
                    change = 0;
                    transTender.Change_amount = 0;     //(PosContext.Instance.CurrentEj.EjBalance() - tenderAmount);
                    transTender.Change_desc   = PosContext.Instance.Parameters.getParam("Balance");
                    this.PromptText           = PosContext.Instance.Parameters.getParam("BalanceDue");

                    // Show balance due on prompt

                    tenderComplete = false;
                    PosContext.Instance.Operprompt.Update(this);
                }
                else
                {
                    tenderComplete            = true;
                    change                    = tenderAmount - PosContext.Instance.CurrentEj.EjBalance();
                    transTender.Change_amount = change;
                    transTender.Change_desc   = PosContext.Instance.Parameters.getParam("Change");
                }

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

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



                //	MessageBox.Show(this.PromptText+ string.Format("{0:##########.00}", change));//  = "Balance due";

                // PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Receipt.Update(this);
                PosContext.Instance.ClearInput();
                PosContext.Instance.InputLine = "";
                PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();

                break;
            }
        }
Exemplo n.º 8
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;
        }