Beispiel #1
0
        private void dataGridView_tax_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (dgv != null && prev_row != e.RowIndex && e.RowIndex < dt.Rows.Count)
            {
                DataGridViewButtonCell b = dgv.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
                prev_row = e.RowIndex;
                DataRow      row = dt.Rows[e.RowIndex];
                MySqlCommand cmd = new MySqlCommand("UPDATE  shop_pay  SET  order_status='PAID' WHERE pay_id='" + row["pay_id"] + "'", cn);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Payment Made Successfully...");
                //report_form_payment_history ph = new report_form_payment_history();
                //ph.Show();
                Report_Form_bill rb = new Report_Form_bill();
                rb.ShowDialog();
                this.dataGridView_tax.DataSource = null;
                this.dataGridView_tax.Rows.Clear();
                this.dataGridView_tax.Columns.Clear();

                string           selectQuery = "Select * from shop_inventory WHERE inventory_quantity<=3";
                DataTable        table       = new DataTable();
                MySqlDataAdapter ad          = new MySqlDataAdapter(selectQuery, cn);
                ad.Fill(table);
                dt = new DataTable();
                ad.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    alert stock = new alert();
                    stock.ShowDialog();
                }
            }
        }
Beispiel #2
0
        public inventory()
        {
            InitializeComponent();
            cn.Open();
            refreshData();
            button4.Click += new EventHandler(stock_Load);
            button2.Click += new EventHandler(tabPage1_Click);
            button3.Click += new EventHandler(label1_Click);
            string           selectQuery = "Select * from shop_inventory WHERE inventory_quantity<=3";
            DataTable        table       = new DataTable();
            MySqlDataAdapter ad          = new MySqlDataAdapter(selectQuery, cn);

            ad.Fill(table);
            dt = new DataTable();
            ad.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                using (alert stock = new alert())
                {
                    stock.FormClosed += new FormClosedEventHandler(MyForm_FormClosed);
                    stock.ShowDialog();
                }
            }
        }
Beispiel #3
0
        private void taxsv_btn_Click(object sender, EventArgs e)
        {
            using (MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM shop_inventory WHERE inventory_name='" + comboBox2.GetItemText(this.comboBox2.SelectedItem) + "'", cn))
            {
                dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow rows = dt.Rows[i];
                        quantities = Int32.Parse(rows["inventory_quantity"].ToString());
                    }
                }
            }
            if (operation == 0 && !comboBox1.GetItemText(this.comboBox1.SelectedItem).Equals("") && !comboBox2.GetItemText(this.comboBox2.SelectedItem).Equals("") && !textBox1.Text.Equals("") && !textBox4.Text.Equals("") && !textBox4.Text.Equals("0"))
            {
                DataRow      row    = prices.Rows[comboBox2.SelectedIndex];
                double       amount = Convert.ToInt32(textBox4.Text) * Convert.ToDouble(row["menu_price"]);
                MySqlCommand cmd    = new MySqlCommand("INSERT into shop_parcel (parcel_name,parcel_order,parcel_quantity,parcel_amount) values ('" + textBox1.Text + "','" + comboBox2.GetItemText(this.comboBox2.SelectedItem) + "'," + textBox4.Text + "," + amount + ")", cn);
                cmd.ExecuteNonQuery();


                if (quantities > 0)
                {
                    quantities = quantities - Int32.Parse(textBox4.Text);
                    MySqlCommand cmd2 = new MySqlCommand("UPDATE shop_inventory SET inventory_quantity=" + quantities + " WHERE inventory_name='" + comboBox2.GetItemText(this.comboBox2.SelectedItem) + "'", cn);
                    cmd2.ExecuteNonQuery();
                }
                MessageBox.Show("Order placed please refresh to view in panel.");
                textBox4.Text = "";
                this.Close();
            }

            else if (operation == 1 && !textBox4.Text.Equals("") && !textBox4.Text.Equals("0"))
            {
                double amount = Convert.ToInt32(textBox4.Text) * actual_price;

                MySqlCommand cmd = new MySqlCommand("UPDATE shop_parcel SET parcel_quantity='" + textBox4.Text + "', parcel_amount=" + amount + " WHERE parcel_id=" + id, cn);
                cmd.ExecuteNonQuery();

                if (beforQunatity > Int32.Parse(textBox4.Text))
                {
                    beforQunatity = beforQunatity - Int32.Parse(textBox4.Text);
                    quantities    = quantities - beforQunatity;
                    MySqlCommand cmd2 = new MySqlCommand("UPDATE shop_inventory SET inventory_quantity=" + quantities + " WHERE inventory_name='" + comboBox2.GetItemText(this.comboBox2.SelectedItem) + "'", cn);
                    cmd2.ExecuteNonQuery();
                }
                else
                {
                    beforQunatity = -Int32.Parse(textBox4.Text) - beforQunatity;
                    quantities    = quantities - beforQunatity;
                    MySqlCommand cmd2 = new MySqlCommand("UPDATE shop_inventory SET inventory_quantity=" + quantities + " WHERE inventory_name='" + comboBox2.GetItemText(this.comboBox2.SelectedItem) + "'", cn);
                    cmd2.ExecuteNonQuery();
                }
                MessageBox.Show("Oder Edited...");
                textBox4.Text = "";
                this.Close();
            }
            else
            {
                MessageBox.Show("Fields are incomplete...");
            }
            string           selectQuery = "Select * from shop_inventory WHERE inventory_quantity<=3";
            DataTable        table       = new DataTable();
            MySqlDataAdapter ad          = new MySqlDataAdapter(selectQuery, cn);

            ad.Fill(table);
            dt = new DataTable();
            ad.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                alert stock = new alert();
                stock.ShowDialog();
            }
        }