示例#1
0
        public override void Enter()
        {
            MenuLabel label = (MenuLabel)ie.Current;

            salesDoc = label.Value as SalesDocument;
            if (CashRegister.Document.IsEmpty)
            {
                if (salesDoc is Receipt)
                {
                    ProcessSelected(salesDoc);
                    CashRegister.State = Start.Instance();
                }
                else
                {
                    ProcessSelected(salesDoc);
                }
            }
            else
            {
                String  confirmationMessage = String.Format(PosMessage.CHANGE_DOCUMENT, salesDoc.Name);
                Confirm e = new Confirm(confirmationMessage,
                                        new StateInstance <Hashtable>(LDChangeConfirmed),
                                        new StateInstance(Start.Instance));
                e.Data["Document"] = salesDoc;
                CashRegister.State = ConfirmCashier.Instance(e);
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        private static void TransferToChoosenDoc(Object o)
        {
            MenuLabel     label    = o as MenuLabel;
            SalesDocument salesDoc = label.Value as SalesDocument;

            String  confirmationMessage = String.Format(PosMessage.CHANGE_DOCUMENT, salesDoc.Name);
            Confirm e = new Confirm(confirmationMessage,
                                    new StateInstance <Hashtable>(ListDocument.LDChangeConfirmed),
                                    new StateInstance(Start.Instance));

            e.Data["Document"] = salesDoc;
            CashRegister.State = ConfirmCashier.Instance(e);
        }
示例#5
0
        public override void Customer()
        {
            CustomerInfo.ReturnCancel = null;

            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
            {
                cr.State = States.CustomerInfo.Instance();
            }
        }
 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)));
     }
 }
示例#7
0
        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++;
            }
        }
示例#8
0
 public static IState Instance()
 {
     cr.Printer.CheckPrinterStatus();
     if (cr.Document.BalanceDue > 0 || cr.Document.Payments.Count == 0)
     {
         return(Instance(PosMessage.ENTER_AMOUNT));
     }
     else
     {
         Confirm err = new Confirm("ODEME ALINDI\nSATISI KAPAT(GiRiS)",
                                   new StateInstance(Continue),
                                   new StateInstance(Payment.Instance));
         return(ConfirmCashier.Instance(err));
     }
 }
示例#9
0
        public override void SalesPerson()
        {
            //Check whether cashier has authorization to assign salesPerson


            if (cr.Document.SalesPerson == null)
            {
                cr.State = EnterClerkNumber.Instance(PosMessage.CLERK_ID,
                                                     new StateInstance <ICashier>(cr.Document.ConfirmSalesPerson),
                                                     new StateInstance(Start.Instance));
            }
            else
            {
                String  prompt = String.Format("{0}\n{1}", cr.Document.SalesPerson.Name.TrimEnd(), PosMessage.VOID_SALESPERSON);
                Confirm confirmVoidSalesPerson = new Confirm(prompt,
                                                             new StateInstance(cr.Document.VoidSalesPerson),
                                                             new StateInstance(Start.Instance));
                cr.State = ConfirmCashier.Instance(confirmVoidSalesPerson);
            }
        }
示例#10
0
        public static IState RepeatDocument(string barcode)
        {
            SalesDocument doc = cr.Document.GetDocumentByBarcode(barcode);

            System.Threading.Thread.Sleep(250);
            if (doc != null && doc.Items.Count > 0)
            {
                String  label = DisplayAdapter.DocumentFormat(doc);
                Confirm e     = new Confirm(label,
                                            new StateInstance <Hashtable>(RepeatConfirmed),
                                            new StateInstance(Continue));
                e.Data["Document"] = doc;
                return(ConfirmCashier.Instance(e));
            }
            else
            {
                return(AlertCashier.Instance(new Confirm(PosMessage.BARCODE_NOTFOUND,
                                                         new StateInstance(Continue))));
            }
        }
示例#11
0
        public override void Customer()
        {
            if (cr.DataConnector.CurrentSettings.GetProgramOption(Setting.AssingCustomerInSelling) == PosConfiguration.OFF)
            {
                AlertCashier.Instance(new Confirm(PosMessage.CUSTOMER_NOT_BE_CHANGED_IN_DOCUMENT));
                return;
            }

            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;
                }
                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(ChangeConfirmed),
                                                new StateInstance(Start.Instance));

                        cr.State = ConfirmCashier.Instance(e);
                    }
                }
            }
            else
            {
                base.Customer();
            }
        }
示例#12
0
 /// <summary>
 /// Confirms cashier whether signout or not
 /// </summary>
 /// <returns>confirm state</returns>
 public static IState Instance()
 {
     return(ConfirmCashier.Instance(new Confirm(PosMessage.CONFIRM_LOGOUT,
                                                new StateInstance(ConfirmLogout.Logout),
                                                new StateInstance(Start.Instance))));
 }
示例#13
0
 public static IState Instance()
 {
     return(ConfirmCashier.Instance(new Confirm("HAFIZA UYUÞMAZLIÐI\nNUMARA GiR(GiRiÞ)",
                                                new StateInstance(EnterFiscalId),
                                                new StateInstance(FiscalIdBlock.Instance))));
 }
