The Fried Rice shop Inventory Management System is developed using C#.NET and SQL SERVER. The project is built to manage sales and transactions. To make a new transaction, fields such as: Fried Rice type, qty,price and payment needs to be selected. If you like to learn point of sales systems step by step, this is the right place to learn from the beginning.
SqlConnection con = new SqlConnection("Data Source=KOBINATH-PC; Initial Catalog=posnew; User Id=sa; Password=admin123"); SqlCommand cmd; SqlCommand cmd1; SqlDataReader read; SqlDataAdapter drr; string sql; string sql1; string name; int price; int tot;
After selected relevant product details click ADD button. Product details added into the below table.
private void button1_Click(object sender, EventArgs e) { if(chkthfrice.Checked) { name = "Thai Fried Rice"; int qty = int.Parse(numericUpDown1.Value.ToString()); price = 100; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } if (chkchi.Checked) { name = "Chicken Fried Rice"; int qty = int.Parse(numericUpDown2.Value.ToString()); price = 200; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } if (chkfish.Checked) { name = "Fish Fried Rice"; int qty = int.Parse(numericUpDown3.Value.ToString()); price = 150; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } //Drink if (chkveg.Checked) { name = "Veg Fried Rice"; int qty = int.Parse(numericUpDown4.Value.ToString()); price = 120; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } if (chkpine.Checked) { name = "Pineapple Fried Rice"; int qty = int.Parse(numericUpDown5.Value.ToString()); price = 150; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } if (chkcrab.Checked) { name = "Crab Fried Rice"; int qty = int.Parse(numericUpDown6.Value.ToString()); price = 130; tot = qty * price; this.dataGridView1.Rows.Add(name, price, qty, tot); } int sum = 0; for(int row = 0; row< dataGridView1.Rows.Count; row++) { sum = sum + Convert.ToInt32(dataGridView1.Rows[row].Cells[3].Value); } txtSub.Text = sum.ToString(); }
private void button2_Click(object sender, EventArgs e) { string bal = txtBal.Text; string sub = txtSub.Text; string pay = textBox1.Text; sql = "insert into sales(subtoal,pay,bal) values(@subtoal,@pay,@bal); select @@identity;"; con.Open(); cmd = new SqlCommand(sql, con); cmd.Parameters.AddWithValue("@subtoal", sub); cmd.Parameters.AddWithValue("@pay", pay); cmd.Parameters.AddWithValue("@bal", bal); int lastinsertID = int.Parse(cmd.ExecuteScalar().ToString()); string proddname = ""; int price = 0; int qty = 0; int tot = 0; for (int row = 0; row < dataGridView1.Rows.Count; row++) { proddname = dataGridView1.Rows[row].Cells[0].Value.ToString(); price = int.Parse(dataGridView1.Rows[row].Cells[1].Value.ToString()); qty = int.Parse(dataGridView1.Rows[row].Cells[2].Value.ToString()); int total = int.Parse(dataGridView1.Rows[row].Cells[3].Value.ToString()); sql1 = "insert into sales_product(sales_id,prodname,price,qty,total) values(@sales_id,@prodname,@price,@qty,@total)"; cmd1 = new SqlCommand(sql1, con); cmd1.Parameters.AddWithValue("@sales_id", lastinsertID); cmd1.Parameters.AddWithValue("@prodname", proddname); cmd1.Parameters.AddWithValue("@price", price); cmd1.Parameters.AddWithValue("@qty", qty); cmd1.Parameters.AddWithValue("@total", total); cmd1.ExecuteNonQuery(); } MessageBox.Show("Record Addddedddd"); con.Close(); }
if the want to delete item from the table click the item row delete button then item has been deleted.
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if(e.ColumnIndex == dataGridView1.Columns["Delete"].Index && e.RowIndex >= 0) { dataGridView1.Rows.Remove(dataGridView1.Rows[e.RowIndex]); int sum = 0; for (int row = 0; row < dataGridView1.Rows.Count; row++) { sum = sum + Convert.ToInt32(dataGridView1.Rows[row].Cells[3].Value); } txtSub.Text = sum.ToString(); } }
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
Act as a Java developer to create a program that calculates the gross wage for…
Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…
In this tutorial, we will teach you how to create a simple school management system…
I have design the Admin Basic templete using React MUI Design Admin Dashboard and Login.Here…
In this tutorial ,i am to going teach the Laravel Breeze.Laravel Breeze provides a simple…