// // 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; } }
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(); }
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; } }
public static Ej GetSuspendedEj(Transaction trans) { Ej transRecords = new Ej(); transRecords.LineNo = 0; transRecords.SeqNo = 0; //Do not load if not suspended if (trans.State == (int)Transaction.Status.SUSPEND) { trans.State = (int)(Transaction.Status.IN_PROGRESS); trans.UpdateState(); } //Create a header EjHeader ejHeader = new EjHeader(trans); transRecords.EjAddReload(ejHeader); //Get items TransItem item = new TransItem(); item.Trans_no = trans.Trans_no; item.Organization_no = trans.Organization_no; item.Store_no = trans.Store_no; item.Pos_no = trans.Pos_no; DataSet data = item.LoadByTransno(); DataTable dt = data.Tables[0]; foreach (DataRow dr in dt.Rows) { TransItem transItem = new TransItem(dr); if (transItem.State == (int)EjLineStates.PRICE_OVERRIDE) { continue; } if (transItem.State == (int)EjLineStates.VOID_ITEM) { continue; } if (transItem.State == (int)EjLineStates.VOID_SALE) { continue; } if (transItem.Line_no > transRecords.LineNo) { transRecords.LineNo = transItem.Line_no; } if (transItem.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = transItem.Seq_no; } if (transItem.State == (int)EjLineStates.SUSPEND) { transItem.State = (int)EjLineStates.IN_PROGRESS; transItem.UpdateState(); } if (transItem.Reason_code == (int)EjItemReasonCodes.NORMAL_ITEM) { EjItem ejItem = new EjItem(transItem); transRecords.EjAddReload(ejItem); } if (transItem.Reason_code == (int)EjItemReasonCodes.SURCHARGE) { EjSurcharge ejSurcharge = new EjSurcharge(transItem); transRecords.EjAddReload(ejSurcharge); } } //Get promotions try { TransPromotion promo = new TransPromotion(); promo.Trans_no = trans.Trans_no; promo.Organization_no = trans.Organization_no; promo.Store_no = trans.Store_no; promo.Pos_no = trans.Pos_no; DataSet data1 = promo.LoadAllByTransId(); DataTable dt1 = data1.Tables[0]; foreach (DataRow dr1 in dt1.Rows) { TransPromotion transPromotion = new TransPromotion(dr1); if (transPromotion.Line_no > transRecords.LineNo) { transRecords.LineNo = transPromotion.Line_no; } if (transPromotion.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = transPromotion.Seq_no; } if (transPromotion.State != (int)EjLineStates.VOID_ITEM) { transPromotion.State = (int)EjLineStates.IN_PROGRESS; transPromotion.UpdateState(); } EjPromotion ejPromotion = new EjPromotion(transPromotion); transRecords.EjAddReload(ejPromotion); } } catch { } //Get Tax try { TransTax ttax = new TransTax(); ttax.Trans_no = trans.Trans_no; ttax.Organization_no = trans.Organization_no; ttax.Store_no = trans.Store_no; ttax.Pos_no = trans.Pos_no; DataSet data2 = ttax.LoadByTransid(); DataTable dt2 = data2.Tables[0]; foreach (DataRow dr2 in dt2.Rows) { TransTax transTax = new TransTax(dr2); EjTax ejTax = new EjTax(transTax); transRecords.EjAddReload(ejTax); if (transTax.Line_no > transRecords.LineNo) { transRecords.LineNo = transTax.Line_no; } } } catch { } //Get Free Text try { TransText ttext = new TransText(); ttext.Trans_no = trans.Trans_no; ttext.Organization_no = trans.Organization_no; ttext.Store_no = trans.Store_no; ttext.Pos_no = trans.Pos_no; DataSet data3 = ttext.LoadByTransNo(); DataTable dt3 = data3.Tables[0]; foreach (DataRow dr3 in dt3.Rows) { if (ttext.Line_no > transRecords.LineNo) { transRecords.LineNo = ttext.Line_no; } if (ttext.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = ttext.Seq_no; } TransText transText = new TransText(dr3); EjFreeText ejText = new EjFreeText(transText); transRecords.EjAddReload(ejText); } } catch { } try { //Get Sales person TransSalesPerson salesPerson = new TransSalesPerson(); salesPerson.Organization_no = trans.Organization_no; salesPerson.Trans_no = trans.Trans_no; salesPerson.Store_no = trans.Store_no; salesPerson.Pos_no = trans.Pos_no; DataSet dataSalP = salesPerson.LoadByTransNo(); DataTable dtSalP = dataSalP.Tables[0]; foreach (DataRow drSalP in dtSalP.Rows) { TransSalesPerson transSp = new TransSalesPerson(drSalP); EjSalesPerson ejSalP = new EjSalesPerson(transSp); transRecords.EjAddReload(ejSalP); } } catch { } //Get Bank EJ try { //Get Sales person TransBank transBank = new TransBank(); transBank.Organization_no = trans.Organization_no; transBank.Pos_no = trans.Pos_no; transBank.Store_no = trans.Store_no; transBank.Trans_no = trans.Trans_no; DataSet dataTBank = transBank.LoadByTransid(); DataTable dtTBank = dataTBank.Tables[0]; foreach (DataRow drTBank in dtTBank.Rows) { TransBank tb = new TransBank(drTBank); EjBank ejBank = new EjBank(tb); transRecords.EjAddReload(ejBank); } } catch { } //Get Payments made try { TransTender tender = new TransTender(); tender.Trans_no = trans.Trans_no; tender.Organization_no = trans.Organization_no; tender.Store_no = trans.Store_no; tender.Pos_no = trans.Pos_no; DataSet data1 = tender.LoadByTransid(); DataTable dt1 = data1.Tables[0]; foreach (DataRow dr1 in dt1.Rows) { TransTender transTender = new TransTender(dr1); EjTender ejTender = new EjTender(transTender); transRecords.EjAddReload(ejTender); } } catch { } transRecords.EjArrayList.Sort(new Ej()); return(transRecords); }
// // 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; }
public EjTender(TransTender trans) { this.transTender = trans; this.LineType = (int)EjLineType.TENDER; }
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; } }
// // 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; }