예제 #1
0
 void lbKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         frmSingleInputBox fsiGetName = new frmSingleInputBox("Enter the name of staff member " + lbNumbers.Items[((ListBox)sender).SelectedIndex].ToString(), ref sEngine);
         fsiGetName.tbResponse.Text = lbStaff.Items[((ListBox)sender).SelectedIndex].ToString();
         fsiGetName.ShowDialog();
         if (fsiGetName.Response != "$NONE")
         {
             lbStaff.Items[((ListBox)sender).SelectedIndex] = fsiGetName.Response;
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         if (MessageBox.Show("Would you like to save the changes?", "Save Changes?", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             string[] sToAdd = new string[lbStaff.Items.Count];
             for (int i = 0; i < sToAdd.Length; i++)
             {
                 sToAdd[i] = lbStaff.Items[i].ToString();
             }
             sEngine.SaveListOfStaffMembers(sToAdd, sShopCode);
             if (MessageBox.Show("Upload changes to all tills now?", "Upload?", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 sEngine.CopyWaitingFilesToTills();
             }
             this.Close();
         }
         else
         {
             this.Close();
         }
     }
 }
예제 #2
0
 void Save()
 {
     sEngine.SetPassword(1, InputTextBox("LVL1").Text);
     sEngine.SetPassword(2, InputTextBox("LVL2").Text);
     sEngine.GenerateDetailsForAllTills();
     sEngine.CopyWaitingFilesToTills();
 }
 void frmAddEditOffers_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBox.Show("Upload changes to all tills?", "Upload?", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         sEngine.CopyWaitingFilesToTills();
     }
 }
        void AskAndQuit()
        {
            switch (MessageBox.Show("Would you like to save any changes?", "Save Changes", MessageBoxButtons.YesNoCancel))
            {
            case DialogResult.Yes:
                string[] sCardNames   = new string[tbCards.Length];
                string[] sListOfDiscs = new string[tbDisc.Length];
                for (int i = 0; i < sCardNames.Length; i++)
                {
                    sCardNames[i]   = tbCards[i].Text;
                    sListOfDiscs[i] = tbDisc[i].Text;
                }
                sEngine.ListOfCards = sCardNames;
                sEngine.SetListOfCardDiscs(sListOfDiscs);
                if (MessageBox.Show("Would you like to upload any changes to all tills now?", "Upload now?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    sEngine.CopyWaitingFilesToTills();
                }
                this.Close();
                break;

            case DialogResult.No:
                this.Close();
                break;

            case DialogResult.Cancel:
                break;
            }
        }
예제 #5
0
        bool AddAllItems()
        {
            bool bAllok     = true;
            int  nofItemsOK = 0;
            int  nOfItems   = dGrid.Rows.Count;

            for (int i = nOfItems - 1; i >= 0; i -= 1)
            {
                if (!CheckRow(i))
                {
                    bAllok = false;
                }
                else
                {
                    nofItemsOK++;
                }
            }
            if (bAllok)
            {
                frmProgressBar fp = new frmProgressBar("Loading Items");
                fp.pb.Maximum = nofItemsOK;
                fp.Show();
                sEngine.AllowDatabaseSaves = false;
                for (int i = 0; i < nofItemsOK; i++)
                {
                    //string[] sNames = { "Barcode", "Description", "Type", "Category", "RRP", "VAT", "Minimum Quantity", "Supplier Code", "Cost", "Product Code" };
                    bool bExists = false;
                    for (int x = 0; x < sModifiedCodes.Count; x++)
                    {
                        if (sModifiedCodes[x] == dGrid.Rows[i].Cells[0].Value.ToString())
                        {
                            bExists = true;
                            break;
                        }
                    }
                    if (bExists)
                    {
                        //string[] sNames = { "Barcode", "Description", "Type", "Category", "RRP", "VAT", "Minimum Quantity", "QIS", "Supplier Code", "Cost", "Product Code", "Parent Code", "Qty/Parent" };
                        string sAverageCost = sEngine.GetItemAverageCost(dGrid.Rows[i].Cells[0].Value.ToString()).ToString();
                        AddItem(dGrid.Rows[i].Cells[2].Value.ToString(), dGrid.Rows[i].Cells[0].Value.ToString(), dGrid.Rows[i].Cells[1].Value.ToString(), dGrid.Rows[i].Cells[3].Value.ToString(), dGrid.Rows[i].Cells[4].Value.ToString(), dGrid.Rows[i].Cells[5].Value.ToString(),
                                dGrid.Rows[i].Cells[6].Value.ToString(), Convert.ToDecimal(dGrid.Rows[i].Cells[9].Value.ToString()), Convert.ToDecimal(dGrid.Rows[i].Cells[7].Value.ToString()), dGrid.Rows[i].Cells[11].Value.ToString(), Convert.ToDecimal(dGrid.Rows[i].Cells[12].Value.ToString()),
                                dGrid.Rows[i].Cells[8].Value.ToString(), Convert.ToDecimal(dGrid.Rows[i].Cells[9].Value.ToString()), dGrid.Rows[i].Cells[10].Value.ToString(), sAverageCost);
                    }
                    fp.pb.Value = i;

                    if (i == nofItemsOK - 1)
                    {
                        sEngine.AllowDatabaseSaves = true;
                        sEngine.SaveStockDatabases();
                    }
                }
                fp.Close();
                if (MessageBox.Show("Upload changes to all tills now?", "Upload", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    sEngine.CopyWaitingFilesToTills();
                }
            }
            return(bAllok);
        }
        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";
            }
        }
 void QtyKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (bReceiving)
         {
             if (sEngine.ReceiveComissionItem(InputTextBox("BARCODE").Text, InputTextBox("QTY").Text, InputTextBox("SHOPCODE").Text))
             {
                 if (MessageBox.Show("Would you like to upload the changes to stock levels to all tills?", "Upload", MessageBoxButtons.YesNo) == DialogResult.Yes)
                 {
                     sEngine.CopyWaitingFilesToTills();
                 }
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Failed to add! Are you sure this is a comission item?");
                 InputTextBox("BARCODE").Focus();
             }
         }
         else
         {
             decimal dQtyToReturn = 0;
             try
             {
                 dQtyToReturn = Convert.ToDecimal(InputTextBox("QTY").Text);
             }
             catch
             {
                 MessageBox.Show("Invalid Quantity Entered");
                 return;
             }
             decimal dQtyReturned = sEngine.ReturnCommissionItems(InputTextBox("BARCODE").Text, Convert.ToDecimal(InputTextBox("QTY").Text), InputTextBox("SHOPCODE").Text);
             if (dQtyReturned != dQtyToReturn)
             {
                 if (dQtyReturned == 1)
                 {
                     MessageBox.Show("Only 1 was returned, as there was only 1 in stock");
                 }
                 else
                 {
                     MessageBox.Show("Only " + dQtyReturned.ToString() + " were returned, as there was only " + dQtyReturned.ToString() + " in stock");
                 }
             }
             else
             {
                 MessageBox.Show("All returned ok!");
             }
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         InputTextBox("BARCODE").Focus();
     }
 }
