Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public frmListOfSales(ref StockEngine sEngine, string sBarcode)
        {
            this.sEngine           = sEngine;
            this.AllowScaling      = false;
            this.sBarcode          = sBarcode;
            this.FormBorderStyle   = FormBorderStyle.FixedToolWindow;
            this.Size              = new System.Drawing.Size(275, 420);
            this.SurroundListBoxes = true;

            AddMessage("INST", "Sales Date  -  Transaction Number", new System.Drawing.Point(10, 10));

            lbSales             = new CListBox();
            lbSales.Location    = new System.Drawing.Point(10, BelowLastControl);
            lbSales.Size        = new System.Drawing.Size(this.ClientSize.Width - 20, 300);
            lbSales.BorderStyle = BorderStyle.None;
            this.Controls.Add(lbSales);

            AddMessage("NOTE", "Only sales before this week are shown", new System.Drawing.Point(10, 340));
            AddMessage("NOTE2", "Press Enter to view the transaction", new System.Drawing.Point(10, 360));

            sTranNo    = new string[0];
            sSalesDate = sEngine.GetWeeksOfItemSold(sBarcode, ref sTranNo);

            frmProgressBar fp = new frmProgressBar("Getting Sales Dates");

            fp.pb.Maximum = sSalesDate.Length;
            fp.Show();
            for (int i = 0; i < sSalesDate.Length; i++)
            {
                fp.pb.Value = i;
                string sDay = sEngine.WorkOutDateOfSale(sTranNo[i], sSalesDate[i]);
                BackOffice.Database_Engine.Table t = new BackOffice.Database_Engine.Table("Archive\\Weekly\\" + sSalesDate[i] + "\\TILL1\\INGNG\\REPDATA" + sDay + ".DBF");
                string sDate = t.GetRecordFrom(0)[1];
                lbSales.Items.Add(sDate + " - " + sTranNo[i]);
            }
            if (lbSales.Items.Count > 0)
            {
                lbSales.SelectedIndex = 0;
            }
            fp.Close();
            lbSales.KeyDown += new KeyEventHandler(lbSales_KeyDown);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Compresses the whole archive
        /// </summary>
        public static void CompressWholeArchive()
        {
            frmProgressBar fp = new frmProgressBar("Compressing Archive");

            string[] periods = { "Daily", "Weekly", "Monthly", "Yearly" };
            fp.Show();
            foreach (string period in periods)
            {
                string[] dirs = Directory.GetDirectories("Archive\\" + period);
                fp.pb.Value   = 0;
                fp.pb.Maximum = dirs.Length;
                foreach (string dir in dirs)
                {
                    fp.pb.Value++;
                    fp.Text = "Compressing " + dir;
                    CompressArchiveDirectory(dir + "\\");
                }
            }
            fp.Close();
        }
Exemplo n.º 4
0
        private void LoadInData(string[] sDirsToUse)
        {
            frmProgressBar fp = new frmProgressBar("Loading Data");

            fp.pb.Maximum = sDirsToUse.Length;
            fp.pb.Value   = 0;
            Form f = new Form();

            f.WindowState = FormWindowState.Maximized;
            PictureBox pb = new PictureBox();

            f.Controls.Add(pb);
            f.Show();
            fp.Show();
            pb.Size     = f.Size;
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            for (int i = 0; i < sDirsToUse.Length; i++)
            {
                fp.pb.Value = i;
                using (Table tStockSta = new Table(sWorkingDir + "\\" + sDirsToUse[i] + "\\STOCKSTA.DBF"))
                {
                    for (int x = 0; x < gItem.Length; x++)
                    {
                        if (gItem[x].ItemType == GraphItem.Type.Barcode || gItem[x].ItemType == GraphItem.Type.Category)
                        {
                            gItem[x].ReceiveStockStaTable(tStockSta, sWorkingDir + "\\" + sDirsToUse[i]);
                        }
                    }
                }
                if (i >= 1)
                {
                    CalculateAxesScale();
                    DrawAxes();
                    DrawGraph();
                    SaveImage(i.ToString());
                    pb.Image = Image.FromFile("GraphImages\\Graph Stage " + i.ToString() + ".bmp");
                    Application.DoEvents();
                }
            }
            fp.Close();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Backs up the current databases to a USB (or otherwise connected) drive
        /// </summary>
        public static void BackupToUSBPen(string CompanyName)
        {
            bool bFound = false;

            for (int i = 67; i < 84; i++)
            {
                if (Directory.Exists(((char)i).ToString() + ":\\BACKUP"))
                {
                    frmProgressBar fp = new frmProgressBar("Copying Tables");
                    fp.pb.Maximum = 24;
                    fp.pb.Value   = 0;
                    fp.Show();
                    if (!Directory.Exists(((char)i).ToString() + ":\\BACKUP\\" + CompanyName))
                    {
                        Directory.CreateDirectory(((char)i).ToString() + ":\\BACKUP\\" + CompanyName);
                    }
                    string sSaveLoc = ((char)i).ToString() + ":\\BACKUP\\" + CompanyName + "\\";
                    File.Copy("ACCSTAT.DBF", sSaveLoc + "ACCSTAT.DBF", true);
                    fp.pb.Value = 1;
                    File.Copy("CATEGORY.DBF", sSaveLoc + "CATEGORY.DBF", true);
                    fp.pb.Value = 2;
                    File.Copy("CATGRPDA.DBF", sSaveLoc + "CATGRPDA.DBF", true);
                    fp.pb.Value = 3;
                    File.Copy("CATGPHDR.DBF", sSaveLoc + "CATGPHDR.DBF", true);
                    fp.pb.Value = 4;
                    File.Copy("COMMPPL.DBF", sSaveLoc + "COMMPPL.DBF", true);
                    fp.pb.Value = 6;
                    File.Copy("COMMITEM.DBF", sSaveLoc + "COMMITEM.DBF", true);
                    fp.pb.Value = 7;
                    //tCustomer.SaveToFile(sSaveLoc + "CUSTOMER.DBF");
                    File.Copy("EMAILS.DBF", sSaveLoc + "EMAILS.DBF", true);
                    fp.pb.Value = 8;
                    File.Copy("MULTIDAT.DBF", sSaveLoc + "MULTIDAT.DBF", true);
                    fp.pb.Value = 9;
                    File.Copy("MULTIHDR.DBF", sSaveLoc + "MULTIHDR.DBF", true);
                    fp.pb.Value = 10;
                    File.Copy("ORDER.DBF", sSaveLoc + "ORDER.DBF", true);
                    fp.pb.Value = 11;
                    File.Copy("ORDERLIN.DBF", sSaveLoc + "ORDERLIN.DBF", true);
                    fp.pb.Value = 12;
                    File.Copy("ORDERSUG.DBF", sSaveLoc + "ORDERSUG.DBF", true);
                    fp.pb.Value = 13;
                    File.Copy("SETTINGS.DBF", sSaveLoc + "SETTINGS.DBF", true);
                    fp.pb.Value = 14;
                    File.Copy("SHOP.DBF", sSaveLoc + "SHOP.DBF", true);
                    fp.pb.Value = 15;
                    File.Copy("STAFF.DBF", sSaveLoc + "STAFF.DBF", true);
                    fp.pb.Value = 16;
                    File.Copy("MAINSTOC.DBF", sSaveLoc + "MAINSTOC.DBF", true);
                    fp.pb.Value = 17;
                    File.Copy("STOCKSTA.DBF", sSaveLoc + "STOCKSTA.DBF", true);
                    fp.pb.Value = 18;
                    File.Copy("SUPPLIER.DBF", sSaveLoc + "SUPPLIER.DBF", true);
                    fp.pb.Value = 19;
                    File.Copy("SUPINDEX.DBF", sSaveLoc + "SUPINDEX.DBF", true);
                    fp.pb.Value = 20;
                    File.Copy("TILL.DBF", sSaveLoc + "TILL.DBF", true);
                    fp.pb.Value = 21;
                    File.Copy("TOTSALES.DBF", sSaveLoc + "TOTSALES.DBF", true);
                    fp.pb.Value = 22;
                    File.Copy("VAT.DBF", sSaveLoc + "VAT.DBF", true);
                    fp.pb.Value = 23;
                    File.Copy("STOCKLEN.DBF", sSaveLoc + "STOCKLEN.DBF", true);
                    fp.pb.Value = 24;
                    bFound      = true;
                    fp.Close();
                    break;
                }
            }
            if (!bFound)
            {
                System.Windows.Forms.MessageBox.Show("Could not find the USB pen drive! Please make sure it is inserted and has a folder called BACKUP");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Backed up OK!");
            }
        }