Exemple #1
0
 private void Form6_Load(object sender, EventArgs e)
 {
     label6.Text = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
     Table       = Connect.query("SELECT Product.Product_ID AS [Product ID], Product.Product_Name AS [Product Name], Product.Product_Price, Product.Discounts, Category.Category_Name AS Category, Stock.Quantity, Stock.Reordering_level, Stock.Shelf_location, Stock.Description, Stock.Dimension from(Product left join Stock on Product.Product_ID = Stock.Product_ID) left join Category on Stock.Category_ID = Category.Category_ID WHERE Deleted = False;");
     product_CategoryDataGridView.DataSource = Table;
     label3.Text = getVar.name;
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Product_name.Text == "" || price.Text == "" || dimension.Text == "" || reorderinglevel.Text == "" || shelf_loc.Text == "" ||
         discount_tb.Text == "" || quantity.Text == "" || category.Text == "" || description.Text == "" || subCategory.Text == "")
     {
         MessageBox.Show("Please input all field!");
     }
     else
     {
         String catID = "";
         Table = Connect.query("SELECT Category_ID from Category WHERE Category_Name = '" + category.Text + "'");
         catID = Table.Rows[0][0].ToString();
         Connect.exec("INSERT INTO Product( Product_ID, Product_Name,Product_Price,Discounts ) VALUES ('" + product_id.Text + "','" + Product_name.Text + "','" + price.Text + "','" + discount_tb.Text + "')");
         Connect.exec("INSERT INTO Stock(Product_ID, Category_ID,Quantity,Reordering_level,Shelf_location,Description,Dimension) VALUES ('" + product_id.Text + "','" + catID + "','" + quantity.Text + "', '" + reorderinglevel.Text + "','" + shelf_loc.Text + "', '" + description.Text + "', '" + dimension.Text + "')");
         MessageBox.Show("Add successful");
         Product_name.Text    = "";
         price.Text           = "";
         dimension.Text       = "";
         reorderinglevel.Text = "";
         shelf_loc.Text       = "";
         discount_tb.Text     = "";
         quantity.Text        = "";
         description.Text     = "";
         Table           = Connect.query("SELECT max(Product_ID)+1 from Product WHERE Deleted = False;");
         product_id.Text = Table.Rows[0][0].ToString();
     }
 }
Exemple #3
0
 private void Genreport_Load(object sender, EventArgs e)
 {
     // TODO:  這行程式碼會將資料載入 'dbDataSet1.Category' 資料表。您可以視需要進行移動或移除。
     label5.Text = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
     label3.Text = getVar.name;
     Table       = Connect.query("SELECT Product.Product_ID AS ID, Product.Product_Name AS[Product Name], Stock.Quantity, Stock.Reordering_level - Stock.Quantity AS NEED FROM Product INNER JOIN Stock ON Product.Product_ID = Stock.Product_ID WHERE(((Stock.Reordering_level) >[Stock].[Quantity]) AND((Product.Deleted) = False)) ORDER BY Product.Product_ID;");
     product_CategoryDataGridView.DataSource = Table;
 }
Exemple #4
0
        private void order_details_Load(object sender, EventArgs e)
        {
            Table = Connect.query("SELECT Sum(Product_Invoice.Deposit) FROM Invoice INNER JOIN Product_Invoice ON Invoice.Invoice_No = Product_Invoice.Invoice_No WHERE Invoice.Invoice_No = " + getVar.invoice_no + ";");
            total_textbox.Text = Table.Rows[0][0].ToString();

            invoice_id.Text             = getVar.invoice_no;
            PayControl.TabPages[0].Text = "Credit Card";
            PayControl.TabPages[1].Text = "Cash";
            change_textbox.Text         = "0";
        }
Exemple #5
0
 private void TakeOrder_Load(object sender, EventArgs e)
 {
     Table_Temp        = Connect.query("SELECT max(Invoice_No) FROM Invoice WHERE (Pay_Status=False AND Using_Status=True);");
     getVar.invoice_no = Table_Temp.Rows[0][0].ToString();
     label5.Text       = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
     label7.Text       = "Invoice ID: " + getVar.invoice_no;
     label3.Text       = getVar.name;
     Table             = Connect.query("SELECT Invoice.Invoice_No, Product.Product_Name, Product_Invoice.Quantity, Product_Invoice.Deposit FROM Product INNER JOIN(Invoice INNER JOIN Product_Invoice ON Invoice.Invoice_No = Product_Invoice.Invoice_No) ON Product.Product_ID = Product_Invoice.Product_ID WHERE(([Invoice].[Pay_Status] = False And[Invoice].[Using_Status] = True));");
     invoiceDataGridView.DataSource = Table;
 }