예제 #8
0
 void Save()
 {
     string[]  sCodes = new string[tbCodes.Length];
     string[]  sNames = new string[tbNames.Length];
     decimal[] dRates = new decimal[tbRates.Length];
     for (int i = 0; i < tbCodes.Length; i++)
     {
         sCodes[i] = tbCodes[i].Text;
         sNames[i] = tbNames[i].Text;
         dRates[i] = Convert.ToDecimal(tbRates[i].Text);
     }
     sEngine.UpdateVATRates(sCodes, sNames, dRates);
     if (MessageBox.Show("Would you like to upload any changes to all tills?", "Upload", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         sEngine.CopyWaitingFilesToTills();
     }
 }
예제 #9
0
 public void SaveItems()
 {
     string[]  sSubCodes  = new string[tbBarcode.Length];
     decimal[] dSubPrices = new decimal[tbBarcode.Length];
     decimal[] dQuantites = new decimal[tbBarcode.Length];
     for (int i = 0; i < tbBarcode.Length; i++)
     {
         sSubCodes[i]  = tbBarcode[i].Text;
         dSubPrices[i] = Convert.ToDecimal(lblFinalLinePrice[i].Text);
         dQuantites[i] = Convert.ToDecimal(tbQty[i].Text);
     }
     sEngine.AddMultiItemItem(InputTextBox("BARCODEINPUT").Text, InputTextBox("DESCINPUT").Text, InputTextBox("SHOPCODEINPUT").Text, sSubCodes, dQuantites, dSubPrices);
     if (MessageBox.Show("Would you like to upload this onto all tills now?", "Upload now?", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         sEngine.CopyWaitingFilesToTills();
     }
 }
예제 #10
0
        void SaveQuestion()
        {
            switch (MessageBox.Show("Would you like to save this till information?", "Save changes?", MessageBoxButtons.YesNoCancel))
            {
            case DialogResult.Yes:
                string[] sToAdd = { InputTextBox("RLINE_1").Text, InputTextBox("RLINE_2").Text, InputTextBox("RLINE_3").Text };
                sEngine.AddTill(InputTextBox("TILL_NUM").Text, InputTextBox("TILL_NAME").Text, sToAdd, InputTextBox("TILL_LOC").Text, InputTextBox("COLLECTION").Text, sShopCode);
                if (MessageBox.Show("Would you like to upload changes to the till now?", "Upload Now?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    sEngine.CopyWaitingFilesToTills();
                }
                this.Close();
                break;

            case DialogResult.No:
                this.Close();
                break;

            case DialogResult.Cancel:
                break;
            }
        }
예제 #11
0
 void QtyKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         frmSingleInputBox fGetPassword = new frmSingleInputBox("Please enter the administrator password :"******"$NONE" || fGetPassword.Response.ToUpper() != sEngine.GetPasswords(2).ToUpper())
         {
             MessageBox.Show("Incorrect password");
             this.Close();
         }
         else
         {
             sEngine.TransferStockItem(InputTextBox("FROM").Text, InputTextBox("TO").Text, InputTextBox("BARCODE").Text, Convert.ToDecimal(InputTextBox("QTY").Text), false);
             if (MessageBox.Show("Would you like to upload all changes to tills?", "Upload?", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 sEngine.CopyWaitingFilesToTills();
             }
             this.Close();
         }
     }
 }
예제 #12
0
        void mEditStock_Click(object sender, EventArgs e)
        {
            decimal           dCurrentStockLevel = Convert.ToDecimal(sEngine.GetItemStockStaRecord(sBarcode, sShopCode)[36]);
            frmSingleInputBox fsGetNewStocklevel = new frmSingleInputBox("Enter the new stock level :", ref sEngine);

            fsGetNewStocklevel.ShowDialog();
            if (fsGetNewStocklevel.Response != "$NONE")
            {
                frmSingleInputBox fGetPassword = new frmSingleInputBox("Enter the administrator password : "******"$NONE" && fGetPassword.Response.ToUpper() == sEngine.GetPasswords(2).ToUpper())
                {
                    if (sEngine.GetMainStockInfo(sBarcode)[5] == "1")
                    {
                        if (Convert.ToDecimal(fsGetNewStocklevel.Response) > dCurrentStockLevel)
                        {
                            sEngine.TransferStockItem("BH", sShopCode, sBarcode, Convert.ToDecimal(fsGetNewStocklevel.Response) - dCurrentStockLevel, false);
                        }
                        else
                        {
                            sEngine.TransferStockItem(sShopCode, "BH", sBarcode, dCurrentStockLevel - Convert.ToDecimal(fsGetNewStocklevel.Response), false);
                        }
                    }
                    else if (sEngine.GetMainStockInfo(sBarcode)[5] == "6")
                    {
                        sEngine.ReceiveComissionItem(sBarcode, (Convert.ToDecimal(fsGetNewStocklevel.Response) - dCurrentStockLevel).ToString(), sShopCode);
                    }
                    ShowStatsAboutProduct();
                    if (MessageBox.Show("Would you like to upload the stock level change to all tills?", "Upload now?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        sEngine.CopyWaitingFilesToTills();
                    }
                }
            }
        }