public static IState EnterCustomer() { if (cr.Document.Items.Count > 0 && cr.Document.Id > 0) { if (!(cr.Document is Receipt)) { AlertCashier.Instance(new Confirm(PosMessage.CUSTOMER_NOT_BE_CHANGED_IN_DOCUMENT)); return(cr.State); } else { if (cr.Document.Customer != null) { String msg = String.Format("{0}\n{1}", cr.Document.Customer.Name, PosMessage.CONFIRM_VOID_CURRENT_CUSTOMER); cr.State = ConfirmCashier.Instance(new Confirm(msg, CustomerInfo.ConfirmVoidCustomer)); } else { Confirm e = new Confirm(PosMessage.CONFIRM_TRANSFER_CUSTOMER_TO_RECEIPT, new StateInstance(Selling.ChangeConfirmed), new StateInstance(Start.Instance)); cr.State = ConfirmCashier.Instance(e); } } } return(cr.State); }
public static IState OpenOrderByBarcode(string orderBarcode) { MenuList orderDocsMenu = new MenuList(); String label = ""; String cashierId = orderBarcode.Substring(0, 4); int orderId = int.Parse(orderBarcode.Substring(4, 4)); List <DocumentFileHelper> orderDocuments = new List <DocumentFileHelper>(DocumentFileHelper.GetOpenOrders("", true)); foreach (DocumentFileHelper helper in orderDocuments) { if (helper.Cashier.Id == cashierId && helper.Id == orderId) { //SalesDocument doc = helper.LoadDocument(); String cashiername = helper.Cashier.Name; cashiername = cashiername.Substring(0, Math.Min(14, cashiername.Length)); label = "SIP NO:{0:D4}\t{1:dd/MM/yy}\n{2}\t{1:HH:mm}"; label = String.Format(label, helper.Id, helper.CreationTime, cashiername); orderDocsMenu.Add(new MenuLabel(label, helper)); } } if (orderDocsMenu.Count == 0) { return(AlertCashier.Instance(new Confirm(PosMessage.NO_DOCUMENT_FOUND))); } else { return(List.Instance(orderDocsMenu, RepeatDocument)); } }
public override void Enter() { if (IsValidIPAddress(input.ToString("B"))) { if (ReturnConfirm != null) { try { cr.State = ReturnConfirm(input.ToString("B")); } catch { cr.State = AlertCashier.Instance(new Error(new InvalidOperationException(), ReturnCancel, ReturnCancel)); } } } else { Confirm err = new Confirm("HATALI IP", new StateInstance(ReturnCancel), new StateInstance(ReturnCancel)); cr.State = AlertCashier.Instance(err); } }
private static void SelectMenuAction(Object menu) { try { string message = ((MenuLabel)ie.Current).ToString(); message = message.Substring(message.IndexOf('\n') + 1); switch (message) { case PosMessage.RETURN_RECEIPT: cr.State = States.ConfirmAuthorization.Instance(ReturnReceipt, ReturnCancel, Authorizations.VoidDocument); break; case PosMessage.RETURN_PRODUCT: cr.State = States.ConfirmAuthorization.Instance(ReturnProduct, ReturnCancel, Authorizations.VoidDocument); break; case PosMessage.PRINT_RECEIPT_COPY: cr.State = PrintReceiptCopy(); break; case PosMessage.REPEAT_SALE: cr.State = RepeatSale(); break; } } catch (Exception ex) { cr.State = AlertCashier.Instance(new Error(ex, ReturnCancel, ReturnCancel)); } }
/// <summary> /// used for new customer record /// Enter taxNumber of new customer /// </summary> /// <param name="taxNumber"> /// Tax Number of new Customer /// </param> /// <returns></returns> public static IState EnterCustomerTaxNumber(String taxNumber) { long outl = 0; if (!Parser.TryLong(taxNumber.Trim(), out outl)) { return(AlertCashier.Instance(new Confirm("VERGi NUMARASI\nRAKAMLARDAN OLUÞMALI" , new StateInstance(ErrorCustomerTaxNumber), new StateInstance(ErrorCustomerTaxNumber)))); } customerInput.Append(taxNumber.PadRight(15, ' ')); if (cr.CurrentCashier.AuthorizationLevel == AuthorizationLevel.S || cr.CurrentCashier.AuthorizationLevel == AuthorizationLevel.Z) { return(States.EnterString.Instance(PosMessage.PROMOTION_LIMIT, new StateInstance <string>(EnterCustomerPromotionLimit))); } else { // Append "00" as default promotion limit to customer info string customerInput.Append("00"); if (cr.IsDesktopWindows) { return(States.EnterString.Instance(PosMessage.CUSTOMER_GROUP + "\n ATLA (GÝRÝÞ)", new StateInstance <String>(EnterCustomerGroup), new StateInstance(Instance))); } else { return(EnterCustomerGroup("".PadLeft(6))); } } }
public static IState ShowProduct(String barcode) { try { currentProduct = cr.DataConnector.FindProductByBarcode(barcode); if (currentProduct.Status != ProductStatus.Weighable) { int val = (int)quantity; if (quantity > val) { return(AlertCashier.Instance(new Confirm(PosMessage.PRODUCT_NOT_WEIGHABLE, Continue)));; } } string firstLine = ""; int maxLength = quantity.ToString().Length + 3; maxLength = 20 - maxLength; if (currentProduct.Name.Length > maxLength) { firstLine = String.Format("{0}\t{1}", currentProduct.Name.Substring(0, maxLength), quantity.ToString()); } DisplayAdapter.Cashier.Show(String.Format("{0}\n{1}\t", firstLine, currentProduct.Barcode)); } catch (Exception ex) { return(AlertCashier.Instance(new Confirm(ex.Message, Continue)));; } return(state); }
public override void Void() { if (cr.Document.Items.Count == 0) { cr.State = AlertCashier.Instance(new Confirm("SATIÞ YOK\nIPTAL GEÇERSÝZ")); return; } if (cr.Item.TotalAmount > 0) { cr.Item.TotalAmount = 0; } //Check Cashier authorizationLvel whether has authorization or not. if (!cr.IsAuthorisedFor(Authorizations.VoidSale)) { cr.State = AlertCashier.Instance(new Confirm(PosMessage.INSUFFICIENT_ACCESS_LEVEL)); return; } Quantity(); cr.Item = cr.Item.Void(); cr.State = VoidSale.Instance(); // If void sale have already selected on grid if (cr.Item.Product != null) { cr.State.LabelKey(cr.Item.Product.Id - 1); } }
public override void Enter() { if (t != null || t.ThreadState == ThreadState.WaitSleepJoin) { if (t.ThreadState == ThreadState.Unstarted) { t.Start(); } t.Interrupt(); t.Join(); } if (ReturnConfirm != null) { try { cr.State = ReturnConfirm(input.ToString().Trim()); } catch (Exception ex) { cr.Log.Warning(ex); cr.State = AlertCashier.Instance(new Error(ex, ReturnCancel, ReturnCancel)); } } }
public static IState SetLogo(String logo) { if (printerLogo == null) { printerLogo = cr.Printer.Logo; } string[] tempArray = printerLogo; Confirm err = new Confirm(PosMessage.INVALID_ENTRY, new StateInstance(Continue), new StateInstance(Continue)); if (logo.Length > 48) { return(AlertCashier.Instance(err)); } else { try { tempArray[int.Parse(logoLine) - 1] = logo; cr.Printer.Logo = tempArray; } catch (Exception ex) { cr.Log.Error("Exception occured.", ex); return(AlertCashier.Instance(new Error(ex, new StateInstance(ShowLogoMenu), new StateInstance(ShowLogoMenu)))); } } return(ShowLogoMenu()); }
public static IState SetTaxRates(decimal taxRate) { decimal[] tempArray = cr.Printer.TaxRates; Confirm err = new Confirm(PosMessage.INVALID_ENTRY, new StateInstance(Continue), new StateInstance(Continue)); if (taxRate > 100) { return(AlertCashier.Instance(err)); } else { try { tempArray[int.Parse(vatIndex) - 1] = taxRate; cr.Printer.TaxRates = tempArray; } catch (Exception ex) { cr.Log.Error("Exception occured.", ex); return(AlertCashier.Instance(new Error(ex, new StateInstance(ShowTaxRatesMenu), new StateInstance(ShowTaxRatesMenu)))); } } cr.State = ShowTaxRatesMenu(); return(cr.State); }
public static IState EnterCustomerPromotionLimit(String promoLimit) { long outl = 0; if (!Parser.TryLong(promoLimit.Trim(), out outl)) { return(AlertCashier.Instance(new Confirm("PROMOSYON LIMIT\nRAKAMLARDAN OLUÞMALI", new StateInstance(EnterCustomerPromotionLimit), new StateInstance(EnterCustomerPromotionLimit)))); } if (outl > 100) { return(AlertCashier.Instance(new Confirm("PROMOSYON LIMIT\n MAX 100 OLMALI", new StateInstance(EnterCustomerPromotionLimit), new StateInstance(EnterCustomerPromotionLimit)))); } customerInput.Append(promoLimit.PadLeft(2, '0')); if (cr.IsDesktopWindows) { return(States.EnterString.Instance(PosMessage.CUSTOMER_GROUP + "\n ATLA (GÝRÝÞ)", new StateInstance <String>(EnterCustomerGroup), new StateInstance(Instance))); } else { return(EnterCustomerGroup("".PadLeft(6))); } }
public static IState SetDateAndTime(String dateTime) { Confirm err = new Confirm(PosMessage.INVALID_ENTRY, new StateInstance(Continue), new StateInstance(Continue)); if (dateTime.Length != 12) { return(AlertCashier.Instance(err)); } else { try { cr.Printer.DateTime = DateTime.ParseExact(dateTime, "yyyyMMddHHmm", new System.Globalization.CultureInfo("en-US", true)); } catch (Exception ex) { cr.Log.Error("Exception occured.", ex); return(AlertCashier.Instance(new Error(ex, new StateInstance(Continue), new StateInstance(Continue)))); } } return(Continue()); }
private static IState ExitService(String password) { try { cr.Printer.ExitServiceMode(password); cr.SetPrinterPort(PosConfiguration.Get("PrinterComPort")); CashRegister.LoadCurrentSettings(); cr.State = States.Start.Instance(); } catch (CashierAutorizeException cae) { cr.State = AlertCashier.Instance(new Error(cae, new StateInstance(Continue), new StateInstance(Continue))); cr.Log.Error("CashierAutorizeException occured. {0}", cae.Message); } catch (CmdSequenceException ex) { cr.State = AlertCashier.Instance(new Error(ex, new StateInstance(Continue), new StateInstance(Continue))); cr.Log.Error("CmdSequenceException occured. {0}", ex.Message); } catch (SVCPasswordOrPointException ex) { cr.State = ConfirmCashier.Instance(new Error(ex, new StateInstance(Continue), new StateInstance(Continue))); cr.Log.Error("SVCPasswordOrPointException occured. {0}", ex); } return(cr.State); }
private static IState Instance(EJLimitWarningException e) { EJEXCEPTION = (EJException)e; /*if current address of ej is higer then ej limit */ return(AlertCashier.Instance(new Confirm(String.Format("{0}\n{1}", PosMessage.EJ_AVAILABLE_LINES, e.Usage)))); }
public static IState EnterCustomerGroup(String customerGroup) { customerGroup = customerGroup.Trim(); if (customerGroup.Length > 0 && customerGroup.Length != 6) { AlertCashier.Instance(new Confirm("MÜÞTERÝ GRUBU\nALTI KARAKTER OLMALI", new StateInstance(ErrorCustomerGroup), new StateInstance(ErrorCustomerGroup))); } customerInput.Append(customerGroup.PadLeft(6, ' ')); MenuList docTypeList = new MenuList(); String label = ""; int i = 1; string labelFormat = "{0}\t{1}\n{2}"; label = String.Format(labelFormat, PosMessage.DEFAULT_DOCUMENT_TYPE, i++, PosMessage.RECEIPT_TR); docTypeList.Add(new MenuLabel(label)); label = String.Format(labelFormat, PosMessage.DEFAULT_DOCUMENT_TYPE, i++, PosMessage.INVOICE); docTypeList.Add(new MenuLabel(label)); label = String.Format(labelFormat, PosMessage.DEFAULT_DOCUMENT_TYPE, i++, PosMessage.E_ARCHIVE); docTypeList.Add(new MenuLabel(label)); label = String.Format(labelFormat, PosMessage.DEFAULT_DOCUMENT_TYPE, i++, PosMessage.E_INVOICE); docTypeList.Add(new MenuLabel(label)); return(States.List.Instance(docTypeList, EnterDefaultDocumentCode, SaveCustomerInput)); }
/// <summary> /// - CommandMenu Instance. /// </summary> /// <returns>CommandMenu State</returns> private static IState Instance() { if (ie == null) { return(AlertCashier.Instance(new Error(new InvalidProgramException()))); } return(ListCommandMenu.Instance(ie, new ProcessSelectedItem <MenuLabel>(SelectActionMenu))); }
private static IState DisplayError(String errorMsg) { Confirm err = new Confirm(errorMsg, new StateInstance(Instance), new StateInstance(Instance)); return(AlertCashier.Instance(err)); }
public override void LabelKey(int labelKey) { System.Collections.Generic.List <IProduct> sList = new System.Collections.Generic.List <IProduct>(); if (cr.DataConnector.CurrentSettings.GetProgramOption(Setting.DefineBarcodeLabelKeys) == PosConfiguration.ON) { sList = cr.DataConnector.SearchProductByBarcode(Label.GetLabel(labelKey)); } else { sList = cr.DataConnector.SearchProductByLabel(Label.GetLabel(labelKey)); } if (sList.Count == 0) { cr.State = AlertCashier.Instance(new Error(new ProductNotFoundException())); return; } // Check Printer Status before add label cr.Printer.CheckPrinterStatus(); MenuList itemList = new MenuList(); foreach (IProduct p in sList) { if (cr.Item is VoidItem) { cr.Item = new SalesItem(); } SalesItem si = (SalesItem)cr.Item.Clone(); si.Product = p; if (p.Status == ProductStatus.Weighable && cr.Scale != null) { try { si.Quantity = cr.Scale.GetWeight(p.UnitPrice); } catch (Exception) { } } itemList.Add(si); } if (itemList.Count == 1) { if (itemList.MoveNext()) { cr.Execute(((IDoubleEnumerator)itemList).Current); } } else { cr.State = ListLabel.Instance(itemList, new ProcessSelectedItem <IProduct>(cr.Execute), labelKey); } }
public static IState CheckPassword(String password) { if (password.Length < 1 || password.Length > cr.MAX_CASHIER_PASSWOR_LENGTH) { Confirm wrongPassword = new Confirm(PosMessage.SERVICE_PASSWORD_INVALID, new StateInstance(Instance)); return(AlertCashier.Instance(wrongPassword)); } lastPassword = password; return(ShowMenu()); }
private static IState FindDocument() { matchingDocument = cr.Document.ReadMainLogFile(numericDocId, numericZNo); if (matchingDocument == null || matchingDocument.Items.Count == 0) { return(AlertCashier.Instance(new Confirm(PosMessage.DOCUMENT_ID_NOT_FOUND, new StateInstance(Continue)))); } return(cr.State); }
public static IState Instance(String barcode) { try { if (!cr.Document.IsEmpty) { return(States.Start.Instance()); } if (barcode.Length == 8) // May order { return(States.CommandMenu.OpenOrderByBarcode(barcode)); } else if (barcode.Length == 14) { registerNo = barcode.Substring(0, 6); if (registerNo != cr.FiscalRegisterNo.Substring(2, 2) + cr.FiscalRegisterNo.Substring(6)) { throw new DocumentIdNotSetException(); } numericZNo = Convert.ToInt32(barcode.Substring(6, 4)); numericDocId = Convert.ToInt32(barcode.Substring(10)); } else { registerNo = barcode.Substring(0, 2); if (registerNo != cr.FiscalRegisterNo.Substring(8)) { throw new DocumentIdNotSetException(); } numericZNo = Convert.ToInt32(barcode.Substring(2, 4)); numericDocId = Convert.ToInt32(barcode.Substring(6, 4)); } } catch (DocumentIdNotSetException) { return(AlertCashier.Instance(new Confirm(PosMessage.RECEIPT_NOT_BELONG_TO_CASE))); } if (cr.IsDesktopWindows) { return(Instance(Start.Instance)); } else { if (cr.Printer.IsFiscal) { return(cr.State = States.ConfirmCashier.Instance(new Confirm(PosMessage.CONFIRM_PRINT_RECEIPT_COPY, PrintReceiptCopy, Continue))); } else { return(Continue()); } } }
public override void Numeric(char c) { if (input.Decimals == 2) { //TODO:Virgulden sonro 3 hane girilirse eger kullanİcİnİn uyarİlmasi istenirse hata mesaji icin commentin kaldirilmasi yeterli.. AlertCashier.Instance(err); return; } input.AppendDecimal(c); DisplayAdapter.Cashier.Append(c.ToString()); }
public override void Escape() { if (BlockRemoved()) { CashRegister.Instance(); } else { cr.State = AlertCashier.Instance(new Confirm("YÜKLEME\nTAMAMLANAMADI", new StateInstance(Instance))); } }
public static IState Instance(StateInstance ReturnCancel) { MenuList menuHeaders = CreateBarcodeMenu(); if (menuHeaders.Count == 0) { return(AlertCashier.Instance(new Confirm(PosMessage.EJ_NOT_AVAILABLE))); } return(cr.State = List.Instance(menuHeaders, new ProcessSelectedItem(SelectMenuAction), ReturnCancel));; }
private static IState SetDocumentNo(int docNo) { if (docNo > 0 && currentZNo > 0) { cr.GetEFTSlipCopy(currentAcquierId, 0, 0, currentZNo, docNo); return(Continue()); } else { return(AlertCashier.Instance(new Confirm(PosMessage.INVALID_ENTRY, Continue, Continue))); } }
public override void Enter() { try { #if !WindowsCE DisplayAdapter.Customer.Show(null as MenuList); #endif ProcessSelected((FiscalItem)ie.Current); } catch (InvalidOperationException) { cr.State = AlertCashier.Instance(new Error(new ListingException())); } }
private static IState Instance(EJFormatException e) { EJEXCEPTION = (EJException)e; if (cr.Printer.CurrentDocumentId == 0) { return(ConfirmCashier.Instance(new Confirm(PosMessage.CONFIRM_NEW_EJ_FORMAT, new StateInstance(FormatJournal), new StateInstance(EscapeFormatJournal)))); } else { return(AlertCashier.Instance(new Confirm(PosMessage.ZREPORT_NECCESSARY_FOR_NEW_EJ, NewEJZRequired))); } }
private static IState ShutdownPOS(string pass) { if (PosConfiguration.Get("ServicePassword") == pass) { DisplayAdapter.Cashier.Show(PosMessage.PROGRAM_CLOSING); System.Threading.Thread.Sleep(2500); Chassis.CloseApplication(); return(cr.State); } else { return(cr.State = AlertCashier.Instance(new Confirm(PosMessage.INVALID_PASS_ENTRY, Instance, Instance))); } }
public static void ShowTableOnDisp(Object o) { DocumentFileHelper docHelper = null; SalesDocument document = null; decimal totalAdjAmount = 0.0m; if (o is DocumentFileHelper) { docHelper = o as DocumentFileHelper; } else { MenuLabel label = o as MenuLabel; docHelper = label.Value as DocumentFileHelper; } if (docHelper.FileInfo.Name.IndexOf("MASA10") > -1) { cr.State = AlertCashier.Instance(new Confirm("MASA BOÞ", OpenTables)); } else if (countToSellingState == 1) { document = docHelper.LoadDocument(); document.FileOnDisk = docHelper.FileInfo; document.Id = cr.Document.Id; String label = "{0}:{1:D3}\t{2}\n{3}?({4})"; label = String.Format(label, PosMessage.TABLE_NUMBER, docHelper.Id, document.TotalAmount, PosMessage.CLOSE_TABLE, PosMessage.ENTER); Confirm e = new Confirm(label, new StateInstance <Hashtable>(RepeatConfirmed), new StateInstance(OpenTables)); countToSellingState = 0; e.Data["Document"] = document; cr.State = ConfirmCashier.Instance(e); docHelper.Id = cr.Document.Id; docHelper.Remove(cr.Document); } else { document = docHelper.LoadDocument(); foreach (Adjustment adj in document.Adjustments) { totalAdjAmount += adj.NetAmount; } DisplayAdapter.Customer.ShowTableContent(document, totalAdjAmount); countToSellingState++; } }
public override void Correction() { try { cr.Document.UndoAdjustment(true); cr.State = SellingAfterSubtotalCorrection.Instance(); } catch (CmdSequenceException) { cr.State = AlertCashier.Instance(new Error(new NoAdjustmentException())); } catch (NoAdjustmentException ae) { AlertCashier.Instance(new Error(ae)); } }