Exemplo n.º 1
0
 void frmGetBarcode_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Barcode = InputTextBox("GETCODE").Text;
         if (sEngine.GetMainStockInfo(Barcode)[0] == null && InputTextBox("GETCODE").Text != "")
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner(Barcode, true);
             if (!fsfi.FoundScannerResults)
             {
                 if (MessageBox.Show("This item doesn't exist! Would you like to create it?", "Not found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     Barcode = "";
                     frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                     faei.AddingBarcode = InputTextBox("GETCODE").Text;
                     faei.ShowDialog();
                     faei.Dispose();
                     InputTextBox("GETCODE").Focus();
                 }
                 else
                 {
                     InputTextBox("GETCODE").Text = "";
                     InputTextBox("GETCODE").Focus();
                     Barcode = "";
                 }
             }
             else
             {
                 fsfi.Hide();
                 fsfi.ShowDialog();
                 if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                 {
                     InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                     InputTextBox("GETCODE").Focus();
                     Barcode = fsfi.GetItemBarcode();
                     this.Close();
                 }
                 else
                 {
                     InputTextBox("GETCODE").Focus();
                 }
             }
         }
         else
         {
             this.Close();
         }
     }
     else if (e.KeyCode == Keys.F5)
     {
         // Show categories
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         string sSelectedCategory = fcs.SelectedItemCategory;
         if (sSelectedCategory != "$NULL")
         {
             LastCategory = sSelectedCategory;
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner("CAT:" + sSelectedCategory);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                 Barcode = fsfi.GetItemBarcode();
                 fsfi.Dispose();
                 this.Close();
             }
             else
             {
                 fsfi.Dispose();
             }
         }
     }
     else if (e.KeyCode == Keys.F6)
     {
         // Show last category
         LastCategory = sEngine.LastCategoryCode;
         if (LastCategory != "")
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.CheckForPartialBarcodeFromScanner("CAT:" + LastCategory);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                 Barcode = fsfi.GetItemBarcode();
                 fsfi.Dispose();
                 this.Close();
             }
             else
             {
                 fsfi.Dispose();
             }
         }
     }
     else if (e.KeyCode == Keys.F7)
     {
         // Description search
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
             Barcode = fsfi.GetItemBarcode();
             this.Close();
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         InputTextBox("GETCODE").Text = "";
         Barcode = "";
         this.Close();
     }
 }
Exemplo n.º 2
0
        void BarcodeKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (((STextBox)sender).Text == "")
                {
                    switch (MessageBox.Show("Finished entering items?", "Calculate Prices?", MessageBoxButtons.YesNoCancel))
                    {
                    case DialogResult.Yes:
                        GetInfoAndCalculatePrices();
                        break;

                    case DialogResult.No:
                        tbBarcode[0].Focus();
                        break;
                    }
                }
                else
                {
                    // Check to see if item exists
                    if (sEngine.GetMainStockInfo(tbBarcode[((STextBox)sender).nRowNum].Text).Length > 1)
                    {
                        DisplayItemInfo(((STextBox)sender).nRowNum);
                    }

                    else
                    {
                        if (MessageBox.Show("Item doesn't exist! Add it now?", "Add Item?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                            faei.AddingBarcode = ((STextBox)sender).Text;
                            faei.ShowDialog();
                        }
                        ((STextBox)sender).Text = "";
                    }
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                fsfi.ShowDialog();
                if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                {
                    ((STextBox)sender).Text = fsfi.GetItemBarcode();
                    BarcodeKeyDown(sender, new KeyEventArgs(Keys.Enter));
                }
            }
            else if (e.KeyCode == Keys.F2)
            {
                MoveToLine();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                if (MessageBox.Show("Would you like to quit, discarding any changes?", "Quit?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    this.Close();
                }
            }
            else if (e.KeyCode == Keys.Delete && e.Shift)
            {
                RemoveRow(((STextBox)sender).nRowNum);
            }
        }
Exemplo n.º 3
0
        void frmDetailedItemEnquiry_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                if (!bJustEscd)
                {
                    this.Close();
                }
                else
                {
                    bJustEscd = false;
                }
            }
            else
            {
                switch (InputTextBox("INPUT").Text.ToUpper())
                {
                case "A":
                    frmGetBarcode fgb = new frmGetBarcode(ref sEngine);
                    fgb.LastCategory = sItemCategory;
                    fgb.ShowDialog();
                    if (fgb.Barcode != "" && fgb.Barcode != null)
                    {
                        sBarcode = fgb.Barcode;
                        ShowStatsAboutProduct();
                        fgb.Dispose();
                    }
                    break;

                case "E":
                    frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                    faei.EditingBarcode = sBarcode;
                    faei.ShowDialog();
                    faei.Dispose();
                    this.ShowStatsAboutProduct();
                    bJustEscd = true;
                    break;

                case "Q":
                    this.Close();
                    break;

                case "O":
                    frmOrdersWithItemIn fowii = new frmOrdersWithItemIn(ref sEngine, sBarcode);
                    fowii.ShowDialog();
                    this.ShowStatsAboutProduct();
                    bJustEscd = true;
                    break;

                case "I":
                    if (ForAnOrder)
                    {
                        ItemAdded = true;
                        this.Close();
                    }
                    break;

                case "R":
                    if (sMainStock[5] == "1")
                    {
                        sEngine.AddSuggestedOrderItem(sBarcode, sShopCode);
                        MessageBox.Show("Item has been suggested!");
                    }
                    else
                    {
                        MessageBox.Show("Sorry, only type 1 items can be ordered!");
                    }
                    break;

                case "S":
                    frmSuppliersForItem fsfi = new frmSuppliersForItem(ref sEngine, sBarcode);
                    fsfi.ShowDialog();
                    bJustEscd = true;
                    break;

                case "V":
                    frmListOfSales flos = new frmListOfSales(ref sEngine, sBarcode);
                    flos.ShowDialog();
                    bJustEscd = true;
                    break;
                }
                InputTextBox("INPUT").Text = "";
            }
        }
