private void PurchaseForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt && e.KeyCode == Keys.Q)
            {
                QuantityField.Focus();
            }

            if (e.Alt && e.KeyCode == Keys.P)
            {
                ProductList.Focus();
            }

            if (e.Alt && e.KeyCode == Keys.X)
            {
                clearFields();
            }

            if (e.Alt && e.KeyCode == Keys.S)
            {
                subTotal();
            }

            if (e.Alt && e.KeyCode == Keys.C)
            {
                RecordSale(0, "Cash");
            }

            if (e.Alt && e.KeyCode == Keys.H)
            {
                RecordSale(1, "Cash");
            }

            if (e.Alt && e.KeyCode == Keys.B)
            {
                BarCodeField.Focus();
            }

            if (e.Alt && e.KeyCode == Keys.Enter)
            {
                AddItemToCart();
            }

            if (e.Alt && e.KeyCode == Keys.D)
            {
                TotalDiscountField.Focus();
            }

            if (e.Alt && e.KeyCode == Keys.T)
            {
                TaxAppliedField.Focus();
            }

            if (e.Alt && e.KeyCode == Keys.A)
            {
                AmountPaidField.Focus();
            }
        }
 public void InputProductIformation(String sku, String priceType, String quantity)
 {
     SkuField.SendKeys(sku);
     Thread.Sleep(500);
     PriceTypeField.Clear();
     PriceTypeField.SendKeys(priceType);
     QuantityField.Clear();
     QuantityField.SendKeys(quantity);
     UpdateButton.Click();
     NextButton.Click();
 }
Exemple #3
0
        /// <summary>
        /// Represents one item in a sensor data readout.
        /// </summary>
        /// <param name="Field">Sensor data field.</param>
        public FieldItem(Field Field)
            : base(Colors.Black, Colors.White)
        {
            this.field         = Field;
            this.quantityField = Field as QuantityField;

            FieldQoS QoS = Field.QoS;

            if (QoS.HasFlag(FieldQoS.InvoiceConfirmed) || QoS.HasFlag(FieldQoS.Invoiced))
            {
                this.BackgroundColor = Colors.Gold;
            }
            else if (QoS.HasFlag(FieldQoS.EndOfSeries))
            {
                this.BackgroundColor = Colors.LightBlue;
            }
            else if (QoS.HasFlag(FieldQoS.Signed))
            {
                this.BackgroundColor = Colors.LightGreen;
            }
            else if (QoS.HasFlag(FieldQoS.Error))
            {
                this.BackgroundColor = Colors.LightPink;
            }
            else if (QoS.HasFlag(FieldQoS.PowerFailure) || QoS.HasFlag(FieldQoS.TimeOffset) || QoS.HasFlag(FieldQoS.Warning))
            {
                this.BackgroundColor = Colors.LightYellow;
            }
            else if (QoS.HasFlag(FieldQoS.Missing) || QoS.HasFlag(FieldQoS.InProgress))
            {
                this.BackgroundColor = Colors.LightGray;
            }
            else if (QoS.HasFlag(FieldQoS.AutomaticEstimate) || QoS.HasFlag(FieldQoS.ManualEstimate))
            {
                this.BackgroundColor = Colors.WhiteSmoke;
            }
        }
        private void CalcMomentary(List <Field> Fields, DateTime Now, ushort Raw)
        {
            Fields.Add(new Int32Field(this, Now, "Raw", Raw, FieldType.Momentary, FieldQoS.AutomaticReadout, typeof(Module).Namespace, 26));

            if (this.exp is null && !string.IsNullOrEmpty(this.expression))
            {
                this.exp = new Expression(this.expression);
            }

            if (this.exp != null)
            {
                Variables v = new Variables()
                {
                    { "Raw", (double)Raw }
                };

                object Value = this.exp.Evaluate(v);
                Field  F;

                if (Value is double dbl)
                {
                    F = new QuantityField(this, Now, this.fieldName, dbl, this.nrDecimals, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is PhysicalQuantity qty)
                {
                    F = new QuantityField(this, Now, this.fieldName, qty.Magnitude, this.nrDecimals, qty.Unit.ToString(), FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is bool b)
                {
                    F = new BooleanField(this, Now, this.fieldName, b, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is DateTime DT)
                {
                    F = new DateTimeField(this, Now, this.fieldName, DT, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is Duration D)
                {
                    F = new DurationField(this, Now, this.fieldName, D, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is Enum E)
                {
                    F = new EnumField(this, Now, this.fieldName, E, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is int i32)
                {
                    if (string.IsNullOrEmpty(this.unit))
                    {
                        F = new Int32Field(this, Now, this.fieldName, i32, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                    else
                    {
                        F = new QuantityField(this, Now, this.fieldName, i32, 0, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                }
                else if (Value is long i64)
                {
                    if (string.IsNullOrEmpty(this.unit))
                    {
                        F = new Int64Field(this, Now, this.fieldName, i64, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                    else
                    {
                        F = new QuantityField(this, Now, this.fieldName, i64, 0, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                }
                else if (Value is string s)
                {
                    F = new StringField(this, Now, this.fieldName, s, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is TimeSpan TS)
                {
                    F = new TimeField(this, Now, this.fieldName, TS, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else
                {
                    F = new StringField(this, Now, this.fieldName, Value.ToString(), FieldType.Momentary, FieldQoS.AutomaticReadout);
                }

                if (this.fieldName == "Value")
                {
                    F.Module        = typeof(Module).Namespace;
                    F.StringIdSteps = new LocalizationStep[] { new LocalizationStep(13) };
                }

                Fields.Add(F);
            }
        }