Exemple #6
0
        private void Form4_Load(object sender, EventArgs e)
        {
            label13.Text             = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
            Table                    = Connect.query("SELECT Product.Product_ID AS [Product ID], Product.Product_Name AS [Product Name], Product.Product_Price AS [Price], Product.Discounts AS [Discount], Stock.Category_ID AS [Category], Stock.Quantity AS [Quantity], Stock.Reordering_level AS [Reordering level], Stock.Shelf_location AS [Shelf Location], Stock.Description, Stock.Dimension from Product left join Stock on Product.Product_ID = Stock.Product_ID WHERE Deleted = False;");
            dataGridView1.DataSource = Table;
            label3.Text              = getVar.name;


            //this.productTableAdapter.Fill(this.dbDataSet.Product);
        }
Exemple #7
0
 private void Form3_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'dbDataSet1.Sub_Category' table. You can move, or remove it, as needed.
     this.sub_CategoryTableAdapter.Fill(this.dbDataSet1.Sub_Category);
     // TODO: This line of code loads data into the 'dbDataSet1.Category' table. You can move, or remove it, as needed.
     this.categoryTableAdapter.Fill(this.dbDataSet1.Category);
     time.Text       = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
     Table           = Connect.query("SELECT max(Product_ID)+1 from Product WHERE Deleted = False;");
     product_id.Text = Table.Rows[0][0].ToString();
     label3.Text     = getVar.name;
 }
Exemple #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (product_IDTextBox.Text == "")
     {
         Table = Connect.query("SELECT Product.Product_ID, Product.Product_Name, Product.Product_Price, Product.Discounts, Category.Category_Name AS Category, Stock.Quantity, Stock.Reordering_level, Stock.Shelf_location, Stock.Description, Stock.Dimension from(Product left join Stock on Product.Product_ID = Stock.Product_ID) left join Category on Stock.Category_ID = Category.Category_ID WHERE Category.Category_Name ='" + comboBox1.Text + "'AND Deleted = False;");
     }
     else
     {
         Table = Connect.query("SELECT Product.Product_ID, Product.Product_Name, Product.Product_Price, Product.Discounts, Category.Category_Name AS Category, Stock.Quantity, Stock.Reordering_level, Stock.Shelf_location, Stock.Description, Stock.Dimension from(Product left join Stock on Product.Product_ID = Stock.Product_ID) left join Category on Stock.Category_ID = Category.Category_ID WHERE Product.Product_ID =" + product_IDTextBox.Text + "AND Deleted = False;");
     }
     product_CategoryDataGridView.DataSource = Table;
 }
Exemple #9
0
        private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (BrowserDIdLoad)
            {
                return;
            }
            BrowserDIdLoad = true;
            Table          = Connect.query("SELECT Product_Invoice.Invoice_No, Invoice.Customer_Name, Invoice.Invoice_Date, Store.Location, Store.Phone_number, Product_Invoice.Product_ID, Product.Product_Name, Product.Product_Price, Product_Invoice.Quantity, Product_Invoice.Deposit, Invoice.Total_amount FROM(Store INNER JOIN Staff ON Store.Store_ID = Staff.Store_ID) INNER JOIN(Invoice INNER JOIN (Product INNER JOIN Product_Invoice ON Product.Product_ID = Product_Invoice.Product_ID) ON Invoice.Invoice_No = Product_Invoice.Invoice_No) ON Store.Store_ID = Invoice.Store_ID WHERE (((Product_Invoice.Invoice_No)=1));");
            for (i = 0; i != Table.Rows.Count; i++)
            {
                string location     = Table.Rows[i]["Location"].ToString();
                string telephone    = Table.Rows[i]["Phone_number"].ToString();
                string invoiceno    = Table.Rows[i]["Invoice_no"].ToString();
                string customername = Table.Rows[i]["Customer_Name"].ToString();
                string date         = Table.Rows[i]["Invoice_Date"].ToString();
                string productid    = Table.Rows[i]["Product_ID"].ToString();
                string productname  = Table.Rows[i]["Product_Name"].ToString();
                string oneprice     = Table.Rows[i]["Deposit"].ToString();
                string qty          = Table.Rows[i]["Quantity"].ToString();
                string price        = Table.Rows[i]["Product_price"].ToString();
                string total        = Table.Rows[i]["Total_amount"].ToString();



                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("./", path);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[INVOICENO]", invoiceno);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[LOCATION]", location);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[TELEPHONE]", telephone);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[INVOICENO]", invoiceno);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[CUSTOMERNAME]", customername);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[DATE]", date);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTID" + i + "]", productid);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTNAME" + i + "]", productname);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[ONEPRICE" + i + "]", oneprice);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[QUANTITY" + i + "]", qty);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRICE" + i + "]", price);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[TOTAL]", total);

                if (Table.Rows.Count < 4)
                {
                    for (int o = Table.Rows.Count; o != 4; o++)
                    {
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTID" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTNAME" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[ONEPRICE" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[QUANTITY" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRICE" + o + "]", "");
                    }
                }
            }
        }
