Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Display multiple sum results - help needed asap 23.04.2013 16:42

Hi,


I have a calculator that has the following fields..

Hours1
Hours2
Annual Salary


Then in the code I have the following:

$sum=(($hours1+$hours2)/8)*$salary;


This obviously take the two hours divides it by 8 (number of hours in working day) and times it by the salary.

Layout is currently:


Hours1
Hours2
Salary

Sum =


What I want to do is allow the calculator to display an hours1+hours2 sum after the two fields then I want to also introduce another sum display to work out the cost per day (depending on the salary)

So the display would be:

Hours1 (field)
Hours1 (field)

sum display (1+2) =

Salary (field)

Sum display per day =
Sum display per year =



Can you help me with the code and how to do the display please.

Many thanks

Re: Display multiple sum results - help needed asap 23.04.2013 17:56

Hello,
you can output as many results as you need, only adding more result variables to your code:

$result1=$input1+$input2;

$result2=$result1+5;


so you could print at your output ##result1## and/or ##result2##


The result section is below the form, so it will be always printed after the calculate button. If you need to show intermediate results inside the input form, you will need to add some javascript in order to 'move' a section of the result to other position inside the input layout. Or, include that section of the result inside a hidden div, and once the result is displayed, copy its contents to the new position at the input. You will need:

one destination div at your input layout (id="destination")
one result (hidden) div at your output layout (id="myresult")

some script at the event tab (after calculation), which copies the output to the form.

CB("#destination").html(CB("#myresult").html());

CB is calcbuilder alias for jQuery, you can check any official reference of jquery to get more details.

Hope this helps, regards
Moonsoft Team
www.moonsoft.es

Re: Display multiple sum results - help needed asap 25.04.2013 10:14

Okay thanks..will give it a go.
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback