Jump to content

javascript calculations


dominicmcafee

Recommended Posts

Given the following code:

updateTotal: function () {

        var total = 0;
        $('input#itemLineTotal').each(function (i) {
            price = $(this).val().replace("$", "");
            if (!isNaN(price)) total += Number(price);
        });

        $('#subTotal').html("$" + this.roundNumber(total, 2));

        var grdTotal = total + this.updateSalesTax();

        grdTotal = this.roundNumber(grdTotal, 2);
        $('#grandTotalTop, #grandTotal').html("$" + grdTotal);

    },

    updateSalesTax: function () {
        var total = 0;

        $('input#itemLineTotal').each(function (i) {
            price = $(this).val().replace("$", "");
            if (!isNaN(price)) total += Number(price);
        });

        var tax = $("#tax").val();
        $("#salesTax").html("$" + mioInvoice.roundNumber(tax, 2));

        return tax;
    },

How can add the tax to the total to give the grand total.  Please help

Link to comment
https://forums.phpfreaks.com/topic/287335-javascript-calculations/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.