Beispiel #1
0
 /// <summary>
 /// Add fiscal item to document list.
 /// </summary>
 /// <param name="doc">
 /// Current document list.
 /// </param>
 /// <param name="item">
 /// Item that will be added.
 /// </param>
 public override void AddItem(SalesDocument doc, FiscalItem item)
 {
     doc.State = DocumentOpen.Instance();
     doc.State.AddItem(doc, item);
 }
Beispiel #2
0
        public static IState Instance()
        {
            if (cr.Printer == null)
            {
                Chassis.RestartProgram(false);
            }
            if (cr.CurrentCashier == null || cr.CurrentManager == null)
            {
                return(Login.Instance());
            }
            if (cr.Document.Status == DocumentStatus.Paying)
            {
                return(Payment.Continue());
            }
            if (cr.Document.State == DocumentPaying.Instance())
            {
                return(Payment.Continue());
            }
            if (cr.Document.Adjustments.Length != 0)
            {
                decimal total = 0;
                for (int adj = 0; adj < cr.Document.Adjustments.Length; adj++)
                {
                    total += cr.Document.Adjustments[adj].NetAmount;
                }
                if (total != 0)
                {
                    return(Payment.Continue());
                }
            }
            cr.Document.State = DocumentOpen.Instance();
            //Turn off satis var led
            if (cr.Document.IsEmpty)
            {
                DisplayAdapter.Cashier.LedOff(Leds.Sale);
            }
            //Turn off customer led
            if (cr.Document.Customer == null)
            {
                DisplayAdapter.Cashier.LedOff(Leds.Customer);
            }
            //Show main menu to cashier and customer

            //check name if length bigger-smaller than 14
            String name = cr.CurrentCashier.Name;

            if (name.Length > 14)
            {
                name = name.Substring(0, 14);
            }

            System.Threading.Thread.Sleep(100);
            DisplayAdapter.Cashier.Show(cashierMsg, cr.Document.Name, DateTime.Now, name);
            DisplayAdapter.Customer.Show(PosMessage.WELCOME);
            cr.Printer.ClearDisplay();

            if (cr.Item != null)
            {
                cr.Item.Reset();
            }
            if (cr.Item is VoidItem)
            {
                cr.Item = new SalesItem();
            }
            Payment.ResetPayment();
#if ORDER
            if (!cr.Document.IsEmpty && cr.Document.ReturnReason == "WAITING_FOR_PAYMENT")
            {
                /*DisplayAdapter.Cashier.Show("ÖDEME BEKLENİYOR..");
                 * System.Threading.Thread.Sleep(2000);
                 * return Selling.CloseOrder();*/

                // Çıkış için document iptal edilebilir, çıkış fonk VoidLastOrder eklenebilir
                cr.Document.ReturnReason = null;
                return(States.AlertCashier.Instance(new Confirm(PosMessage.WAITING_PAYMENT, new StateInstance(Selling.CloseOrder))));
            }
            else if (!cr.Document.IsEmpty)
            {
                return(Selling.Instance());
            }
            else
            {
                return(state);
            }
#else
            return(cr.Document.IsEmpty ? state : Selling.Instance());
#endif
        }