示例#14
0
        public static IState ShowMenu()
        {
            try
            {
                cr.Printer.EnterServiceMode(lastPassword);
            }
            catch (CmdSequenceException ex)
            {
                cr.Log.Error("CmdSequenceException occured. {0}", ex);
            }
            catch (MissingCashierException mce)
            {
                cr.Log.Error("MissingCashierException occured. {0}", mce);
                Confirm wrongPassword = new Confirm(PosMessage.SERVICE_PASSWORD_INVALID,
                                                    new StateInstance(Instance));
                return(AlertCashier.Instance(wrongPassword));
            }
            catch (SVCPasswordOrPointException ex)
            {
                cr.Log.Error("SVCPasswordOrPointException occured. {0}", ex);
                return(ConfirmCashier.Instance(new Confirm(PosMessage.ATTACH_JUMPER_AND_TRY_AGAIN,
                                                           new StateInstance(ShowMenu),
                                                           new StateInstance(ShowMenu))));
            }
            catch (BlockingException ex)
            {
                cr.Log.Error("BlockingException occured. {0}", ex);
                return(ConfirmCashier.Instance(new Confirm(PosMessage.ATTACH_JUMPER_AND_RESTART_FPU,
                                                           new StateInstance(ShowMenu),
                                                           new StateInstance(ShowMenu))));
            }


            ReturnCancel = new StateInstance(Login.Instance);
            MenuList menuHeaders = new MenuList();
            int      index       = 1;

            //menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
            //    PosMessage.SERVICE, index++, PosMessage.MENU_LOGO)));
            //menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
            //    PosMessage.SERVICE, index++, PosMessage.MENU_VAT_RATES)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_DAILY_MEMORY_FORMAT)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_DATE_AND_TIME)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_CREATE_DB)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_PRINT_LOGS)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_FACTORY_SETTING)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_CLOSE_FM)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_EXTERNAL_DEV_SETTINGS)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_UPDATE_FIRMWARE)));
            //menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
            //    PosMessage.SERVICE, index++, PosMessage.MENU_START_FM_TEST)));
            menuHeaders.Add(new MenuLabel(String.Format("{0}\t{1,2}\n{2}",
                                                        PosMessage.SERVICE, index++, PosMessage.MENU_EXIT_SERVICE)));



            List.Instance(menuHeaders);
            return(state);
        }
示例#15
0
        public override void Enter()
        {
            String msg = ((MenuLabel)ie.Current).ToString();

            if (msg.IndexOf("\n") > -1)
            {
                msg = msg.Substring(msg.IndexOf("\n") + 1);
            }

            switch (msg)
            {
            case PosMessage.MENU_DAILY_MEMORY_FORMAT:
                cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.PROMPT_DAILY_MEMORY_FORMAT,
                                                               new StateInstance(FormatMemory),
                                                               new StateInstance(Continue)));
                break;

            case PosMessage.MENU_DATE_AND_TIME:
                cr.State = EnterString.Instance("FORMAT: yyyyMMddHHmm",
                                                DateTime.Now.ToString("yyyyMMddHHmm"),
                                                new StateInstance <String>(SetDateAndTime),
                                                new StateInstance(Continue));
                break;

            case PosMessage.MENU_FACTORY_SETTING:
                cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.LOAD_FACTOR_SETTINGS,
                                                               new StateInstance(LoadFactorySettings),
                                                               new StateInstance(Continue)));
                break;

            case PosMessage.MENU_CLOSE_FM:
                cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.CLOSE_FISCAL_MEMORY,
                                                               new StateInstance(CloseFiscalMemory),
                                                               new StateInstance(Continue)));
                break;

            case PosMessage.MENU_START_FM_TEST:
                cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.START_FM_TEST,
                                                               new StateInstance(StartFMTest),
                                                               new StateInstance(Continue)));
                break;

            case PosMessage.MENU_EXTERNAL_DEV_SETTINGS:
                defPort  = 4444;
                cr.State = EnterIP.Instance(PosMessage.TCP_IP_ADDRESS,
                                            GetIPAddress(),
                                            new StateInstance <String>(SetIPAddress),
                                            new StateInstance(Continue));
                break;

            case PosMessage.MENU_LOGO:
                cr.State = ShowLogoMenu();
                break;

            case PosMessage.MENU_VAT_RATES:
                cr.State = ShowTaxRatesMenu();
                break;

            case PosMessage.MENU_PRINT_LOGS:
                cr.State = EnterString.Instance("FORMAT: ddMMyyyy",
                                                DateTime.Now.ToString("ddMMyyyy"),
                                                new StateInstance <String>(PrintLogs),
                                                new StateInstance(Continue));
                break;

            case PosMessage.MENU_CREATE_DB:
                cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.CREATE_DB,
                                                               new StateInstance(CreateDB),
                                                               new StateInstance(Continue)));
                break;

            case PosMessage.MENU_UPDATE_FIRMWARE:
                cr.State = EnterIP.Instance(PosMessage.TCP_IP_ADDRESS,
                                            GetIPAddress(),
                                            new StateInstance <String>(SetIPAddress),
                                            new StateInstance(Continue));
                break;

            case PosMessage.MENU_EXIT_SERVICE:
                lastPassword = "";
                cr.State     = EnterPassword.Instance(PosMessage.SERVICE_PASSWORD,
                                                      new StateInstance <String>(ExitService),
                                                      new StateInstance(PrinterBlockingError.Instance));
                break;
            }
        }
 public override void Quantity()
 {
     cr.State = ConfirmCashier.Instance(new Confirm(PosMessage.CONFIRM_NEW_EJ_FORMAT,
                                                    new StateInstance(FormatJournal),
                                                    new StateInstance(Instance)));
 }