public override void Engage(int keyValue) { //essageBox.Show("*** Exit ***"); //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Shutdown")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } if ((PosContext.Instance.CurrentEj != null) && (PosContext.Instance.CurrentEj.SeqNo > 0)) { PosError error = new PosError(PosErrorCode.SHUTDOWN_NOT_ALLOWED); error.Engage(0); } else { PosHardware.Instance.Close(); PosContext.Instance.Dispose(); //Environment.Exit(1); //Process. Application.Current.Shutdown(); //MessageBox.Show("Delteed code"); } }
/** * Gets the current header EJ record, sets the type to RETURN and * toggles the sign in the context. */ public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("ReturnSale")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } // if in a middle of a dialog just return if (!(PosEventStack.Instance.CurrentPosEvent() is EclipsePos.Apps.PosEvents.RegisterOpen)) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } // if in a middle of a dialog just return if ((PosContext.Instance.CurrentEj != null) && (PosContext.Instance.CurrentEj.SeqNo > 0)) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } PosContext.Instance.ToggleSign(); PosContext.Instance.TransactionType = (int)Transaction.Types.RETURN; PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); }
public override void Engage(int keyValue) { // MessageBox.Show("*** CashTender ***"); // if there are input in buffer if (PosContext.Instance.InputLine.Length > 0) { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); return; } if ((PosContext.Instance.Sign > 0 && PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.EjBalance() > 0.0) || (PosContext.Instance.Sign < 0 && PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.EjBalance() < 0.0)) { PosEventStack.Instance.LoadDialog("CashTender"); PosEventStack.Instance.NextEvent(); } else { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); } }
public override void Engage(int keyValue) { //Transaction t = ((EjHeader) PosContext.Instance.CurrentEj.[0]).; //t.setTransType (Transaction.LOGOFF); //t.updateStateAndType (Transaction.COMPLETE, Transaction.LOGOFF); // Close any guis that might exist. //for (int i=0;i<context ().guis ().size (); i++) //{ // PosGui gui = (PosGui) context ().guis ().elementAt (i); // gui.close (); // //} //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("LogOff")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } if ((PosContext.Instance.CurrentEj != null) && (PosContext.Instance.CurrentEj.SeqNo > 0)) { PosError error = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); error.Engage(0); } else { PosContext.Instance.DisableKeys(); PosEventStack.Instance.LoadDialog("Logon"); PosEventStack.Instance.NextEvent(); } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("SystemManager")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } //essageBox.Show("*** Exit ***"); if ((PosContext.Instance.CurrentEj != null) && (PosContext.Instance.CurrentEj.SeqNo > 0)) { PosError error = new PosError(PosErrorCode.SHUTDOWN_NOT_ALLOWED); error.Engage(0); } else { try { Process.Start(@"..\EclipsePosSystemManager\EclipsePOS.WPF.SystemManager.exe"); PosContext.Instance.Dispose(); Application.Current.Shutdown(); } catch (Exception e) { MessageBox.Show(e.ToString(), "Run System Manager", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public override void Engage(int val) { //MessageBox.Show("*** Discount ***" + keyValue.ToString()); //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Discount")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } // if ( PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.Seq_no > 0 ) //{ // PosError posError = new PosError(PosErrorCode.PROMOTION_NOT_APPLICABLE); // posError.Engage(0); // return; //} int keyValue = val; //(int) PosContext.Instance.PosKeyValue; Promotion pro = new Promotion(); pro.PromotionNo = keyValue; pro.Organization_no = PosSettings.Default.Organization; pro.Load(); if (pro.PromotionType == (int)EjPromotionTypes.WHOLE_ORDER) { PosContext.Instance.SaleMode = pro; //Apply promotion for current Ej object[] currentEj = new Object[PosContext.Instance.CurrentEj.EjArrayList.Count]; PosContext.Instance.CurrentEj.EjArrayList.CopyTo(currentEj); foreach (object obj in currentEj) { if (obj is EjItem) { EjItem ejItem = obj as EjItem; if ((ejItem.TransItem.State == (int)EjLineStates.VOID_ITEM) || ejItem.TransItem.State == (int)EjLineStates.PRICE_OVERRIDE) { continue; } EjPromotion ejPromo1 = new EjPromotion(PosContext.Instance.SaleMode, ejItem); ejPromo1.SKU = ejItem.SKU; ejPromo1.Engage(0); } } } else { EjPromotion ejPromo1 = new EjPromotion(pro, PosContext.Instance.CurrentEjItem); ejPromo1.SKU = PosContext.Instance.CurrentEjItem.SKU; ejPromo1.Engage(0); } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("VoidSale")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } // If tried to void without any sales, just return if (PosContext.Instance.CurrentEj == null) { return; } if (PosContext.Instance.CurrentEj.SeqNo == 0) { return; } //Tried to void while in a dialog if (!(PosEventStack.Instance.CurrentPosEvent() is EclipsePos.Apps.PosEvents.RegisterOpen)) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } PosContext.Instance.Receipt.Update(this); PosContext.Instance.CurrentEj.Complete((int)Transaction.Status.VOIDED); if (PosContext.Instance.AlphaKeyEntryDisplay != null) { PosContext.Instance.AlphaKeyEntryDisplay.KeyReset(); } /* * PosContext.Instance.TableName = ""; * PosContext.Instance.EjCustomer = null; * if (PosContext.Instance.Sign < 0) * { * PosContext.Instance.ToggleSign(); * } * PosContext.Instance.SaleMode = null; * PosEventStack.Instance.ClearPending(); * PosEventStack.Instance.SetEvent(new RegisterOpen()); */ new FinishTransaction().Engage(0); PosEventStack.Instance.NextEvent(); }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("TrainingMode")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } PosContext.Instance.Training = true; }
public override void Engage(int keyValue) { if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.LineNo == 0) { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); return; } // PrintJobQueue.Instance.Backup(); // PrintJobQueue.Instance.PrintReceiptStart(); // PrintJobQueue.Instance.Restore(); PosContext.Instance.Receipt.Update(this); }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("ChangePrice")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } EjPriceOverride ejPriceOverride = new EjPriceOverride(); ejPriceOverride.States().PushState((int)EjPriceOverride.ENTER_LINE_NUMBER); PosEventStack.Instance.PushEvent(ejPriceOverride); PosEventStack.Instance.NextEvent(); }
public override void Engage(int keyValue) { // PosContext.Instance.CurrentPosDisplay.LoadOpenOrdersList(); //Merger to current order if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.SeqNo > 0) { PosError posError = new PosError(PosErrorCode.ERROR_EVENT); posError.Engage(0); return; } switch (this.States().PeekState()) { case ENTER_TRANS_NO: PosContext.Instance.CurrentPosDisplay.LoadOpenOrdersList(); PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_TRANS_NO); // PosEventStack.Instance.NextEvent(); break; case GET_TRANS_NO: int trxno = PosContext.Instance.Input(); this.LoadEj(trxno); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.States().Clear(); PosEventStack.Instance.ClearPending(); PosContext.Instance.HomeGUI(); PosEventStack.Instance.NextEvent(); break; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Store")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } // If tried to save without any sales, just return if (PosContext.Instance.CurrentEj == null) { return; } //Tried to recall in a middle of a dialog if (!(PosEventStack.Instance.CurrentPosEvent() is EclipsePos.Apps.PosEvents.RegisterOpen)) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } // Print receipt PosContext.Instance.Receipt.Update(this); PosContext.Instance.CurrentEj.Complete((int)Transaction.Status.SUSPEND); /* PosContext.Instance.TableName = ""; * PosContext.Instance.ReceiptHeader.TrxNo = ""; * PosContext.Instance.ReceiptDetails.Clear(); * PosContext.Instance.ReceiptTotal.Clear(); * if (PosContext.Instance.AlphaKeyEntryDisplay != null) * { * PosContext.Instance.AlphaKeyEntryDisplay.KeyReset(); * } */ new FinishTransaction().Engage(0); PosEventStack.Instance.NextEvent(); }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Customer")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.EjBalance() != 0.0) { PosEventStack.Instance.LoadDialog("Customer"); PosEventStack.Instance.NextEvent(); } else { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event // if (!PosContext.Instance.Employee.RolesEventNames.Contains("ReceiveOnAccount")) // { // PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); // posError.Engage(0); // return; //} if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.EjBalance() == 0) { PosEventStack.Instance.LoadDialog("ReceiveOnAccount"); PosEventStack.Instance.NextEvent(); } else { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); } }
public override void Engage(int keyValue) { if (!PosContext.Instance.Employee.RolesEventNames.Contains("CreditTender")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } //MessageBox.Show("*** CreditTender ***"); if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.EjBalance() > 0.0) { PosContext.Instance.PosKeyValue = keyValue; PosEventStack.Instance.LoadDialog("CreditTender"); PosEventStack.Instance.NextEvent(); } else { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); } }
public override void Engage(int keyValue) { //MessageBox.Show("*** AltCurrTender ***" + keyValue); //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("AltCurrencyTender")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } Logger.Info( this.GetType().FullName, this.GetType().FullName + "Key value:" + PosContext.Instance.InputLine.ToString(), PosSettings.Default.Debug ); // The type of alternate currency is passed as the value to engage () CurrencyCode inputCurrencyCode = new CurrencyCode(); inputCurrencyCode.Pos_key_number = keyValue; inputCurrencyCode.LoadCurrencyCodeByPosKey(); Currency curr = new Currency(); //curr.Organization_no = PosContext.Instance.Config.Organization_id; //curr.Currency_code = PosContext.Instance.InputLine.Substring(0,3); curr.Home_currency = PosContext.Instance.Organization.Home_currency; curr.Source_currency = inputCurrencyCode.Currency_code; curr.Rate_date = DateTime.Now; curr.LoadByCurrencyCodeId(); PosContext.Instance.AltCurrency = curr; PosContext.Instance.AltCurrencyCode = inputCurrencyCode; // Set up and push the current dialog on the stack PosEventStack.Instance.LoadDialog("AltCurrTender"); PosEventStack.Instance.NextEvent(); }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("PaidOut")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.EjBalance() == 0) { PosEventStack.Instance.LoadDialog("PaidOut"); PosContext.Instance.TransactionType = (int)Transaction.Types.PAID_OUT; PosEventStack.Instance.NextEvent(); } else { PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); } }
public override void Engage(int keyValue) { //MessageBox.Show("*** Item markdown ***" + keyValue.ToString() ); //if there are no items in the invoice error out if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.SeqNo == 0) { PosError posError = new PosError(PosErrorCode.ITEM_DISCOUNT_NOT_APPLICABLE); posError.Engage(0); return; } Promotion promo = new Promotion(); // int keyValue = (int) PosContext.Instance.PosKeyValue; promo.PromotionNo = keyValue; promo.Organization_no = PosSettings.Default.Organization; promo.Load(); if (promo.PromotionClass != null) { EjPromotion ejPromo = new EjPromotion(promo, PosContext.Instance.CurrentEjItem); ejPromo.Engage(0); } // PosEventStack.Instance.NextEvent(); }
/** * Switch on the report type and update displays. */ public override void Engage(int keyValue) { keyValue = (int)PosContext.Instance.PosKeyValue; //MessageBox.Show("*** TerminalReport ***"+keyValue.ToString()); //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("TerminalReports")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } //Check if employee role is authorized to this event if ((PosContext.Instance.CurrentEj != null) && (PosContext.Instance.CurrentEj.SeqNo > 0)) { PosError posError = new PosError(PosErrorCode.ERROR_EVENT); posError.Engage(0); return; } if (keyValue == 0) { reportType = (XZReportType)this.States().PeekState(); } else { reportType = (XZReportType)keyValue; } posTotal = new PosTotal(); posTotal.Organization_no = PosSettings.Default.Organization; posTotal.Store_no = PosContext.Instance.RetailStore.Retail_store_no; posTotal.Pos_no = PosSettings.Default.Station; switch (reportType) { case XZReportType.Z_DAILY: case XZReportType.X_DAILY: posTotal.Total_name = (int)TotalName.DAILY_BASE; break; case XZReportType.Z_WEEKLY: case XZReportType.X_WEEKLY: posTotal.Total_name = (int)TotalName.WEEKLY_BASE; break; case XZReportType.Z_MONTHLY: case XZReportType.X_MONTHLY: posTotal.Total_name = (int)TotalName.MONTHLY_BASE; break; case XZReportType.Z_YEARLY: case XZReportType.X_YEARLY: posTotal.Total_name = (int)TotalName.MONTHLY_BASE; break; } posTotal.Load(); posTotal.Relations(); if ((reportType == XZReportType.Z_WEEKLY || (reportType == XZReportType.Z_MONTHLY))) { // roll-up totals that migth be left over. switch (reportType) { case XZReportType.Z_DAILY: UpdateTotals(posTotal, TotalType.DAILY_BASE, TotalName.DAILY_BASE); break; case XZReportType.Z_WEEKLY: UpdateTotals(posTotal, TotalType.WEEKLY_BASE, TotalName.WEEKLY_BASE); break; case XZReportType.Z_MONTHLY: UpdateTotals(posTotal, TotalType.MONTHLY_BASE, TotalName.MONTHLY_BASE); break; } // re-read the totals posTotal = new PosTotal(); posTotal.Organization_no = PosSettings.Default.Organization; posTotal.Store_no = PosContext.Instance.RetailStore.Retail_store_no; posTotal.Pos_no = PosSettings.Default.Station; posTotal.Load(); posTotal.Relations(); } // see if there is any total information. if (posTotal.Totals.Count > 0) { PosContext.Instance.Receipt.Update(this); // PosError posError = new PosError(PosErrorCode.TERMINAL_REPORT); // posError.Engage(0); } else { return; } switch (reportType) { case XZReportType.Z_DAILY: UpdateTotals(posTotal, TotalType.WEEKLY_BASE, TotalName.DAILY_BASE); break; case XZReportType.Z_WEEKLY: UpdateTotals(posTotal, TotalType.MONTHLY_BASE, TotalName.WEEKLY_BASE); break; case XZReportType.Z_MONTHLY: UpdateTotals(posTotal, TotalType.YEARLY_BASE, TotalName.MONTHLY_BASE); break; } // pause... //PosContext ().eventStack ().pushEvent (new Pause (context ())); //PosContext.Instance.Operprompt.Update((Pause) context ().eventStack ().event ()); PosContext.Instance.InputLine = ""; PosContext.Instance.PosKeyValue = 0; }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Discount")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } if (PosContext.Instance.CurrentEj.SeqNo == 0) { PosError posError = new PosError(PosErrorCode.ITEM_DISCOUNT_NOT_APPLICABLE); posError.Engage(0); return; } switch (this.States().PeekState()) { case ENTER_AMOUNT: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("EnterDiscountAmount"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_AMOUNT); break; case GET_AMOUNT: this.discountAmt = PosContext.Instance.Input(); // PosContext.Instance.ClearInput(); // PosContext.Instance.Operprompt.Clear(); this.PopState(); this.States().PushState(APPLY_DISCOUNT); PosEventStack.Instance.NextEvent(); break; case APPLY_DISCOUNT: Promotion promo = new Promotion(); // int keyValue = (int) PosContext.Instance.PosKeyValue; promo.PromotionNo = 0; promo.Organization_no = PosSettings.Default.Organization; promo.PromotionType = 1; promo.PromotionVal1 = 1; promo.PromotionString = "Discount"; promo.PromotionClass = "EclipsePos.Apps.Operators.GetDiscountFromInput"; EjPromotion ejPromo = new EjPromotion(promo, PosContext.Instance.CurrentEjItem); ejPromo.Engage(0); this.States().Clear(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); break; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } switch (this.States().PeekState()) { case RECALL: // Tried to recall in a middle of a dialog if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.SeqNo > 0) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } PosEventStack.Instance.LoadDialog("RecallEj"); this.PopState(); this.PushState(RecallEj.ENTER_TRANS_NO); PosEventStack.Instance.NextEvent(); break; case ENTER_TRANS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_TRANS_NO); break; case ENTER_POS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptPosNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_POS_NO); break; case GET_TRANS_NO: this.trxno = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.PopState(); PosEventStack.Instance.NextEvent(); break; case GET_POS_NO: this.PosNo = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); this.PopState(); PosContext.Instance.Operprompt.Clear(); PosEventStack.Instance.NextEvent(); break; case COMPLETE_RECALL: PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = this.PosNo; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosContext.Instance.RetailStore.Retail_store_no; trans.Load(); // if (trans.State == (int)Transaction.Status.SUSPEND) // { // was this a suspended transaction? PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records if (trans.State == (int)Transaction.Status.SUSPEND) { trans.State = (int)Transaction.Status.IN_PROGRESS; } foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; PosContext.Instance.Receipt.Update(line); } this.States().Clear(); } // } PosContext.Instance.TrxNo = this.TrxNo; /* ES01-26/11/08 */ this.PromptText = PosContext.Instance.Parameters.getParam("RegOpen"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); PosEventStack.Instance.ClearPending(); //Clear transaction if complete if (trans.State == (int)Transaction.Status.COMPLETE) { PosEventStack.Instance.PushEvent(new FinishTransaction()); } break; } }
/** * Void the last item in the ej. Logic also * sets any related ej record amounts to 0, * but doesn't remove them. */ public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("VoidItemLine")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } // if in a middle of a dialog just return // if (!(PosEventStack.Instance.CurrentPosEvent() is EclipsePos.Apps.PosEvents.RegisterOpen)) // { // PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); // PosEventStack.Instance.NextEvent(); // return; // } // If tried to void without any sales, just return // if (PosContext.Instance.CurrentEj == null) return; switch (this.States().PeekState()) { case VOID_ITEM: this.PopState(); this.PushState(ENTER_LINE_NUMBER); PosEventStack.Instance.NextEvent(); break; case ENTER_LINE_NUMBER: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptEnterLineNumber"); this.PopState(); this.PushState(GET_LINE_NUMBER); PosContext.Instance.Operprompt.Update(this); break; case GET_LINE_NUMBER: this.lineNumber = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.PopState(); if (this.lineNumber > 0 && this.lineNumber <= PosContext.Instance.CurrentEj.LineNo) { this.PushState(COMPLETE_ITEM_VOID); } else { this.PushState(ENTER_LINE_NUMBER); PosContext.Beep(500, 50); } PosEventStack.Instance.NextEvent(); break; case COMPLETE_ITEM_VOID: // this.ProcessItemVoid(this.lineNumber); this.VoidLine(this.lineNumber); this.States().Clear(); PosContext.Instance.HomeGUI(); PosEventStack.Instance.NextEvent(); break; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("MergeOrder")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } //Merger to current order if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.SeqNo == 0) { PosError posError = new PosError(PosErrorCode.ERROR_EVENT); posError.Engage(0); return; } switch (this.States().PeekState()) { case MERGE: PosContext.Instance.CurrentPosDisplay.LoadOpenOrdersList(); this.PopState(); this.PushState(ENTER_TRANS_NO); PosEventStack.Instance.NextEvent(); break; case ENTER_TRANS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_TRANS_NO); break; case GET_TRANS_NO: this.trxno = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.PopState(); this.PushState(COMPLETE_MERGE); PosEventStack.Instance.NextEvent(); break; case COMPLETE_MERGE: PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = PosSettings.Default.Station; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosSettings.Default.Store; trans.Load(); if (trans.State == (int)Transaction.Status.SUSPEND) { // was this a suspended transaction? Ej ejFrom = Ej.GetSuspendedEj(trans); if (ejFrom.EjArrayList.Count > 0) { // finally make sure there are records // trans.State = (int)Transaction.Status.IN_PROGRESS; foreach (Object obj in ejFrom.EjArrayList) { EjLine line = (EjLine)obj; ProcessEjLine(line); } // context ().homeGuis (); // context ().eventStack ().setEvent (new FirstItem (context ())); this.States().Clear(); // PosEventStack.Instance.NextEvent(); } // ejFrom.Complete((int)Transaction.Status.VOIDED); this.VoidEj(ejFrom); } if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); // PosEventStack.Instance.ClearPending(); PosContext.Instance.HomeGUI(); PosEventStack.Instance.NextEvent(); break; } }
public override void Engage(int keyValue) { //MessageBox.Show("*** EnterKey ***"); if (PosEventStack.Instance.CurrentEvent is PosError) { PosError posError = PosEventStack.Instance.CurrentEvent as PosError; if (posError.ErrorCode == PosErrorCode.HARDWARE_PROBLEM) { new CheckHardware().Engage(0); } else { //posError.Engage(0); } return; } if (PosEventStack.Instance.CurrentEvent is TerminalReport) { PosError posError = new PosError(PosErrorCode.TERMINAL_REPORT); posError.Engage(0); return; } if (PosEventStack.Instance.CurrentPosEvent() is EclipsePos.Apps.PosEvents.RegisterOpen) { if (PosContext.Instance.InputLine.Length > 0) { //new LookupItem().Engage(0); if (PosContext.Instance.Parameters.getParam("PromptForTableNo").ToUpper() == "TRUE" && PosContext.Instance.TransactionType == (int)Transaction.Types.DINE_IN) { // PosEventStack.Instance.LoadDialog("FindItem"); PosEventStack.Instance.PushEvent(new LookupItem()); // Request to select or enter table number SelectTable posEvent = new SelectTable(); posEvent.PushState(posEvent.StartState); PosEventStack.Instance.PushEvent(posEvent); PosEventStack.Instance.NextEvent(); } else { // new LookupItem().Engage(0); PosEventStack.Instance.PushEvent(new LookupItem()); PosEventStack.Instance.NextEvent(); } } } else { // Get the next event PosEventStack.Instance.NextEvent(); PosContext.Instance.InputLine = ""; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } try { if (PosContext.Instance.CurrentEj.SeqNo > 0) { PosError posError = new PosError(PosErrorCode.RECALL_FAILLED); posError.Engage(0); return; } } catch (Exception ex) { } PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = this.PosNo; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosContext.Instance.RetailStore.Retail_store_no; trans.Load(); PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; PosContext.Instance.Receipt.Update(line); } this.States().Clear(); } PosContext.Instance.TrxNo = this.TrxNo; /* ES01-26/11/08 */ this.PromptText = PosContext.Instance.Parameters.getParam("RegOpen"); //PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); PosEventStack.Instance.ClearPending(); //Clear transaction if complete if ((trans.State == (int)Transaction.Status.COMPLETE) || (trans.State == (int)Transaction.Status.VOIDED)) { PosEventStack.Instance.PushEvent(new FinishTransaction()); } }
/** Event logic is implemented here */ public override void Engage(int keyValue) { Item item = new Item(); item.Organization_no = PosSettings.Default.Organization; // if (keyValue > 0) // { // item.Plu = keyValue; // item.LoadByPLU(); // // } // else // { if (PosContext.Instance.InputLine.Length == 0 && PosContext.Instance.ItemLookupDevice.SelectedItem().Length > 0) { item.Sku = PosContext.Instance.ItemLookupDevice.SelectedItem(); item.LoadBySKU(); } else { if (PosContext.Instance.InputLine.Length <= maxPluLength) { try { item.Plu = PosContext.Instance.InputLine.Trim(); item.LoadByPLU(); } catch (System.FormatException e) { //Could be SKU item.Sku = PosContext.Instance.InputLine; item.LoadBySKU(); } } if (item.Short_Desc == null) { try { item.Sku = PosContext.Instance.InputLine; item.LoadBySKU(); } catch { } } } // } if (item.Short_Desc != null) { try { EjItem ejItem = new EjItem(item); //ejItem.Engage(0); ejItem.States().PushState((int)EjItemStates.ENTER_QTY); PosEventStack.Instance.PushEvent(ejItem); // PosEventStack.Instance.Dump(); PosEventStack.Instance.NextEvent(); } catch (Exception e) { MessageBox.Show(e.StackTrace.ToString()); } } else { PosError posError = new PosError(PosErrorCode.INVALID_INPUT); posError.Engage(0); } PosContext.Instance.InputLine = ""; PosContext.Instance.ClearInput(); }
public override void Engage(int keyValue) { if (PosContext.Instance.CurrentEj.SalesPerson.Count == 0) { this.States().Clear(); PosContext.Instance.ClearInput(); PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); return; } switch (this.States().PeekState()) { case ENTER_SALES_PERSON: this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(GET_SALES_PERSON); break; case GET_SALES_PERSON: this.PopState(); this.employee_no = PosContext.Instance.InputLine; Employee emp = new Employee(); emp.Organization_no = PosSettings.Default.Organization; emp.Employee_no = this.employee_no; 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(DELETE_SALES_PERSON); PosEventStack.Instance.NextEvent(); break; case DELETE_SALES_PERSON: this.PopState(); PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesP){ TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesP.DataRecord(); if (transSalesPerson.Employee_no == this.employee_no) { this.ejSalesPerson = ejSalesP; } }); // foreach (EjSalesPerson ejPerson in PosContext.Instance.CurrentEj.SalesPerson) // { // MessageBox.Show(ejPerson.Employee.Employee_no); // if (ejPerson.Employee.Employee_no == this.employee_no) // { // this.ejSalesPerson = ejPerson; // } // } if (this.ejSalesPerson != null) { PosContext.Instance.CurrentEj.SalesPerson.Remove(this.ejSalesPerson); this.ejSalesPerson.DeleteEj(); PosContext.Instance.Receipt.Update(this); } this.States().Clear(); PosEventStack.Instance.NextEvent(); break; default: break; } }