Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:15:20+00:00 2026-06-05T15:15:20+00:00

I am building an invoice with grails, and for dynamical calculation I am using

  • 0

I am building an invoice with grails, and for dynamical calculation I am using jquery.

I don’t know, may be its not a good solution and I am not that fit in javascript. May be someone could help me, here we go:

<thead>
    <tr>
        <g:sortableColumn style="width: 20px" property="id" title="${message(code: 'packet.id.label', default: 'Id')}" />
        <g:sortableColumn style="width: 10px" property="anzahl" title="${message(code: 'packet.anzahl.label', default: 'Anzahl')}" />
        <th><g:message style="width: 250px" code="packet.artikel.label" default="   Artikel    " /></th>
        <th><g:message code="packet.artikel.label" default="   Steuer in %   " /></th>
        <th><g:message code="packet.artikel.label" default="   Preis pro Stück in €  " /></th>
        <th><g:message code="packet.artikel.label" default="   Preis Gesammt in € " /></th>
    </tr>
</thead>
<tbody>
    <g:each in="${packetInstanceList}" status="i" var="packetInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <td><g:link controller="packet" action="show"  id="${packetInstance.id}">${fieldValue(bean: packetInstance, field: "id")}</g:link></td>
            <td><input name="q" class="st" type="text" style="background-color:transparent;border:0px solid white;" value="${fieldValue(bean: packetInstance, field: "anzahl")}" onclick="if (this.value=='Search') {this.value = '';}" readonly="true"/>
            <!--  ${fieldValue(bean: packetInstance, field: "anzahl")}    -->
            </td>
            <td nowrap>${fieldValue(bean: packetInstance, field: "artikel")}</td>

that creates a html with many rows with

        <tr class="even">
            <td><a href="/test/packet/show/17">17</a></td>
            <td><input name="q" class="st" type="text" style="background-color:transparent;border:0px solid white;" value="1,222" onclick="if (this.value=='Search') {this.value = '';}" readonly="true"/>
                <!--  1,222    -->
            </td>
            <td nowrap> Blueray,Arthouse </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-steuer" value="19"/> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-value"  /> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="output-value" readonly />
            </td>
        </tr>
        <tr class="odd">
            <td><a href="/test/packet/show/18">18</a></td>
            <td><input name="q" class="st" type="text" style="background-color:transparent;border:0px solid white;" value="100" onclick="if (this.value=='Search') {this.value = '';}" readonly="true"/>
                <!--  100    -->
            </td>
            <td nowrap> Blueray,Arthouse </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-steuer" value="19"/> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-value"  /> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="output-value" readonly />
            </td>
        </tr>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-steuer" value="19"/> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="input-value"  /> </td>
            <td> <input type="text" style="background-color:transparent;border:0px solid white;" class="output-value" readonly />
            </td>
        </tr>
    </g:each>

As you can see these rows have same classes.

Here is jquery code:

$(document).ready(function() {
    $(".input-value").keyup(function() {
        // var output = $(".output-value");
        var test = 0;

        $('.input-value').each(function() {
            var value = parseFloat($(this).val());
            var value3 = parseFloat($(".st").val());
            var value2 = parseFloat($(".input-steuer").val());

            //output.val(((value - value * value2/100)*value3).toFixed(2));
            score = ((value - value * value2/100)*value3);
            score = score.toFixed(2);
            //output.val(score);
            test+=score;
        });

        $(".output-value").val(test);
    });
});

This calculates only the first row and not each row,
I´d like to have a output for every row
and sum of the all outputs, but I am not used to javascript…

It feels like it is simple, but not for me.

Thanks for your time

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:15:22+00:00Added an answer on June 5, 2026 at 3:15 pm
    $(".input-value").keyup(function() {
    
        var value = parseFloat($(this).val());
        var value2;
        var value3;var temp=0;var temp1 = 0;
        $(this).parent().siblings().each(function() {
            if ($(this).children().hasClass('input-steuer')) {
                value2 = $(this).children().val();
            }
            if ($(this).children().hasClass('st')) {
                value3 = $(this).children().val();
            }
        });
        score = ((value - value * value2 / 100) * value3);
        $(this).parent().next('td').children('.output-value').val((score).toFixed(2));
        $('.output-value').each(function(){
            temp1 = $(this).val();        
            alert(temp1);
            if(temp1 == 'NaN' || temp1 == '') {
               temp1 = 0.0; 
            }
            temp = parseFloat(temp) + parseFloat(temp1); 
        });
        $('#wholesum').val(temp.toFixed(2));
    });​
    

    Have a nice day!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a solution that includes printing an invoice out of the web
building a site using PHP and MySQL that needs to store a lot of
Building a commercial product may use various open source libraries that have use of
I'm building an app in CodeIgniter. I have an invoice form which uses jQuery
I am building an invoice system, where I will use jQuery, to update fields.
Building an app using a calendar on a Google Apps domain that has SSL
So lately I've been thinking of building and implementing my own invoice system with
Building a Django app on a VPS. I am not very experienced with setting
Building a website that has English & Japanese speaking users, with the Japanese users
Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.