예제 #1
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();
         }
     }
 }
예제 #2
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 = "";
                        }
                    }
                }
            }
        }