private void Inventory_Link_Click(object sender, EventArgs e) { Inventory_Page g = new Inventory_Page(); g.Show(); this.Hide(); }
private void back_button_Click(object sender, EventArgs e) { Inventory_Page g = new Inventory_Page(); g.Show(); this.Hide(); }
private void create_button_Click(object sender, EventArgs e) { if (stock_in_view.Rows.Count == 0) { MessageBox.Show("Please input item/s to be added to the purchase order.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { switch (MessageBox.Show("Are you sure you want to proceed with the Purchase Order?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { case DialogResult.Yes: Conn.Open(); string query2 = "insert into purchase_order(purch_order_id, purch_order_date, purch_suppid, purch_status, purch_total) values ('" + purch_id.Text + "','" + date_input.Value.ToString(format) + "','" + supplier_id.Text + "','Pending', '" + total_text.Text + "')"; main.CUD_Statement(query2); int countrow = stock_in_view.Rows.Count; for (int i = 0; i < countrow; i++) { MySqlCommand cmd = new MySqlCommand("INSERT INTO purchase_order_details(purch_itemid,purch_itemqty, purch_purchid, purch_dstatus, purch_finalitemqty, purch_reqemployeeid) VALUES (@iditem,@qtyitem, " + purch_id.Text + ", 'Incomplete', @qtyitem, '" + emp_id.Text + "')", Conn); cmd.Parameters.AddWithValue("@iditem", stock_in_view.Rows[i].Cells[8].Value); cmd.Parameters.AddWithValue("@qtyitem", stock_in_view.Rows[i].Cells[5].Value); cmd.ExecuteNonQuery(); } Conn.Close(); // messagebox for yes and no if sure about transaction // show list of all items bought purid = Convert.ToString(value: purch_id.Text); new Purchase_Order_Form(purid).ShowDialog(); Inventory_Page g = new Inventory_Page(); g.Show(); this.Hide(); break; case DialogResult.No: break; } } }