Exemplo n.º 4
0
 void BarcodeInputKeyDown(object sender, KeyEventArgs e)
 {
     // Check to see if item exists as a single product
     if (e.KeyCode == Keys.Enter)
     {
         if (sEngine.GetItemStockStaRecord(InputTextBox("BARCODEINPUT").Text, InputTextBox("SHOPCODEINPUT").Text).Length > 1)
         {
             if (MessageBox.Show("Item already exists as a single product! Edit that instead?", "Already Exists!", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 frmAddEditItem faei = new frmAddEditItem(ref sEngine);
                 faei.EditingBarcode = InputTextBox("BARCODEINPUT").Text;
                 faei.ShowDialog();
                 this.Close();
             }
             else
             {
                 this.Close();
             }
         }
         // Check to see if it exists as a multi-item item
         if (sEngine.DoesMultiItemExist(InputTextBox("BARCODEINPUT").Text, InputTextBox("SHOPCODEINPUT").Text))
         {
             this.Text = "Multi-Item Item Editing";
             string[]  sBarcodes   = new string[0];
             decimal[] dQuantities = new decimal[0];
             decimal[] dRRP        = new decimal[0];
             string    sDesc       = "";
             sEngine.GetMultiItemInfo(InputTextBox("SHOPCODEINPUT").Text, InputTextBox("BARCODEINPUT").Text, ref sDesc, ref sBarcodes, ref dQuantities, ref dRRP);
             InputTextBox("DESCINPUT").Text = sDesc;
             for (int i = 0; i < sBarcodes.Length; i++)
             {
                 AddRow();
                 tbBarcode[i].Text = sBarcodes[i];
                 DisplayItemInfo(i);
                 tbQty[i].Text          = FormatMoneyForDisplay(dQuantities[i]);
                 tbMarginOrRRP[i].Text  = "R";
                 tbTargetMargin[i].Text = FormatMoneyForDisplay(dRRP[i]);
             }
             InputTextBox("DESCINPUT").Focus();
             InputTextBox("DESCINPUT").SelectionStart = sDesc.Length;
         }
     }
     else if (e.KeyCode == Keys.F5)
     {
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.SetSearchTerm("TYPE:6");
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             InputTextBox("BARCODEINPUT").Text = fsfi.GetItemBarcode();
             SendKeys.Send("{ENTER}");
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         if (MessageBox.Show("Would you like to quit, discarding any changes?", "Quit?", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             this.Close();
         }
     }
 }