Hello, I am doing an app which will generate invoices by fetching from database SQL.
Here see What I did :
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[5] {
new DataColumn("ProductId", typeof(string)),
new DataColumn("Product", typeof(string)),
new DataColumn("Price", typeof(int)),
new DataColumn("Quantity", typeof(int)),
new DataColumn("Total", typeof(int))});
dt.Rows.Add(101, "Sun Glasses", 200, 5, 1000);
dt.Rows.Add(102, "Jeans", 400, 2, 800);
dt.Rows.Add(103, "Trousers", 300, 3, 900);
dt.Rows.Add(104, "Shirts", 550, 2, 1100);
So here As you can see we have Product, Price of the product , the quantity and the total (Price * Quantity)
So my aim is for example
Invoice 1 I want inside it the total price of 1 500
so here my need is that how can we fetch from database so that it will automatically fill the right amount that i need.
INVOICE 1 : TOTAL 1 500 USD
Product1 : Shirts - 550 -2 - 1100
Product2: Jeans - 400 - 1- 400
Total = 1500 (1100+400)
And it automatically removes the quantity of products taken in the database.
Is it possible ?
What I have tried:
So here As you can see we have Product, Price of the product , the quantity and the total (Price * Quantity)
So my aim is for example
Invoice 1 I want inside it the total price of 1 500
so here my need is that how can we fetch from database so that it will automatically fill the right amount that i need.
INVOICE 1 : TOTAL 1 500 USD
Product1 : Shirts - 550 -2 - 1100
Product2: Jeans - 400 - 1- 400
Total = 1500 (1100+400)
And it automatically removes the quantity of products taken in the database.
Is it possible ?