Пример #1
0
 void tbItemParamKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         int nNo = Convert.ToInt32(((TextBox)sender).AccessibleDescription);
         if (cItemType[nNo].SelectedIndex == 0)
         {
             frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
             fsfi.ShowDialog();
             if (fsfi.GetItemBarcode() != "NONE_SELECTED")
             {
                 ((TextBox)sender).Text = fsfi.GetItemBarcode();
             }
         }
         else if (cItemType[nNo].SelectedIndex == 1)
         {
             frmCategorySelect fCats = new frmCategorySelect(ref sEngine);
             fCats.ShowDialog();
             if (fCats.SelectedItemCategory != "$NULL")
             {
                 ((TextBox)sender).Text = fCats.SelectedItemCategory;
             }
         }
     }
 }
Пример #2
0
        void F5Click(object sender, EventArgs e)
        {
            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();
                }
            }
        }
Пример #3
0
        void F7Click(object sender, EventArgs e)
        {
            frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);

            fsfi.ShowDialog();
            if (fsfi.GetItemBarcode() != "NONE_SELECTED")
            {
                InputTextBox("GETCODE").Text = fsfi.GetItemBarcode();
                Barcode = fsfi.GetItemBarcode();
                this.Close();
            }
        }
 void BarcodeKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             InputTextBox("BARCODE").Text = fsfi.GetItemBarcode();
             InputTextBox("QTY").Focus();
         }
     }
 }
Пример #5
0
 void BarcodeKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             InputTextBox("BARCODE").Text = fsfi.GetItemBarcode();
             // Move cursor to the end
             ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Length;
         }
     }
 }
Пример #6
0
 void F6Click(object sender, EventArgs e)
 {
     // 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();
         }
     }
 }
Пример #7
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();
     }
 }
Пример #8
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);
            }
        }
Пример #9
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();
         }
     }
 }
Пример #10
0
 void dGrid_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F3 && !bF3Registered)
     {
         bF5Registered     = false;
         bEscapeRegistered = false;
         bF3Registered     = true;
         frmSingleInputBox fsfiGetOriginal = new frmSingleInputBox("Where the " + dGrid.Columns[dGrid.SelectedCells[0].ColumnIndex].Name + " is currently...", ref sEngine);
         fsfiGetOriginal.tbResponse.Text = dGrid.CurrentCell.Value.ToString();
         fsfiGetOriginal.ShowDialog();
         if (fsfiGetOriginal.Response != "$NONE")
         {
             frmSingleInputBox fsfiGetNew = new frmSingleInputBox("Change the " + dGrid.Columns[dGrid.SelectedCells[0].ColumnIndex].Name + " from " + fsfiGetOriginal.Response + " to...", ref sEngine);
             fsfiGetNew.ShowDialog();
             if (fsfiGetNew.Response != "$NONE")
             {
                 bool bNoneConverted = false;
                 while (!bNoneConverted) // Has to be done otherwise the grid sorts elements as it's changing them and ends up missing some
                 {
                     bNoneConverted = true;
                     for (int i = 0; i < dGrid.Rows.Count; i++)
                     {
                         if (dGrid.SelectedCells[0].ColumnIndex != 4 && dGrid.SelectedCells[0].ColumnIndex != 8 && dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString() == fsfiGetOriginal.Response)
                         {
                             dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].Value = fsfiGetNew.Response;
                             bNoneConverted = false;
                             //i = 0;
                         }
                         else if ((dGrid.SelectedCells[0].ColumnIndex == 4 || dGrid.SelectedCells[0].ColumnIndex == 8) && dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString() != "" && Convert.ToDecimal(dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].FormattedValue.ToString()).Equals(Convert.ToDecimal(fsfiGetOriginal.Response)))
                         {
                             dGrid.Rows[i].Cells[dGrid.SelectedCells[0].ColumnIndex].Value = ScalableForm.FormatMoneyForDisplay(fsfiGetNew.Response);
                             bNoneConverted = false;
                             //i = 0;
                         }
                     }
                 }
             }
         }
     }
     else if (e.KeyCode == Keys.Escape && ((dGrid.CurrentCell != null && !dGrid.CurrentCell.IsInEditMode && !bEscapeRegistered) || (bEscapeRegistered && (nRowEscRegistered != dGrid.CurrentCell.RowIndex) || (nColumnEscRegistered != dGrid.CurrentCell.ColumnIndex))))// && lastKey != Keys.Escape)
     {
         bEscapeRegistered    = true;
         nColumnEscRegistered = dGrid.CurrentCell.ColumnIndex;
         nRowEscRegistered    = dGrid.CurrentCell.RowIndex;
         bF5Registered        = false;
         bF3Registered        = false;
         AskToSave();
     }
     else if (dGrid.CurrentCell.ColumnIndex == 2 && e.KeyCode == Keys.F5 && !bShowingType && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         bShowingType      = true;
         frmListOfItemTypes flot = new frmListOfItemTypes();
         flot.SelectedItemType = Convert.ToInt32(dGrid.CurrentCell.Value.ToString());
         flot.ShowDialog();
         if (flot.SelectedItemType != -1)
         {
             dGrid.CurrentCell.Value = flot.SelectedItemType.ToString();
         }
         bShowingType = false;
         e.Handled    = true;
     }
     else if (dGrid.CurrentCell.ColumnIndex == 3 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmCategorySelect fcs = new frmCategorySelect(ref sEngine);
         fcs.ShowDialog();
         if (fcs.SelectedItemCategory != "$NULL")
         {
             dGrid.CurrentCell.Value = fcs.SelectedItemCategory;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 5 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmListOfVATRates flov = new frmListOfVATRates(ref sEngine);
         flov.ShowDialog();
         if (flov.sSelectedVATCode != "NULL")
         {
             dGrid.CurrentCell.Value = flov.sSelectedVATCode;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 7 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmListOfSuppliers flos = new frmListOfSuppliers(ref sEngine);
         flos.ShowDialog();
         if (flos.sSelectedSupplierCode != "NULL")
         {
             dGrid.CurrentCell.Value = flos.sSelectedSupplierCode;
         }
     }
     else if (dGrid.CurrentCell.ColumnIndex == 10 && e.KeyCode == Keys.F5 && !bF5Registered)
     {
         bEscapeRegistered = false;
         bF5Registered     = true;
         bF3Registered     = false;
         frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
         fsfi.ShowDialog();
         if (fsfi.GetItemBarcode() != "NONE_SELECTED")
         {
             dGrid.CurrentCell.Value = fsfi.GetItemBarcode();
         }
     }
     else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Left)
     {
         bF3Registered     = false;
         bF5Registered     = false;
         bEscapeRegistered = false;
     }
     else if (e.KeyCode == Keys.Enter)
     {
         e.Handled = true;
     }
 }
