Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Not able to get mathematical calculation in each row

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not able to get mathematical calculation in each row

    I have a created a page which have a option two choose multiple row as per requirement but when i choose multiple row then mathematical calculation done for only last row, i am beginner for Java so can anyone help me out for this.

    Please find my below asp code
    <html>
    <head>
    <title>Dispatch Management System&nbsp;Developed by Duravit India Pvt Ltd, IT Department</title>
    <LINK href="style.css" rel="stylesheet" type="text/css">

    <link rel="stylesheet" href="jquery-ui-1.10.4.customNew.css">
    <script src="jqueryNew-1.10.2.js"></script>
    <script src="jqueryNew-ui-1.10.4.custom.js"></script>

    <script>
    $(function() {
    $( "#datepicker" ).datepicker();
    });
    $(function() {
    $( "#datepicker1" ).datepicker();
    });
    $(function() {
    $( "#datepicker2" ).datepicker();
    });
    </script>

    <SCRIPT LANGUAGE="JavaScript">
    function SpCharcheck(e) {
    var num;
    var char;
    if (window.event)
    {
    num = e.keyCode
    }
    else if (e.which)
    {
    num = e.which
    }
    char = String.fromCharCode(num)
    if (char == "<" ||char == ">" ||char == "'" || char == "`" || char == "?")
    {
    return false;
    }
    else {
    return true;
    }
    }

    </script>

    <style>
    .button
    {
    style:solid;
    color:white;
    font-weight:bold;
    style=height:25px; width:200px;
    }

    </style>

    <script type="text/javascript">
    function change_case()
    {
    document.form1.type.value=document.form1.type.valu e.toLowerCase();
    }
    </script>



    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }

    //-->
    </script>

    </head>
    <body text=black>

    <form name=my_cal action="Requisition.asp" method="post">

    <br>

    <table width=100% border=0 cellpadding=0 cellspacing=0>
    <tr align=left><th><FONT style=FONT-SIZE:12pt color=black>Enter DIND Project ref. No.: </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=dindprorefno> &nbsp;&nbsp;&nbsp; <input type=submit class="button" value='Get Details'><br><br></th>


    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Project Int. Ref. No : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=prorefno></th> <th><FONT style=FONT-SIZE:10pt color=black>Date of Proposal : </b></font></th><th><input type=text id=datepicker name=proposaldate></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Name of Project : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=proname></th> <th><FONT style=FONT-SIZE:10pt color=black>Offer Validity : </b></font></th><th><input type=text id=datepicker1 name=offvalidity></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Project Site : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=prosite></th> <th><FONT style=FONT-SIZE:10pt color=black>Price validity up to : </b></font></th><th><input type=text id=datepicker2 name=pricevalidity></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Invoice To : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=invoiceto></th> <th><FONT style=FONT-SIZE:10pt color=black>Sales responsible : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=salesres></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Project Partner : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=propartner></th> <th><FONT style=FONT-SIZE:10pt color=black>Cust Care Resp : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=ccres></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Categaory : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=cat></th> <th><FONT style=FONT-SIZE:10pt color=black>Payment Mode : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=paymentmode></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>No.of Bathrooms : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=bathno></th> <th><FONT style=FONT-SIZE:10pt color=black>Payment terms : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=paymentterms></th></tr>
    <tr align=left><th><FONT style=FONT-SIZE:10pt color=black>Special Remark : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=sremarks></th> <th><FONT style=FONT-SIZE:10pt color=black>Delivery Schedule : </b></font></th><th><input type=text onkeypress="return SpCharcheck(event)" name=delsch></th></tr>
    </table><br>
    <b><FONT style=FONT-SIZE:10pt>
    Select Line : </font> <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
    <%
    Dim i , sel , line
    For i = 1 To 10
    If CInt(Request.QueryString("Line")) = i Then
    sel = "selected"
    Else
    sel = ""
    End IF
    %>
    <option value="<%=Request.ServerVariables("SCRIPT_NAME")%> ?Line=<%=i%>"<%=sel%>><%=i%></option>

    <%
    Next
    %>
    </select><br><br>

    <table width=100% border=5 cellpadding=2 cellspacing=2 FONT style=FONT-SIZE:8pt>
    <tr>

    <td><center><b>Product Code</b><center></td>
    <td><center><b>Product Description</b><center></td>
    <td><center><b>DIAS Rate</b><center></td>
    <td><center><b>Disc on DIAS%</b></center></td>
    <td><center><b>Net to DIND</b><center></td>
    <td><center><div id="loginuser"><b>% of ORC</b><center><center><input type=text size=2 onkeypress="return SpCharcheck(event)" value = 2 name=horc></center></div></td>
    <td><center><b>DIND invoice rate </b></center></td>
    <td><center><b>CST / VAT</b></center><center><input type=text size=2 onkeypress="return SpCharcheck(event)" value = 5 name=hvat></center></td>
    <td><center><b>Net</b></center></td>
    <td><center><b>Octroi/ other</b><input type=text onkeypress="return SpCharcheck(event)" size=2 value= 0 name=hoctroi></center></td>
    <td><center><b>Partner Landed</b></center></td>
    <td><center><b> % of Mark up</b></center><center><input type=text size=2 onkeypress="return SpCharcheck(event)" value = 5 name=hmarkup></center></td>
    <td><center><b>Project Price before VAT</b></center></td>
    <td><center><b>Local VAT %</b><input type=text size=2 onkeypress="return SpCharcheck(event)" value = 14.5 name=hm></center></td>
    <td><center><b>Project landed likely</b></center></td>
    <td><center><b>Qty</b></center></td>
    <td><center><b>Value</b></center></td>
    <td><center><b>Disc to MRP</b></center></td>
    <td><center><b>MRP-10</b></center></td>
    <td><center><b>DIND PI value</b></center></td>
    </font>
    </tr>
    <%
    line = Request.QueryString("line")

    IF line = "" Then
    line = 1
    End IF

    session("line")=Request.QueryString("line")
    session("i")=Request.QueryString("i")
    For i = 1 To line
    %>
    <tr><center>

    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="procode<%=i%>"></td>
    <td><center><input type=text size=15 onkeypress="return SpCharcheck(event)" name="prodesc<%=i%>"></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="diasrate<%=i%>"></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="diasdisc<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="netDIND<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=3 onkeypress="return SpCharcheck(event)" name="orc<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="invoicerate<%=i%>"></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="CVAT<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="net<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="octroi<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="partner<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="markup<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="projectprice<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=3 onkeypress="return SpCharcheck(event)" name="localvat<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="landed<%=i%>"></td>
    <td><center><input type=text size=5 onkeypress="return SpCharcheck(event)" name="qty<%=i%>"></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="value<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="mrpdisc<%=i%>" disabled=disabled></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="mrp10<%=i%>"></td>
    <td><center><input type=text size=8 onkeypress="return SpCharcheck(event)" name="pivalue<%=i%>" disabled=disabled></td></tr>
    <script language="javascript" type="text/javascript">

    function netdind(){

    a=Number(document.my_cal.horc.value);
    b=Number(document.my_cal.hvat.value);
    c=Number(document.my_cal.hmarkup.value);
    d=Number(document.my_cal.hm.value);
    e=Number(document.my_cal.hoctroi.value);
    f=Number(document.my_cal.diasrate<%=i%>.value);
    g=Number(document.my_cal.invoicerate<%=i%>.value);
    h=(g*100/(100+a));
    h=h.toFixed(0);
    document.my_cal.netDIND<%=i%>.value=h;
    i1-(h/f))* 100);
    i=i.toFixed(0)+'%';
    document.my_cal.diasdisc<%=i%>.value=i;
    }
    </script>

    <%
    Next
    %>

    <script>
    //call after page loaded
    window.onload=netdind;
    </script>




    </table><br>

    <center> &nbsp;<input type="button" value="NetDIND" onclick="javascript:netdind();">&nbsp;<input type="hidden" name="hdnLine" value="<%=i-1%>">&nbsp;<INPUT class="button" Type="button" VALUE="Back" onclick="window.location.href='callmain.asp'"></center>
    <pre>
    </form>
    </body>
    </html>


  2. #2
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    411
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Not able to get mathematical calculation in each row

    Java is not the same as Java Script.

    You may have more luck on an Java Script forum.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  3. The Following User Says Thank You to Ada Lovelace For This Useful Post:

    GregBrannon (August 30th, 2014)

  4. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,295
    My Mood
    Mellow
    Thanks
    193
    Thanked 669 Times in 656 Posts

    Default Re: Not able to get mathematical calculation in each row

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags per the above link. Do not post requests for help in Member Introductions.

    Thread moved.

Similar Threads

  1. Replies: 1
    Last Post: July 26th, 2014, 04:38 AM
  2. Using BigDecimal for Mathematical Formulas
    By cooljava50544 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 21st, 2014, 03:05 AM
  3. Replies: 2
    Last Post: December 12th, 2013, 11:01 PM
  4. Mathematical problem with Money amounts
    By craigjlner in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 19th, 2013, 03:12 AM
  5. Java:Evaluation of Mathematical Expression only from left to right only.
    By deepakl_2000 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 15th, 2011, 07:35 AM