Exemple #10
0
 private void button2_Click(object sender, EventArgs e)
 {
     Table_Temp = Connect.query("SELECT max(Invoice_No) FROM Invoice WHERE (Pay_Status=False AND Using_Status=True);");
     if (Table_Temp.Rows.Count < 1)
     {
         MessageBox.Show("No invoice can be generate yet!");
     }
     else
     {
         getVar.invoice_no = Table_Temp.Rows[0][0].ToString();
         order_details orderdetails = new order_details();
         orderdetails.Show();
     }
 }
Exemple #11
0
        private void Modify_detail_Load(object sender, EventArgs e)
        {
            DataTable Table;

            Table = Connect.query("SELECT Product.Product_ID, Product.Product_Name, Product.Product_Price, Product.Discounts, Stock.Category_ID, Stock.Quantity, Stock.Reordering_level, Stock.Shelf_location, Stock.Description, Stock.Dimension from Product left join Stock on Product.Product_ID = Stock.Product_ID WHERE Product.Product_ID =" + Int32.Parse(PID) + " AND Deleted = False;");
            product_IDTextBox.Text       = Table.Rows[0]["Product_ID"].ToString();
            dimensionTextBox.Text        = Table.Rows[0]["Dimension"].ToString();
            reordering_levelTextBox.Text = Table.Rows[0]["Reordering_level"].ToString();
            product_NameTextBox.Text     = Table.Rows[0]["Product_Name"].ToString();
            discountsTextBox.Text        = Table.Rows[0]["Discounts"].ToString();
            product_PriceTextBox.Text    = Table.Rows[0]["Product_Price"].ToString();
            shelf_locationTextBox.Text   = Table.Rows[0]["Shelf_location"].ToString();
            quantity_textbox.Text        = Table.Rows[0]["Quantity"].ToString();
        }
Exemple #12
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (BrowserDIdLoad)
            {
                return;
            }
            BrowserDIdLoad = true;
            Table          = Connect.query("SELECT Store.Location, Store.Phone_number FROM Store WHERE(Store.Store_ID) = " + getVar.storeID + "; ");
            string location  = Table.Rows[i]["Location"].ToString();
            string telephone = Table.Rows[i]["Phone_number"].ToString();

            wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[LOCATION]", location);
            wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[TELEPHONE]", telephone);
            Table = Connect.query("SELECT NOW() AS [DATE]; ");
            string date = Table.Rows[i]["DATE"].ToString();

            wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[DATE]", date);
            Table = Connect.query("SELECT Product.Product_ID AS ID, Product.Product_Name AS[Product Name], Stock.Quantity, Stock.Reordering_level - Stock.Quantity AS NEED FROM Product INNER JOIN Stock ON Product.Product_ID = Stock.Product_ID WHERE(((Stock.Reordering_level) >[Stock].[Quantity]) AND((Product.Deleted) = False)) ORDER BY Product.Product_ID;");
            for (i = 0; i != Table.Rows.Count; i++)
            {
                string productid   = Table.Rows[i]["ID"].ToString();
                string productname = Table.Rows[i]["Product Name"].ToString();
                string qty         = Table.Rows[i]["Quantity"].ToString();
                string total       = Table.Rows[i]["NEED"].ToString();

                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("./", path);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTID" + i + "]", productid);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTNAME" + i + "]", productname);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[QTY" + i + "]", qty);
                wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[NEED" + i + "]", total);

                if (Table.Rows.Count < 4)
                {
                    for (int o = Table.Rows.Count; o != 4; o++)
                    {
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTID" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[PRODUCTNAME" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[QTY" + o + "]", "");
                        wb.Document.Body.InnerHtml = wb.Document.Body.InnerHtml.Replace("[NEED" + o + "]", "");
                    }
                }
            }
        }
