# Help to create a custom calculation for labor fee on a order form

Asked on January 05, 2015 at 04:28 PM

My intent is to create an online order form that can calculate a specific service fee where its 25% of the sub total and must equal at least \$90.

I used to have a JS workaround :

/** * 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().text, 10); } total += price; } }); var interest = .25 * total; var realTotal = total; if (interest < 90) realTotal += 90; else realTotal += interest; if (\$("payment_total")) { \$("payment_total").update(parseFloat(realTotal).toFixed(2)); } if (\$("fees_total")) { \$("fees_total").update(parseFloat(realTotal - total).toFixed(2)); } if (\$("sub_total")) { \$("sub_total").update(parseFloat(total).toFixed(2)); } }, /**

But this is no longer working, ideally it would be cool if I could piggyback this off of the "custom tax" attribute.

Any help would be appreciated

• raul
Answered on January 05, 2015 at 04:59 PM

I thinks this can be achieved by using a couple of calculation widgets in your form to perform the calculations and take your product list outside the payment tool and only pass the total amount to it.

This is a little demo: http://form.jotformpro.com/form/50046907925963 of a form that basically performs a calculation in which the total amount that needs to be paid cannot be less than \$90.

The conditions that will set the Total amount to be paid will be similar to the following:

Please check it out and let us know if this is similar of what you're trying to achieve. If it's not, please provide more details on how you want to make the calculations and we'll certainly do our best to help you to achieve it.

Thanks.