Hi,

I am new bee to asp.net. Can anyone help me in my project? I am stucked at one point. I am preparing one project for one retail shop. For billing

purpose, as the user adds new items at the same time the program is generating rows dynamically whereas at the end I should get the Grand total of

above rows (amount column) in a textbox(subtotal). Please note I am using VB script, VS 2008 with SQL 2005 Server Mgt Express.

For eg:
ProdName Qty Rate Amount
A 3 20.00 60.00
B 2 40.00 80.00
C 1 30.00 30.00
D 2 20.00 20.00

Subtotal 190.00

Discount(%) 10

GrandTotal 171.00 (The amount payable by customer is 171.00 including discount of 10%)

Your urgent assistance in this regard will be appreciated.

Thank you.

Recommended Answers

All 5 Replies

To take input did you use gridview??

Create one html table dynamically like

HtmlTable ht=new HtmlTable();
HtmlTableRow hr=new HtmlTableRow();
HtmlTableCell hc1=new HtmlTableCell();
hc1.innertext ="Prodname";
hr.Cells.Add(hc1);
ht.rows.Add(hr);

To take input did you use gridview??

Thanks for your prompt response. Actually I am not using gridview, instead i am generating rows through Java script.

Then definitely you have maintained id convention when you generate a new row. Add a javascript function for each input textbox for keypress event. So when user enter any number into your input box then you loop through each input box & sum it after that apply discount on cumulative figure. Definitely your total amount input box name is fixed & net amount input box name also fixed. Let me know if you cant understand.

Then definitely you have maintained id convention when you generate a new row. Add a javascript function for each input textbox for keypress event. So when user enter any number into your input box then you loop through each input box & sum it after that apply discount on cumulative figure. Definitely your total amount input box name is fixed & net amount input box name also fixed. Let me know if you cant understand.

Thanks for your prompt response.

If you forward me the correction codes, that will be helpful.

I am enclosing herewith the codes for your perusal.

Thanks

Codes:

<script language="javascript" type="text/javascript">

{

{

function calc_amount(i)for(j=0;j<=i;j++)var total=document.getElementById ("TextBox4").value;var Qty= document.getElementById ("txtQty"+i ).value;var Amt=document .getElementById ("txtamt"+i).value;var Rate=document .getElementById ("txtrate" +i).value;//=" "? 0 : parseInt(document .getElementById("txtrate"));

Amt =Rate *Qty ;

//parseIn//t (total)=total+ Amt;

// total =total +Amt ;

document .getElementById ("txtamt"+i).value = Amt;// document .getElementById ("TextBox4").value= total;

}

}

</script >

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.