How can I implement a custom labor charge on top of item sub total?

  • Profile Image
    Spade12
    Asked on August 01, 2011 at 03:13 AM

    Hey there, I'm trying to put together an order form with various AV equipment.  I want to be able to include a 25% labor charge when orders are at least $90.00.  So far I tried adding a few lines to jotform.jss with no avail, here are the changes I made:

     

    /**
         * Calculates the payment total with quantites
         * @param {Object} prices
         */
        
    countTotal: function(prices){
        
            var 
    total 0;
            
    $H(prices).each(function(pair){
                
    total parseFloat(total);
                var 
    price parseFloat(pair.value.price);
                if ($(
    pair.key).checked) {
                    if ($(
    pair.value.quantityField)) {
                        
    price price parseInt($(pair.value.quantityField).getSelected().text10);
                    }
                    
    total += price;
                }
            });
            
            if (
    total === 0) {
                
    total "0.00";
               }
         else if (
    total 90){
                
    total += (total .25);
           }
            if ($(
    "payment_total")) {
                $(
    "payment_total").update(parseFloat(total).toFixed(2));
            }
        },
        
    /**
         * Sets the events for dynamic total calculation
         * @param {Object} prices
         */
        
    totalCounter: function(prices){
            
    $H(prices).each(function(pair){
                $(
    pair.key).observe('click', function(){
                    
    JotForm.countTotal(prices);
                });
                if ($(
    pair.value.quantityField)) {
                    $(
    pair.value.quantityField).observe('change', function(){
                        $(
    pair.key).checked true;
                        
    JotForm.countTotal(prices);
                    });
                }
            });
        }, 
  • Profile Image
    brx250
    Answered on August 02, 2011 at 03:27 AM

    Hi brady,

    Your question has already been answered through your first post. Please follow this thread.

    https://www.jotform.com/answers/36678-Adding-custom-rate-to-dynamic-total#1

    Thank you.

    _____________________________________________ 

    Albert JotFrom Support