Exemple #13
0
        private void ModifyItem_Activated(object sender, EventArgs e)
        {
            Table = Connect.query("SELECT Product.Product_ID, Product.Product_Name, Product.Product_Price, Product.Discounts, Category.Category_Name AS Category, Stock.Quantity, Stock.Reordering_level, Stock.Shelf_location, Stock.Description, Stock.Dimension from(Product left join Stock on Product.Product_ID = Stock.Product_ID) left join Category on Stock.Category_ID = Category.Category_ID WHERE Deleted = False;");

            product_CategoryDataGridView.DataSource = Table;
        }
Exemple #14
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            string sqlStr = "";

            Login = false;

            if (txtUsername.Text.Length == 0 ||
                txtPassword.Text.Length == 0)
            {
                MessageBox.Show("Missing username or password. "
                                + "Please try again.");
                txtUsername.Clear();
                txtPassword.Clear();
            }
            else
            {
                try {
                    DataTable dt = Connect.query("Select * from Staff WHERE Staff_ID = '" + txtUsername.Text + "' AND Password = '******'");

                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["Staff"].ToString().Equals("True"))
                        {
                            Staff          = true;
                            Login          = true;
                            getVar.name    = "Login As:" + dt.Rows[0]["LastName"].ToString() + " " + dt.Rows[0]["FirstName"].ToString();
                            getVar.storeID = dt.Rows[0]["Store_ID"].ToString();
                        }
                        else
                        {
                            Staff          = false;
                            Login          = true;
                            getVar.name    = "Login As:" + dt.Rows[0]["FirstName"].ToString();
                            getVar.storeID = dt.Rows[0]["Store_ID"].ToString();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Incorrect user name or password. "
                                        + "Please try again.");
                        txtUsername.Clear();
                        txtPassword.Clear();
                    }
                    if (Login)
                    {
                        if (Staff)
                        {
                            Menu staffmenu = new Menu(this);
                            staffmenu.Show();
                            this.Hide();
                            txtUsername.Clear();
                            txtPassword.Clear();
                        }
                        else if (!Staff)
                        {
                            SearchItem nonstaffmenu = new SearchItem(this);
                            nonstaffmenu.Show();
                            this.Hide();
                            txtUsername.Clear();
                            txtPassword.Clear();
                        }
                    }
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message + "\nSQL: " + sqlStr);
                }
            }
        }
Exemple #15
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     label5.Text = DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
     Table       = Connect.query("SELECT Invoice.Invoice_No, Product.Product_Name, Product_Invoice.Quantity, Product_Invoice.Deposit FROM Product INNER JOIN(Invoice INNER JOIN Product_Invoice ON Invoice.Invoice_No = Product_Invoice.Invoice_No) ON Product.Product_ID = Product_Invoice.Product_ID WHERE(([Invoice].[Pay_Status] = False And[Invoice].[Using_Status] = True));");
     invoiceDataGridView.DataSource = Table;
 }
