Sum of items when changing a record

1

I have 3 items Accessories, Tires and Vehicles, values are added to a maintenance screen that is the main one. The problem is that when it is to change just one of the items, the value added is just what I selected. But it is not updated with the other values

var TotalVeiculo; 
var TotalAcessorio;
var TotalPneu; 

function Somatorio(){
    TotalVeiculo = TotalVeiculo != undefined?TotalVeiculo:0;
    TotalAcessorio = TotalAcessorio != undefined?TotalAcessorio:0;
    TotalPneu = TotalPneu != undefined?TotalPneu:0;

    vmObjeto.selecionado.VlrTotalManutencao = (TotalVeiculo + TotalAcessorio + TotalPneu);
    $("#total").html("R$ " + vmObjeto.selecionado.VlrTotalManutencao + ",00");
}

function RetornoItemsa(aTela, aItens, pneu, total, quantia) {           
    var window = $(aTela).data("kendoWindow");
    window.close();

    ItensVeiculos =  aItens;
    TotalVeiculo = parseFloat(total);
    $("#btnItensVeiculos").html(" Veículos("+quantia+")");
    Somatorio();
};

function RetornoItemsb(aTela, aItens, pneu, total, quantia) {   
    var window = $(aTela).data("kendoWindow");
    window.close();
        ItensAcessoriosVeiculos =  aItens;
        TotalAcessorio = parseFloat(total);
        $("#btnItensAcessoriosVeiculos").html("Acessórios ("+quantia+")");
        Somatorio();
};

function RetornoItemsc(aTela, aItens, pneu, total, quantia) {   
    var window = $(aTela).data("kendoWindow");
    window.close();

        ItensPneusVeiculos = aItens;
        TotalPneu = parseFloat(total);
        $("#btnItensPneusVeiculos").html("Pneus ("+quantia+")");
        Somatorio();
};
    
asked by anonymous 02.07.2015 / 20:42

0 answers