Пример #11
0
        void tbResponse_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (tbResponse.Text == "")
                {
                    Response = "$NONE";
                }
                else
                {
                    Response = tbResponse.Text;

                    if (!GettingCategory && lblQuestion.Text.Contains("parent"))
                    {
                        if (this.ShopCode != null && sEngine.GetItemStockStaRecord(tbResponse.Text, this.ShopCode).Length < 3) // ie Item doesn't exist
                        {
                            frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                            fsfi.CheckForPartialBarcodeFromScanner(tbResponse.Text, false);
                            fsfi.ShowDialog();
                            if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                            {
                                tbResponse.Text = fsfi.GetItemBarcode();
                                Response        = tbResponse.Text;
                            }
                            else
                            {
                                Response = "$NONE";
                            }
                        }
                    }
                }
                this.Close();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                tbResponse.Text = "";
                Response        = "$NONE";
                this.Close();
            }
            else if (e.KeyCode == Keys.F5)
            {
                // Parent one means that when looking for a parent item, categories will appear
                // Request from Jim
                if (!GettingCategory && !lblQuestion.Text.Contains("parent"))
                {
                    frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                    if (ProductLookupHelp != "")
                    {
                        fsfi.CheckForPartialBarcodeFromScanner(ProductLookupHelp, false);
                    }
                    fsfi.ShowDialog();
                    if (fsfi.GetItemBarcode() != "NONE_SELECTED")
                    {
                        tbResponse.Text = fsfi.GetItemBarcode();
                        Response        = tbResponse.Text;
                        this.Close();
                    }
                }
                else
                {
                    frmCategorySelect fCat = new frmCategorySelect(ref sEngine);
                    fCat.ShowDialog();
                    if (fCat.SelectedItemCategory != "$NULL")
                    {
                        frmSearchForItemV2 fsfi = new frmSearchForItemV2(ref sEngine);
                        fsfi.SetSearchTerm("CAT:" + fCat.SelectedItemCategory);
                        fsfi.ShowDialog();
                        if (!fsfi.GetItemBarcode().Equals("NONE_SELECTED"))
                        {
                            tbResponse.Text = fsfi.GetItemBarcode();
                        }
                        else
                        {
                            tbResponse.Text = "";
                        }
                    }
                }
            }
        }