private void btnAdd_Click(object sender, EventArgs e) { // dataGridView1.CurrentRow.Cells["itemName"].Value = cmbitemname.SelectedItem.ToString(); // dataGridView1.CurrentRow.Cells["itemQty"].Value = txtqty.Text.ToString(); if (cmbitemname.SelectedIndex != 0 && txtqty.Text.Length != 0) { String name = cmbitemname.SelectedItem.ToString(); int qty = Convert.ToInt32(txtqty.Text.ToString()); DBItem dbi = new DBItem(); int price = dbi.getItemPrice(name); int subtot = price * qty; count_qty = count_qty + qty; count_tot = count_tot + subtot; txttotqty.Text = count_qty.ToString(); txtprice.Text = count_tot.ToString(); txtstatus.Text = "Active"; String[] row = { name, qty.ToString(), subtot.ToString() }; dataGridView1.Rows.Add(row); } else { MessageBox.Show("Please insert data to all fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnAdd_Click(object sender, EventArgs e) { if (cmbsupname.SelectedIndex != 0 && cmbitemname.SelectedIndex != 0 && txtqty.Text.Length != 0) { String Item_Name = cmbitemname.SelectedItem.ToString(); DBItem dbi = new DBItem(); int price = dbi.getItemPrice(Item_Name); int subtot = price * Convert.ToInt32(txtqty.Text); count_qty = count_qty + Convert.ToInt32(txtqty.Text); count_tot = count_tot + subtot; txtprice.Text = count_tot.ToString(); txtstatus.Text = "Active"; String[] row = { Item_Name, txtqty.Text, subtot.ToString() }; dataGridView1.Rows.Add(row); } else { MessageBox.Show("Please enter data to all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void mt_ADD_Click(object sender, EventArgs e) { if (metroComboBox1.SelectedIndex != 0 && metroTextBox4.Text.Length != 0) { DBItem i = new DBItem(); String itemname = metroComboBox1.SelectedItem.ToString(); int no = i.getItemNo(itemname); int qty = Convert.ToInt32(metroTextBox4.Text); int price = i.getItemPrice(metroComboBox1.SelectedItem.ToString()); int subtot = price * qty; String[] row = { itemname, qty.ToString(), subtot.ToString() }; dataGridView1.Rows.Add(row); count_qty = count_qty + qty; count_tot = count_tot + subtot; metroTextBox3.Text = count_tot.ToString(); metroTextBox5.Text = count_qty.ToString(); } else { MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void metroButton1_Click(object sender, EventArgs e) { if (numQty.Value != 0) { DBItem i = new DBItem(); int no = i.getItemNo(cmbitemname.Text.ToString()); int qty = Convert.ToInt32(numQty.Value); int price = i.getItemPrice(cmbitemname.Text.ToString()); int subtot = price * qty; String[] row = { no.ToString(), qty.ToString(), subtot.ToString() }; dataGridView1.Rows.Add(row); count_qty = count_qty + qty; count_tot = count_tot + subtot; txtprice.Text = count_tot.ToString(); txttotqty.Text = count_qty.ToString(); } else { MessageBox.Show("Please select item return quantity", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnadd_Click(object sender, EventArgs e) { if (metroTextBox1.Text.Length != 0) { DBItem i = new DBItem(); int no = i.getItemNo(metroTextBox1.Text.ToString()); //dataGridView1.CurrentRow.Cells["Item_No"].Value = no.ToString(); // dataGridView1.CurrentRow.Cells["Item_Qty"].Value = txtqty.Text; int qty = Convert.ToInt32(numQty.Value); int price = i.getItemPrice(metroTextBox1.Text.ToString()); // dataGridView1.CurrentRow.Cells["Sub_Total"].Value = (price * Convert.ToInt32(txtqty.Text)); int subtot = price * qty; String[] row = { no.ToString(), qty.ToString(), subtot.ToString() }; dataGridView1.Rows.Add(row); count_qty = count_qty + qty; count_tot = count_tot + subtot; txtprice.Text = count_tot.ToString(); txttotqty.Text = count_qty.ToString(); } else { MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }