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

    (@edgarrojas)

    Hello!

    So do you want to have a different price depending on the time of the submission? If so yes that is possible using formulas. If you detail me a little bit more your form (like which fields do you have and how is the formula need to calculate the total) i can help you with it =).

    Regards!

    I did like to know if there is a “smart” way to calculate time in Smartforms as well, I use Smartforms to get the user to input working hours so the form can give me a count of overtime and count the inconvenient working hours supplement additional pay its 3 different ones for depending on the day of the week i even get it to work for a 31 day period.

    I made 4 Selectors in a row asking for working hour

    Set up like this (HIN)(MININ) – (HOUT)(MINNOUT) – (TOTAL)
    Label / Option “Label & Amount” / ID

    Hour in / 00-23 / HIN
    Minutes in / 00-59 / MININ

    Hours out / 00-23 / HOUT
    Minutes out / 00-59 / MINOUT

    Total / Formula Builder / TOTAL

    that way the use cant use numbers or formats that makes the code invalid if they are to put it in a single box.

    I use a code like this in the Formula Builder to calculate the total hh:mm

    if (MINOUT>MININ)
    {return RNFRound((HOUT-HIN)-0.40-((((MINOUT-MININ)

    (Math.trunc(((MINOUT-MININ)/60))*60))*0.01)+(Math.trunc(((MINOUT-MININ)/60)))),2);}
    else
    {return RNFRound(((((MINOUT-MININ)

    (Math.trunc(((MINOUT-MININ)/60))*60))*0.01)+(Math.trunc(((MINOUT-MININ)/60))))+(HOUT-HIN),2);}

    and that′s only to calculate if its to remove from one hour or add from one hour then add out – in = total hours.Minutes

    if you only use hours use HOUT-HIN and your set !

    It works i get the total time, From there i do other checks in other text boxes to see if the input falls within each half hours for the inconvenient working hours supplement and those works as well however doing codes like this is 6 X 31 X 4 active fields that checks numbers “it works” it gets a bit slow on the page loading time but it works, Now they want to be able to report double working shifts within every day i manage to get it to work as well but it can take 5-6 minutes for the form to load with all the data and boxes i have them added in one single form in a internet browser .. so if there is an easier way to calculate time with this add-on i did love to know about it !

    btw if you wanna se it in action the form is at

    • https://www.scherdins.finance/?page_id=1697
    • your free to test it out just avoid to submit it in the last step

      the page is in Swedish but in the end of the page there is a flag where you can chance it to what ever language you want to see it in.

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