Support » Plugin: Calculated Fields Form » Slow calculation

  • Resolved FramSteget

    (@framsteget)


    Hello!
    We have a complex form for book printing. The last month or so the calculation is taking a very long time using Chrome. It used to be done in a second not so long ago.
    Do you know if Chrome have made any update that affects javascript?
    We have tried to inactivate plugins and switching theme, but it makes no difference.

    Thanks,
    Patric

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @framsteget,

    Actually, the issue is not related with the browser, I’ve checked the structure of the equations and these are very poor implemented, for example, look the following equation:

    
    (function(){
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 > 0 && fieldname7 < 30) return (fieldname3*fieldname19*0.22);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 30 && fieldname7 < 40) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 40 && fieldname7 < 50) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 50 && fieldname7 < 60) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 60 && fieldname7 < 70) return (fieldname3*fieldname19*0.6);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 70 && fieldname7 < 80) return (fieldname3*fieldname19*0.58);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.86);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.83);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.83);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.118);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.12);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*1.7);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 700) return (fieldname3*fieldname19*2.2);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 > 0 && fieldname7 < 30) return (fieldname3*fieldname19*0.24);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 30 && fieldname7 < 40) return (fieldname3*fieldname19*0.65);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 40 && fieldname7 < 50) return (fieldname3*fieldname19*0.46);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 50 && fieldname7 < 60) return (fieldname3*fieldname19*0.88);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 60 && fieldname7 < 70) return (fieldname3*fieldname19*0.68);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 70 && fieldname7 < 80) return (fieldname3*fieldname19*0.88);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*2.0);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.65);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.56);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.72);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.76);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*2.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*1.9);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 700) return (fieldname3*fieldname19*1.8);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 > 0 && fieldname7 < 30) return (fieldname3*fieldname19*0.66);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 30 && fieldname7 < 40) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 40 && fieldname7 < 50) return (fieldname3*fieldname19*1.05);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 50 && fieldname7 < 60) return (fieldname3*fieldname19*1.12);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 60 && fieldname7 < 70) return (fieldname3*fieldname19*1.22);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 70 && fieldname7 < 80) return (fieldname3*fieldname19*1.12);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*1.14);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.90);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.86);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.05);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*0.98);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*0.82);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*0.68);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 700) return (fieldname3*fieldname19*0.42);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 > 0 && fieldname7 < 30) return (fieldname3*fieldname19*0.15);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 30 && fieldname7 < 40) return (fieldname3*fieldname19*0.74);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 40 && fieldname7 < 50) return (fieldname3*fieldname19*0.85);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 50 && fieldname7 < 60) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 60 && fieldname7 < 70) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 70 && fieldname7 < 80) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*1.02);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.87);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*0.95);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*0.94);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*0.81);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*0.82);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*0.71);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*0.71);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*0.84);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 700) return (fieldname3*fieldname19*0.84);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 > 0 && fieldname7 < 30 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.62);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 30 && fieldname7 < 40 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 40 && fieldname7 < 50 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 50 && fieldname7 < 60 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.82);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 60 && fieldname7 < 70 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.88);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 70 && fieldname7 < 80 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 80 && fieldname7 < 100 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.85);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 100 && fieldname7 < 150 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 150 && fieldname7 < 200 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 200 && fieldname7 < 250 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.76);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 250 && fieldname7 < 300 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.63);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 300 && fieldname7 < 350 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.53);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 350 && fieldname7 < 400 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.58);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 400 && fieldname7 < 500 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.28);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 500 && fieldname7 < 600 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.07);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname7 >= 600 && fieldname7 < 1000 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.05);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 0 && fieldname9 < 30) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 30 && fieldname9 < 40) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 40 && fieldname9 < 50) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 50 && fieldname9 < 60) return (fieldname3*fieldname19*2.4);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 60 && fieldname9 < 70) return (fieldname3*fieldname19*4.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 70 && fieldname9 < 80) return (fieldname3*fieldname19*4.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*1.65);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 700) return (fieldname3*fieldname19*0.5);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 0 && fieldname9 < 30) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 30 && fieldname9 < 40) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 40 && fieldname9 < 50) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 50 && fieldname9 < 60) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 60 && fieldname9 < 70) return (fieldname3*fieldname19*0.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 70 && fieldname9 < 80) return (fieldname3*fieldname19*0.3);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*0.55);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 700) return (fieldname3*fieldname19*0.5);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 0 && fieldname9 < 30) return (fieldname3*fieldname19*0.48);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 30 && fieldname9 < 40) return (fieldname3*fieldname19*0.30);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 40 && fieldname9 < 50) return (fieldname3*fieldname19*0.54);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 50 && fieldname9 < 60) return (fieldname3*fieldname19*0.35);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 60 && fieldname9 < 70) return (fieldname3*fieldname19*0.09);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 70 && fieldname9 < 80) return (fieldname3*fieldname19*0.09);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*0.40);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*0.35);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*0.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*0.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*0.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*0.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*0.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 700) return (fieldname3*fieldname19*0.1);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 0 && fieldname9 < 30) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 30 && fieldname9 < 40) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 40 && fieldname9 < 50) return (fieldname3*fieldname19*0.58);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 50 && fieldname9 < 60) return (fieldname3*fieldname19*0.52);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 60 && fieldname9 < 70) return (fieldname3*fieldname19*0.10);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 70 && fieldname9 < 80) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.65);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*0.62);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*0.47);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*0.28);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*0.22);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*0.18);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*0.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*0.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*0.1);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 700) return (fieldname3*fieldname19*0.05);
    
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 0 && fieldname9 < 30) return (fieldname3*fieldname19*0.35);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 30 && fieldname9 < 40) return (fieldname3*fieldname19*0.41);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 40 && fieldname9 < 50) return (fieldname3*fieldname19*0.28);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 50 && fieldname9 < 60) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 60 && fieldname9 < 70) return (fieldname3*fieldname19*0.25);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 70 && fieldname9 < 80) return (fieldname3*fieldname19*0.15);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.18);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*0.06);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*0.06);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*0.08);
    if((fieldname3 == 1 || fieldname3 == 2.71 || fieldname3 == 3) && fieldname19 >= 1000 && fieldname9 >= 700) return (fieldname3*fieldname19*0.08);
    
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname19 < 300) return (fieldname3*fieldname19*1.05);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname9 > 0 && fieldname19 >= 300 && fieldname19 < 500) return (fieldname3*fieldname19*1.23);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname9 > 0 && fieldname19 >= 500 && fieldname19 < 1000) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname9 > 0 && fieldname19 >= 1000) return (fieldname3*fieldname19*2.0);
    
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 300 && fieldname7 < 400 && fieldname19 >= 500 && fieldname19 < 1000) return (fieldname3*fieldname19*1.4);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 400 && fieldname7 < 500 &&  fieldname19 >= 500 && fieldname19 < 1000) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 500 && fieldname7 < 600 && fieldname19 >= 500 && fieldname19 < 1000) return (fieldname3*fieldname19*2.3);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 600 && fieldname7 < 1000 && fieldname19 >= 500 && fieldname19 < 1000) return (fieldname3*fieldname19*2.5);
    
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 > 0 && fieldname7 < 50 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 50 && fieldname7 < 80 && fieldname19 >= 1000) return (fieldname3*fieldname19*0.98);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 80 && fieldname7 < 100 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.05);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 100 && fieldname7 < 150 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.1);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 150 && fieldname7 < 200 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 200 && fieldname7 < 250 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 250 && fieldname7 < 300 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.43);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 300 && fieldname7 < 350 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.53);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 350 && fieldname7 < 400 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.65);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 400 && fieldname7 < 500 && fieldname19 >= 1000) return (fieldname3*fieldname19*1.73);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 500 && fieldname7 < 600 && fieldname19 >= 1000) return (fieldname3*fieldname19*2.3);
    if((fieldname3 == 4.1 || fieldname3 == 7.46) && fieldname7 >= 600 && fieldname7 < 1000 && fieldname19 >= 1000) return (fieldname3*fieldname19*2.5);
    
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 > 0 && fieldname7 < 50) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 50 && fieldname7 < 80) return (fieldname3*fieldname19*0.65);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.82);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.83);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.87);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.1);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.118);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*1.86);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname7 >= 700) return (fieldname3*fieldname19*2.4);
    
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 > 0 && fieldname7 < 50) return (fieldname3*fieldname19*0.52);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 50 && fieldname7 < 80) return (fieldname3*fieldname19*0.68);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.9);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*1.1);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.38);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.56);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.72);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.76);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*2.2);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*2.82);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname7 >= 700) return (fieldname3*fieldname19*3.2);
    
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 > 0 && fieldname7 < 50) return (fieldname3*fieldname19*0.45);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 50 && fieldname7 < 80) return (fieldname3*fieldname19*0.52);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.64);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.70);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.86);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.05);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.18);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.4);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.58);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.7);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*2.05);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*2.5);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname7 >= 700) return (fieldname3*fieldname19*2.9);
    
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 > 0 && fieldname7 < 50) return (fieldname3*fieldname19*0.3);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 50 && fieldname7 < 80) return (fieldname3*fieldname19*0.42);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.52);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.62);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*0.82);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.15);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.34);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*1.52);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*1.68);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*1.84);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*2.4);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*2.9);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname7 >= 700) return (fieldname3*fieldname19*3.4);
    
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 > 0 && fieldname7 < 50) return (fieldname3*fieldname19*0.435);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 50 && fieldname7 < 80) return (fieldname3*fieldname19*0.53);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 80 && fieldname7 < 100) return (fieldname3*fieldname19*0.73);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 100 && fieldname7 < 150) return (fieldname3*fieldname19*0.8);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 150 && fieldname7 < 200) return (fieldname3*fieldname19*1.15);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 200 && fieldname7 < 250) return (fieldname3*fieldname19*1.42);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 250 && fieldname7 < 300) return (fieldname3*fieldname19*1.72);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 300 && fieldname7 < 350) return (fieldname3*fieldname19*2.0);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 350 && fieldname7 < 400) return (fieldname3*fieldname19*2.25);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 400 && fieldname7 < 500) return (fieldname3*fieldname19*2.65);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 500 && fieldname7 < 600) return (fieldname3*fieldname19*3.25);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 600 && fieldname7 < 700) return (fieldname3*fieldname19*3.8);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname7 >= 700) return (fieldname3*fieldname19*4.4);
    
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 0 && fieldname9 < 50) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 50 && fieldname9 < 80) return (fieldname3*fieldname19*1.8);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.4);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.7);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*1.6);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*1.8);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*1.9);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*2.4);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*3.3);
    if((fieldname3 == 19.30) && fieldname19 >= 50 && fieldname19 < 100 && fieldname9 >= 700) return (fieldname3*fieldname19*3.94);
    
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 0 && fieldname9 < 50) return (fieldname3*fieldname19*1.2);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 50 && fieldname9 < 80) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*1.3);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.16);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.55);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*2.05);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*2.64);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*3.2);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*3.85);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*4.4);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*4.7);
    if((fieldname3 == 19.30) && fieldname19 >= 100 && fieldname19 < 300 && fieldname9 >= 700) return (fieldname3*fieldname19*5.35);
    
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 0 && fieldname9 < 50) return (fieldname3*fieldname19*0.7);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 50 && fieldname9 < 80) return (fieldname3*fieldname19*0.7);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.87);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.15);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.5);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*1.9);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*2.3);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*2.85);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*3.35);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*3.5);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*4.55);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*5.4);
    if((fieldname3 == 19.30) && fieldname19 >= 300 && fieldname19 < 500 && fieldname9 >= 700) return (fieldname3*fieldname19*6.15);
    
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 0 && fieldname9 < 50) return (fieldname3*fieldname19*0.5);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 50 && fieldname9 < 80) return (fieldname3*fieldname19*0.6);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*0.92);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.38);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*1.9);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*2.38);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*2.78);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*3.2);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*3.8);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*4.7);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*5.4);
    if((fieldname3 == 19.30) && fieldname19 >= 500 && fieldname19 < 1000 && fieldname9 >= 700) return (fieldname3*fieldname19*6.4);
    
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 0 && fieldname9 < 50) return (fieldname3*fieldname19*0.58);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 50 && fieldname9 < 80) return (fieldname3*fieldname19*0.75);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 80 && fieldname9 < 100) return (fieldname3*fieldname19*1.0);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 100 && fieldname9 < 150) return (fieldname3*fieldname19*1.26);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 150 && fieldname9 < 200) return (fieldname3*fieldname19*1.9);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 200 && fieldname9 < 250) return (fieldname3*fieldname19*2.5);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 250 && fieldname9 < 300) return (fieldname3*fieldname19*2.88);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 300 && fieldname9 < 350) return (fieldname3*fieldname19*3.35);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 350 && fieldname9 < 400) return (fieldname3*fieldname19*4.2);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 400 && fieldname9 < 500) return (fieldname3*fieldname19*4.65);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 500 && fieldname9 < 600) return (fieldname3*fieldname19*5.7);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 600 && fieldname9 < 700) return (fieldname3*fieldname19*6.57);
    if((fieldname3 == 19.30) && fieldname19 >= 1000 && fieldname9 >= 700) return (fieldname3*fieldname19*7.48);
    })()
    

    You have implemented an equation with 340 conditional statements (and there are at least 6 equations with similar structure)

    The plugin applies a replace action of the texts with the structure fieldname# by the corresponding fields’ values, so, if you reduce the number of replacements the equation would evaluated faster, another recommended improvement would be nesting the conditional statements.

    For example, a partial implementation of the previous equation would be (the following partial equation does not includes all your conditional statements, but give you an idea of my previous recommendations):

    
    (function(){
    	var f3 = fieldname3, 
    		f19 = fieldname19, 
    		f7 = fieldname7, 
    		f9 = fieldname9, 
    		f3 = fieldname3, 
    		c1 = (f3 == 1 || f3 == 2.71 || f3 == 3),
    		c2 = (f19 >= 50 && f19 < 100),
    		c3 = (f19 >= 100 && f19 < 300),
    		c4 = (f19 >= 300 && f19 < 500),
    		result = f3*f19,
    		n;
    
    	if(c1)
    	{
    		if(c2)
    		{
    			if(0 < f7)
    			{
    				if(f7<30) n = 0.22;
    				else if(f7 < 40) n = 0.45;
    				else if(f7 < 50) n = 0.45;
    				else if(f7 < 60) n = 0.55;
    				else if(f7 < 70) n = 0.6;
    				else if(f7 < 80) n = 0.58;
    				else if(f7 < 100) n = 0.86;
    				else if(f7 < 150) n = 0.83;
    				else if(f7 < 200) n = 0.83;
    				else if(f7 < 250) n = 1;
    				else if(f7 < 300) n = 1.1;
    				else if(f7 < 400) n = 1.12;
    				else if(f7 < 500) n = 1.2;
    				else if(f7 < 600) n = 1.5;
    				else if(f7 < 700) n = 1.7;
    				else n = 2.2;
    				return result * n;
    			}
    		}
    		else if(c3)
    		{
    			if(0<f7)
    			{
    				if(f7 < 30) n = 0.24;
    				else if(f7 < 40) n = 0.65;
    				else if(f7 < 50) n = 0.46;
    				else if(f7 < 60) n = 0.88;
    				else if(f7 < 70) n = 0.68;
    				else if(f7 < 80) n = 0.88;
    				else if(f7 < 100) n = 1.2;
    				else if(f7 < 150) n = 1.5;
    				else if(f7 < 200) n = 2.0;
    				else if(f7 < 250) n = 1.3;
    				else if(f7 < 300) n = 1.65;
    				else if(f7 < 350) n = 1.56;
    				else if(f7 < 400) n = 1.72;
    				else if(f7 < 500) n = 1.76;
    				else if(f7 < 600) n = 2.1;
    				else if(f7 < 700) n = 1.9;
    				else n = 1.8;
    				return result * n;
    			}	
    		}
    		else if(c4)
    		{
    			if(0<f7)
    			{
    				if(f7 < 30) n = 0.66;
    				else if(f7 < 40) n = 0.9;
    				else if(f7 < 50) n = 1.05;
    				else if(f7 < 60) n = 1.12;
    				else if(f7 < 70) n = 1.22;
    				else if(f7 < 80) n = 1.12;
    				else if(f7 < 100) n = 1.14;
    				else if(f7 < 150) n = 0.90;
    				else if(f7 < 200) n = 0.86;
    				else if(f7 < 250) n = 1.05;
    				else if(f7 < 300) n = 0.98;
    				else if(f7 < 350) n = 0.82;
    				else if(f7 < 400) n = 0.8;
    				else if(f7 < 500) n = 0.92;
    				else if(f7 < 600) n = 0.8;
    				else if(f7 < 700) n = 0.68;
    				else n = 0.42;
    				return result * n;
    			}
    		}
    	}	
    
    	/** THE OTHER CONDITIONS FROM HERE **/
    })()
    

    Best regards.

    • This reply was modified 2 years, 3 months ago by codepeople.

    Thanks for the reply.
    Can we hire you to rework the code for the form? If so what would it cost?

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @framsteget,

    If you need a custom coding service, do not hesitate in contact me through my private website with a detailed description of your project:

    https://cff.dwbooster.com/customization

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Slow calculation’ is closed to new replies.