Ejemplo n.º 1
0
 void ShopCodeKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmListOfShops fListOfshops = new frmListOfShops(ref sEngine);
         fListOfshops.ShowDialog();
         if (fListOfshops.SelectedShopCode != "$NONE")
         {
             sShopCode = fListOfshops.SelectedShopCode;
             InputTextBox("SHOP_CODE").Text = sShopCode;
             LoadSettings();
             InputTextBox("SHOP_NAME").Focus();
         }
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (InputTextBox("SHOP_CODE").Text != "")
         {
             sShopCode = InputTextBox("SHOP_CODE").Text;
             LoadSettings();
             InputTextBox("SHOP_NAME").Focus();
         }
         else
         {
             this.Close();
         }
     }
 }
        public frmPayForCommissionItem(ref StockEngine sEngine)
        {
            // Get the barcode of the commission item
            frmSingleInputBox fsfiGetCode = new frmSingleInputBox("Enter the Barcode of the commission item. Press F5 to look up:", ref sEngine);

            fsfiGetCode.ShowDialog();
            if (fsfiGetCode.Response != "$NONE")
            {
                frmSingleInputBox fsfiGetQtySold = new frmSingleInputBox("Enter the quantity of items that you are paying for:", ref sEngine);
                fsfiGetQtySold.ShowDialog();
                if (fsfiGetQtySold.Response != "$NONE")
                {
                    decimal dQtyPaid = -1;
                    try
                    {
                        dQtyPaid = Convert.ToDecimal(fsfiGetQtySold.Response);
                    }
                    catch
                    {
                        System.Windows.Forms.MessageBox.Show("Invalid number entered.");
                        return;
                    }
                    frmSingleInputBox fGetAmount = new frmSingleInputBox("Enter the total amount that you paid for the items:", ref sEngine);
                    fGetAmount.ShowDialog();
                    if (fGetAmount.Response != "$NONE")
                    {
                        decimal dAmountPaid = -1;
                        try
                        {
                            dAmountPaid = Convert.ToDecimal(fGetAmount.Response);
                        }
                        catch
                        {
                            System.Windows.Forms.MessageBox.Show("Invalid amount entered.");
                            return;
                        }
                        frmListOfShops flos = new frmListOfShops(ref sEngine);
                        flos.ShowDialog();
                        if (flos.SelectedShopCode != "$NONE")
                        {
                            // Code here to straighten out the stock files
                            if (sEngine.MarkCommissionItemAsPaid(fsfiGetCode.Response, dQtyPaid, dAmountPaid, flos.SelectedShopCode))
                            {
                                System.Windows.Forms.MessageBox.Show(dQtyPaid.ToString() + " " + sEngine.GetMainStockInfo(fsfiGetCode.Response)[1] + " paid for at a total of " + dAmountPaid.ToString());
                            }
                            else
                            {
                                System.Windows.Forms.MessageBox.Show("Unfortunately the items couldn't be paid for. This could be because the total you've ever received is less than the total you're trying to pay for");
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
        }
        public AddMultiBarcodeItem(ref StockEngine sEngine)
        {
            frmSingleInputBox fsiGetBarcode = new frmSingleInputBox("Enter the barcode for the new multi-barcode item", ref sEngine);

            fsiGetBarcode.ShowDialog();
            if (fsiGetBarcode.Response != "$NONE")
            {
                Barcode = fsiGetBarcode.Response;
                frmSingleInputBox fsiGetDesc = new frmSingleInputBox("Enter the description for the new multi-barcode item", ref sEngine);
                fsiGetDesc.ShowDialog();
                if (fsiGetDesc.Response != "$NONE")
                {
                    frmListOfShops flos = new frmListOfShops(ref sEngine);
                    flos.ShowDialog();
                    frmListOfTills flot = new frmListOfTills(ref sEngine, flos.SelectedShopCode);
                    flot.ShowDialog();
                    System.Windows.Forms.MessageBox.Show("When the till is free, it will temporarily move to this computer. Enter the number 0 as your ID, and enter the transaction as you would like it to appear when you enter " + fsiGetBarcode.Response + " at the till. Then press the space bar and the till program will quit back to this", "Instructions", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    sEngine.RunTillSoftware();
                    string[] sData    = sEngine.GetStoredTransactionFromTill(Convert.ToInt32(flot.sSelectedTillCode));
                    int      nOfLines = 0;
                    foreach (string line in sData)
                    {
                        if (line.Contains(','))
                        {
                            nOfLines++;
                        }
                    }
                    string[]  sBarcodes      = new string[nOfLines];
                    decimal[] dQuantities    = new decimal[nOfLines];
                    decimal[] dAmountPerItem = new decimal[nOfLines];

                    for (int i = 0; i < nOfLines; i++)
                    {
                        string[] sTemp = sData[i].Split(',');
                        sBarcodes[i]      = sTemp[0];
                        dQuantities[i]    = Convert.ToDecimal(sTemp[1]);
                        dAmountPerItem[i] = Convert.ToDecimal(sTemp[2]) / dQuantities[i];
                    }

                    sEngine.AddMultiItemItem(fsiGetBarcode.Response, fsiGetDesc.Response, flos.SelectedShopCode, sBarcodes, dQuantities, dAmountPerItem);

                    if (System.Windows.Forms.MessageBox.Show("Upload changes to all tills now?", "Upload?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        sEngine.CopyWaitingFilesToTills();
                    }
                }
                else
                {
                    Barcode = "$NULL";
                }
            }
            else
            {
                Barcode = "$NULL";
            }
        }
Ejemplo n.º 4
0
        void ShopCodeGotFocus(object sender, EventArgs e)
        {
            frmListOfShops flos = new frmListOfShops(ref sEngine);

            while (flos.SelectedShopCode == "$NONE" && !bShopSelectOpen)
            {
                bShopSelectOpen = true;
                flos.ShowDialog();
            }
            InputTextBox("SHOPCODE").Text = flos.SelectedShopCode;
            InputTextBox("ORDERNUM").Focus();
        }
Ejemplo n.º 5
0
 void ToKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         frmListOfShops flos = new frmListOfShops(ref sEngine);
         flos.ShowDialog();
         if (flos.SelectedShopCode != "$NONE")
         {
             InputTextBox("TO").Text = flos.SelectedShopCode;
             InputTextBox("BARCODE").Focus();
         }
     }
 }
Ejemplo n.º 6
0
 void FromGotFocus(object sender, EventArgs e)
 {
     if (!bShowingShops)
     {
         bShowingShops = true;
         frmListOfShops flos = new frmListOfShops(ref sEngine);
         while (flos.SelectedShopCode == "$NONE")
         {
             flos.ShowDialog();
         }
         InputTextBox("FROM").Text = flos.SelectedShopCode;
         InputTextBox("TO").Focus();
     }
 }
Ejemplo n.º 7
0
 void ShopCodeGotFocus(object sender, EventArgs e)
 {
     if (InputTextBox("SHOPCODEINPUT").Text.Length == 0 && !bShopCodeOpen)
     {
         frmListOfShops flos = new frmListOfShops(ref sEngine);
         bShopCodeOpen = true;
         while (flos.SelectedShopCode == "$NONE")
         {
             flos.ShowDialog();
         }
         InputTextBox("SHOPCODEINPUT").Text = flos.SelectedShopCode;
         InputTextBox("BARCODEINPUT").Focus();
         bShopCodeOpen = false;
     }
 }
Ejemplo n.º 8
0
        public frmDetailedItemEnquiry(ref StockEngine se, string sItemToShow)
        {
            sEngine = se;
            frmListOfShops flos = new frmListOfShops(ref sEngine);

            while (flos.SelectedShopCode == "$NONE")
            {
                flos.ShowDialog();
            }
            sShopCode  = flos.SelectedShopCode;
            sBarcode   = sItemToShow;
            sStockStat = sEngine.GetItemStockStaRecord(sBarcode, sShopCode);
            sMainStock = sEngine.GetMainStockInfo(sBarcode);
            FillInBlanks(sStockStat);
            FillInBlanks(sMainStock);
            SetupForm();
            this.Paint          += new PaintEventHandler(frmDetailedItemEnquiry_Paint);
            this.WindowState     = FormWindowState.Maximized;
            this.VisibleChanged += new EventHandler(frmDetailedItemEnquiry_VisibleChanged);
            this.Text            = "Detailed Item Enquiry";
        }
Ejemplo n.º 9
0
        public frmAddEditStaff(ref StockEngine se)
        {
            sEngine = se;

            this.AllowScaling = false;
            this.Size         = new Size(300, 360);

            frmListOfShops flos = new frmListOfShops(ref sEngine);

            flos.ShowDialog();
            if (flos.SelectedShopCode != "$NONE")
            {
                sShopCode = flos.SelectedShopCode;
            }

            AddMessage("NUM", "ID Number", new Point(10, 10));
            lbNumbers                       = new CListBox();
            lbNumbers.Location              = new Point(10, 40);
            lbNumbers.Size                  = new Size(75, this.ClientSize.Height - 10 - lbNumbers.Top);
            lbNumbers.BorderStyle           = BorderStyle.None;
            lbNumbers.KeyDown              += new KeyEventHandler(lbKeyDown);
            lbNumbers.SelectedIndexChanged += new EventHandler(lbSelectedChanged);
            this.Controls.Add(lbNumbers);

            AddMessage("NAME", "Staff Name", new Point(85, 10));
            lbStaff                       = new CListBox();
            lbStaff.Location              = new Point(85, 40);
            lbStaff.Size                  = new Size(200, this.ClientSize.Height - 10 - lbNumbers.Top);
            lbStaff.BorderStyle           = BorderStyle.None;
            lbStaff.KeyDown              += new KeyEventHandler(lbKeyDown);
            lbStaff.SelectedIndexChanged += new EventHandler(lbSelectedChanged);
            this.Controls.Add(lbStaff);

            this.VisibleChanged += new EventHandler(frmAddEditStaff_VisibleChanged);
            this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            this.Text            = "Edit Staff";
        }