Posts: 2
Threads: 1
Joined: Jul 2013
Hi,
I'd like to know whether there's a solution for this little problem of mine. I currently have Joomla installed as the CMS for my site (efanappies.co.za). I'm in the process of rebuilding a responsive downscaled site on GS. The test site is currently on buynappies.co.za.
On the following page,
www.efanappies.co.za/nappy-usage-calculator, you'll see a calculator specifically set up for determining nappy costs. I was wondering whether there's not a similar type calculator I could create somewhere, to implement on
www.buynappies.co.za/nappy-cost-calculator, which will be ported to the other site.
Thanks in advance for any help. GS is a great system.
Posts: 6,266
Threads: 181
Joined: Sep 2011
Not really sure, but here is the code.
onclick="calcGetTotal_108(108,1);"
Code:
function calcGetTotal_108(mid, pass)
{
rad = (1/180)*Math.PI;
function sin(angle) { return Math.sin(angle*rad); }
function cos(angle) { return Math.cos(angle*rad); }
function tan(angle) { return Math.tan(angle*rad); }
function asin(angle) { return Math.asin(angle*rad); }
function acos(angle) { return Math.acos(angle*rad); }
function atan(angle) { return Math.atan(angle*rad); }
var field1 = parseFloat(document.getElementById('field1_'+mid).value);
field1 = field1 ? field1 : 0;
var field2 = parseFloat(document.getElementById('field2_'+mid).value);
field2 = field2 ? field2 : 0;
var field3 = parseFloat(document.getElementById('field3_'+mid).value);
field3 = field3 ? field3 : 0;
var field4 = parseFloat(document.getElementById('field4_'+mid).value);
field4 = field4 ? field4 : 0;
var field5 = parseFloat(document.getElementById('field5_'+mid).value);
field5 = field5 ? field5 : 0;
var field6 = parseFloat(document.getElementById('field6_'+mid).value);
field6 = field6 ? field6 : 0;
var result1 = parseFloat(document.getElementById('result1_'+mid).value);
result1 = result1 ? result1 : 0;
var result2 = parseFloat(document.getElementById('result2_'+mid).value);
result2 = result2 ? result2 : 0;
var result3 = parseFloat(document.getElementById('result3_'+mid).value);
result3 = result3 ? result3 : 0;
result1 = parseFloat(addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91)))));
document.getElementById('result1_108').value = addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))));
document.getElementById('result1_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))));
result2 = parseFloat(addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350))));
document.getElementById('result2_108').value = addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350)));
document.getElementById('result2_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350)));
result3 = parseFloat(addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00)))));
document.getElementById('result3_108').value = addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00))));
document.getElementById('result3_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00))));
if (!pass) {
calcGetTotal_108(mid, 1);
}
return true;
}
Posts: 2
Threads: 1
Joined: Jul 2013
(2013-07-17, 05:31:54)shawn_a Wrote: Not really sure, but here is the code.
onclick="calcGetTotal_108(108,1);"
Code:
function calcGetTotal_108(mid, pass)
{
rad = (1/180)*Math.PI;
function sin(angle) { return Math.sin(angle*rad); }
function cos(angle) { return Math.cos(angle*rad); }
function tan(angle) { return Math.tan(angle*rad); }
function asin(angle) { return Math.asin(angle*rad); }
function acos(angle) { return Math.acos(angle*rad); }
function atan(angle) { return Math.atan(angle*rad); }
var field1 = parseFloat(document.getElementById('field1_'+mid).value);
field1 = field1 ? field1 : 0;
var field2 = parseFloat(document.getElementById('field2_'+mid).value);
field2 = field2 ? field2 : 0;
var field3 = parseFloat(document.getElementById('field3_'+mid).value);
field3 = field3 ? field3 : 0;
var field4 = parseFloat(document.getElementById('field4_'+mid).value);
field4 = field4 ? field4 : 0;
var field5 = parseFloat(document.getElementById('field5_'+mid).value);
field5 = field5 ? field5 : 0;
var field6 = parseFloat(document.getElementById('field6_'+mid).value);
field6 = field6 ? field6 : 0;
var result1 = parseFloat(document.getElementById('result1_'+mid).value);
result1 = result1 ? result1 : 0;
var result2 = parseFloat(document.getElementById('result2_'+mid).value);
result2 = result2 ? result2 : 0;
var result3 = parseFloat(document.getElementById('result3_'+mid).value);
result3 = result3 ? result3 : 0;
result1 = parseFloat(addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91)))));
document.getElementById('result1_108').value = addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))));
document.getElementById('result1_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))));
result2 = parseFloat(addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350))));
document.getElementById('result2_108').value = addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350)));
document.getElementById('result2_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat(((field1*91)+(field2*91)+(field3*182)+(field4*364)+(field5*91))*0.350)));
result3 = parseFloat(addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00)))));
document.getElementById('result3_108').value = addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00))));
document.getElementById('result3_'+mid+'_output').innerHTML = addCommas(Math.round(parseFloat(((field1*91)*1.80)+((field2*91)*2.50)+((field3*182)*3.40)+((field4*364)*4.00)+((field5*91)*4.00))));
if (!pass) {
calcGetTotal_108(mid, 1);
}
return true;
}
Hi Shawn,
Thanks so much for your effort, but I have NO idea what you did ;-)
I don't know how to implement that code. I know it's JS, but that's about it. :-(