calculate TOTAL CONSUMPTION and Consumption per person
<p>I try to calculate calculate TOTAL Consumption and Consumption per person.</p>

<p>Relevant code :</p>

<pre><code>$(function () {
    $(".items").keyup(function (event) {
        var total = 0;
        $(".items").each(function () {
            var gtotal = 0;
            $(this).find(".targetfields").each(function () {
           var qty = parseInt($(this).find(".quantity").val()||'0');
           var rate = parseInt($(this).find(".rate").val()||'0');
                var subtotal = qty * rate;
                $(this).find(".subtotal").val(subtotal);
                if (!isNaN(subtotal)) gtotal += subtotal;

            });
            $(this).find(".g_total").html(gtotal + "Din");
            total += gtotal;
        });
        $("#total").html(total + "Din");
    });

});
</code></pre>

<p>A fiddle for the tests : <a href="http://jsfiddle.net/Odisej/CgeHU/" rel="nofollow">http://jsfiddle.net/Odisej/CgeHU/</a></p>

<p>I get stuck...What's wrong in this script?</p>