Exemple #16
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (orderqty_textbox.Text != "" && quantity_textbox.Text != "" && (Int32.Parse(quantity_textbox.Text) >= Int32.Parse(orderqty_textbox.Text)))
            {
                Table_Temp        = Connect.query("SELECT max(Invoice_No) FROM Invoice WHERE (Pay_Status=False AND Using_Status=True);");
                getVar.invoice_no = Table_Temp.Rows[0][0].ToString();
                Table_Temp        = Connect.query("SELECT max(Invoice_No)+1 FROM Invoice WHERE (Pay_Status=True AND Using_Status=True);");
                string old_invoice_no = Table_Temp.Rows[0][0].ToString();
                if (getVar.invoice_no == "" && old_invoice_no == "")
                {
                    getVar.invoice_no     = "1";
                    quantity_textbox.Text = (Int32.Parse(quantity_textbox.Text) - Int32.Parse(orderqty_textbox.Text)).ToString();

                    Connect.exec("INSERT INTO Invoice(Invoice_No,Store_ID,Using_Status) VALUES ('" + getVar.invoice_no.ToString() + "','" + getVar.storeID.ToString() + "',True)");

                    Connect.exec("INSERT INTO Product_Invoice( Invoice_No,Product_ID,Quantity,Deposit ) VALUES ('" + getVar.invoice_no.ToString() + "','" + product_IDTextBox.Text + "','" + orderqty_textbox.Text + "','" + product_PriceTextBox.Text + "')");

                    Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                    MessageBox.Show("Add order complete!");
                }
                else if ((old_invoice_no.ToString() == "") && (getVar.invoice_no == "1"))
                {
                    quantity_textbox.Text = (Int32.Parse(quantity_textbox.Text) - Int32.Parse(orderqty_textbox.Text)).ToString();

                    Table_Temp = Connect.query("SELECT Quantity FROM Product_Invoice WHERE (Invoice_No = " + getVar.invoice_no.ToString() + " AND Product_ID= " + product_IDTextBox.Text + ");");
                    if (!(Table_Temp.Rows.Count == 0))
                    {
                        int temp = Int32.Parse(Table_Temp.Rows[0][0].ToString()) + Int32.Parse(orderqty_textbox.Value.ToString());



                        Connect.exec("UPDATE Product_invoice SET Quantity='" + temp + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");

                        Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                        MessageBox.Show("Add order complete!");
                    }
                    else
                    { //duplocate
                        Connect.exec("INSERT INTO Product_invoice(Quantity,Product_ID,Invoice_No,Deposit) VALUES('" + orderqty_textbox.Value.ToString() + "','" + product_IDTextBox.Text + "','" + getVar.invoice_no.ToString() + "','" + product_PriceTextBox.Text + "')");

                        Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                        MessageBox.Show("Add order complete!");
                    }
                }

                else if ((getVar.invoice_no != "") && (old_invoice_no.ToString() != ""))
                {
                    Table_Temp = Connect.query("SELECT Quantity FROM Product_Invoice WHERE (Invoice_No = " + getVar.invoice_no.ToString() + " AND Product_ID= " + product_IDTextBox.Text + ");");
                    if (!(Table_Temp.Rows.Count == 0))
                    {
                        int temp = Int32.Parse(Table_Temp.Rows[0][0].ToString()) + Int32.Parse(orderqty_textbox.Value.ToString());



                        Connect.exec("UPDATE Product_invoice SET Quantity='" + temp + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");

                        Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                        MessageBox.Show("Add order complete!");
                    }
                    else
                    {
                        Connect.exec("INSERT INTO Product_invoice(Quantity,Product_ID,Invoice_No,Deposit) VALUES('" + orderqty_textbox.Value.ToString() + "','" + product_IDTextBox.Text + "','" + old_invoice_no.ToString() + "','" + product_PriceTextBox.Text + "')");

                        Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                        MessageBox.Show("Add order complete!");
                    }
                }
                else
                {
                    Connect.exec("INSERT INTO Invoice(Invoice_No,Store_ID,Using_Status) VALUES ('" + old_invoice_no + "','" + getVar.storeID.ToString() + "',True)");

                    Connect.exec("INSERT INTO Product_Invoice( Product_ID,Quantity,Deposit,Invoice_No ) VALUES ('" + product_IDTextBox.Text + "','" + orderqty_textbox.Text + "','" + product_PriceTextBox.Text + "','" + old_invoice_no.ToString() + "')");

                    Connect.exec("UPDATE Stock SET Quantity='" + quantity_textbox.Text + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                    Table_Temp = Connect.query("SELECT Quantity FROM Product_Invoice WHERE (Invoice_No = " + old_invoice_no.ToString() + " AND Product_ID= " + product_IDTextBox.Text + ");");
                    int temp = Int32.Parse(Table_Temp.Rows[0][0].ToString()) + Int32.Parse(orderqty_textbox.Value.ToString());

                    Connect.exec("UPDATE Product_invoice SET Quantity='" + temp + "' WHERE Product_ID = " + product_IDTextBox.Text + ";");
                    MessageBox.Show("Add order complete!");
                }
            }
            else if ((Int32.Parse(orderqty_textbox.Text) < 0))
            {
                MessageBox.Show("Please input postive number!");
            }
            else if (quantity_textbox.Text.ToString() == "")
            {
                MessageBox.Show("Please select item");
            }
            else if ((Int32.Parse(quantity_textbox.Text) < Int32.Parse(orderqty_textbox.Text)))
            {
                MessageBox.Show("Not enough stock!");
            }
            Table = Connect.query("SELECT Product.Product_ID AS [Product ID], Product.Product_Name AS [Product Name], Product.Product_Price AS [Price], Product.Discounts AS [Discount], Stock.Category_ID AS [Category], Stock.Quantity AS [Quantity], Stock.Reordering_level AS [Reordering level], Stock.Shelf_location AS [Shelf Location], Stock.Description, Stock.Dimension from Product left join Stock on Product.Product_ID = Stock.Product_ID WHERE Deleted = False;");
            dataGridView1.DataSource = Table;
        }