Calculate total rate with amount of days selected

  • motoxplorers
    Asked on February 3, 2015 at 12:01 PM

    Hello from Portugal guys, I research in forum about a solution for this and I did not found any that suits my needs. Hope you can help me.

    I'm building a form to book motorcycle rental, I manage to use the Form calculation Widget but I do not know how to include in the calculation the amount of days of rental.

    You can check my form in http://form.jotformeu.com/form/50334785628361

    What I need it's to include in the Total Rental a value per day corresponding to:

    1 to 3 days:      105€/day

    4 to 6 days:        95€/day

    7 a 13 days:      85€/day

    14 days +:         77€/day

    I saw you guys did magic in other situations similar to this one, but to be honest with you I'm a complete dummy in this matters. My website it's on WIX so I can not include long scritps on it... the perfect solution wold be to import my form and had the calculations script on it so I can import him back...

    if you can help me I really appreciate it :)

    Obrigado / Thanks

  • Sean
    Replied on February 3, 2015 at 4:28 PM

    Hello motoxplorers,

    We are more than happy to help out. If I am not mistaken, you would like to know how to calculate the Total Charge that will be applied to a motorcycle rental that can span from 1 day to over 14 days with the various per day fees you mentioned above. To get this done we will definitely have to use conditional logic statements as well as the form calculation widget. 

    I have cloned your form and made the necessary changes below:
    http://form.jotformpro.com/form/50336048580958

    Unfortunately, the Date Picker widget that is currently on your form will not work as it should with the Form Calculation widget so it is recommended that you use the default Date Time Field under the Quick Tools tab.

    Calculate total rate with amount of days selected Image 1 Screenshot 80

    We now need to use a Form Calculation Widget to calculate the difference between the pickup date and drop off date and use a Number field to store the daily charge. These fields should be hidden.

    Calculate total rate with amount of days selected Image 2 Screenshot 91

    Calculate total rate with amount of days selected Image 3 Screenshot 102

    Now that we can have the day count, it is time for us to use conditional logic statements to determine the daily charge: https://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Calculation-into-a-Field-Using-Conditional-Logic 
    Calculate total rate with amount of days selected Image 4 Screenshot 113

    Calculate total rate with amount of days selected Image 5 Screenshot 124

    You should repeat this process with the appropriate condition for each price difference like shown below.

    Calculate total rate with amount of days selected Image 6 Screenshot 135

    Now you are going to add the charge for the motorcycle rental to your Total Charge form calculation widget.

    Calculate total rate with amount of days selected Image 7 Screenshot 146

    This should work just fine. Do let us know if further assistance is needed.


    Cheers!
    Sean

  • motoxplorers
    Replied on February 4, 2015 at 5:41 AM

    AMAZING!!! you not only did it for me, you explained how to do it and I now understand and know how to do it. Thank you Sean, Muito Obrigado!!

    Actually there was some calculations not working in the right way on the form you build, but you explained so well that it was easy to correct. The total days were not being counted to the right number field and they were not included in the final calculation, thanks to you explanation it was easy to identify the error and correct it.

    Thank you again, I will try now to insert a new parameter on the calculation, the pick up and drop off must be in the same hour so they complete 24h rental. If more than 24h we have to increase the calculation in one day. Like if someone pick the bike at 10AM and drop off on the next day at 6PM we have to calculate 2 days and not only one.

    Lets see if I can do it myself with your teachings, if not I call for help again :)

    Obrigado / Thank you

  • Ashwin JotForm Support
    Replied on February 4, 2015 at 9:31 AM

    Hello motoxplorers,

    On behalf of my colleague @Sean, you are welcome.

    Do try it yourself and get back to us if you have any questions, we will surely help you.

    Thank you!

  • motoxplorers
    Replied on February 4, 2015 at 12:20 PM

    Hello guys, thanks to Sean and Ashwin help I manage to do all the form and it's working perfectly.

    I'm proud of :) http://form.jotformeu.com/form/50342176208348

    I just need your help for another 2 things I tried but I was not able to found how.

    I need to count more than 24h hours period as + on day rental, so if a client book a bike from 10:00 on day 2 to 14:00 the form calculator can increase in a day the rentals days.

    Do you think it's possible or it's to complicate? I tried to do it in the calendar picker and in normal drop down box with times from 10AM to 8PM (our store time table) but none of those let me chose the right calculation formula.

    The second thing it's a little bit simple I think, I just can not do it because I can not edit the code (the form codes must be hosted in your servers and I can not edit it).

    I need to put the prices of optional accessories as sub labels in smaller letters under the description of the optionals. I can not do it because check boxes do not allow sub labels. 

    Hope you can help me again

    Obrigado / Thank you

     

     

  • Kiran Support Team Lead
    Replied on February 4, 2015 at 3:58 PM

    To address the 24 hours issue, I understand that you want to add another day if the vehicle is held with the customer more than 24 hours period.

    Following are the changes that I made to your cloned JotForm.

    1. Removed dropdown boxes for time field and added time field instead

    Calculate total rate with amount of days selected Image 1 Screenshot 50

    2. Added a calculation (hidden) field to the form to calculate time difference 

    Calculate total rate with amount of days selected Image 2 Screenshot 61

    3. Added another calculation (hidden) field to add 1 if there is a positive time difference for additional day rental. 

    Calculate total rate with amount of days selected Image 3 Screenshot 72

    4. Add another day field value to Rental days.

    Calculate total rate with amount of days selected Image 4 Screenshot 83

    Please see the below JotForm if that meets your requirement. 

    http://www.jotformpro.com/form/50345137227955

    Please check and let us know if this works for you.

    The other query on formatting the prices as sublabels shall be addressed separately at the below thread.

    http://www.jotform.com/answers/509927

    Thank you!

  • motoxplorers
    Replied on February 5, 2015 at 8:29 AM

    Hi Kiran, that should work perfectly for my needs, but the I have now two issues...

    1th issue: the client can select pick ups at 1am, 6am and so.. I need to fix this in only my store time table, from 10AM to 8PM only.

    2th issue:

    do you know how to enlarge a bit the time field box in the form? It's not pretty as it is, cutting the numbers ;)

    Thank you for you help, I really appreciate it! JotForm team is amazing.

     

  • Kiran Support Team Lead
    Replied on February 5, 2015 at 10:38 AM

    Okay. I've changed the time field to dropdown for both pick-up and drop-off and added calculation values to it. The calculations and conditions remain same as we did for time field.

    Calculate total rate with amount of days selected Image 1 Screenshot 20

    Please see the updated JotForm at http://www.jotformpro.com/form/50345137227955 

    You may clone this JotForm to your account by following the guide 

    http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL

    Hope it works for you!

    The second issue with enlarging the time field is moved to a separate thread and shall be addressed there.

    http://www.jotform.com/answers/510480

    Let us know if you need any further assistance. Thanks!

  • motoxplorers
    Replied on February 5, 2015 at 11:49 AM

    Thank you again, I was doing exactly that with the same calculation formula you show me in the time field explanation and it worked perfectly,

    check it here: http://form.jotformeu.com/form/50353719334353

    I'm proud of myself, thanks to the amazing support of all the Jotform team.

    Now I just need to clone for other bikes, change the day rates and that it.

    My next battle it's to export this to a pdf rental contract but that another war ;)

    Thank you so much Sean, Ashwin and Kiran!!!

  • Ashwin JotForm Support
    Replied on February 5, 2015 at 12:44 PM

    Hello motoxplorers,

    On behalf of all my colleagues, you are welcome.

    Do get back to us if you have any questions.

    Thank you!