Rent calculation based on multiple values selected by customers for events

Rent calculation based on multiple values selected by customers for events

Requirement

Estimate rent for a property based on the date and time it is booked, as well as attendance numbers.

Use Case

A party hall of a hotel is being rented out. Here is the pricing structure of the hall:
Day
Base price
(in USD)
Standard guests count
(in numbers)
Cost per extra guest
(in USD)
Standard duration
(in hours)
Cost per extra hour per guest
(in USD)
Monday - Thursday
5200
50
80
5
7
Friday and Sunday
6500
50
80
5
7
Saturday
7500
50
80
5
7

 
Now, let's say this hotel's management app contains a form to book the party hall. When a user who wants to book the party hall inputs his expected guest count and the event timings, the total price of the event will be calculated based on the above specs.

Steps to follow

1. Create a form with the following details.
Form
Form Link Name
Field Type
Field Name
Field Link Name
Book Party Hall
Book_Party_Hall
Name
Name
Name
Email
Email
Email
Number
Guest Count
Guest_Count
Date-Time
Event Start Time
Event_Start_Time
Date-Time
Event End Time
Event_End_Time
Currency
Total Cost
Total_Cost
 
The Total Cost is estimated based on the Guest Count, Event Start Time, and Event End Time fields. To ensure precise calculation, mark these three fields mandatory.
 
2. Create workflow with the following details:
 
3. The Total Cost field will be auto populated with the calculated value. Thus, the field will be disabled on load of the form. Save the following Deluge script in the Deluge editor:
  1. disable Total_Cost;
 
4. Create another workflow with the following details:

5. Save the following Deluge script in the Deluge editor:
  1. // Perform the estimation calculation only on the following conditions
  2. if(Event_Start_Time != null && Event_End_Time != null && Event_Start_Time < Event_End_Time && Guest_Count != null)
  3. {
  4.  
  5.  // Define base package details
  6.  monday_to_thursday_cost = 5200;
  7.  friday_sunday_cost = 6500;
  8.  saturday_cost = 7500;
  9.  standard_guests = 50;
  10. standard_hours = 5;
  11.  
  12.  // Define additional costs
  13.  cost_per_extra_guest = 80;
  14.  cost_per_extra_hour_per_guest = 7;
  15.  
  16.  //Find on which day the event will be conducted
  17.  day = input.Event_Start_Time.getDayOfWeek();
  18.  
  19.  //Set cost based on the day the event will be conducted
  20.  if(day == 7)
  21.  {
  22.   cost = saturday_cost;
  23.  }
  24.  else if(day == 6 || day == 1)
  25.  {
  26.   cost = friday_sunday_cost;
  27.  }
  28.  else
  29.  {
  30.   cost = monday_to_thursday_cost;
  31.  }
  32.  
  33.  // Charge additional price for extra guests
  34.  if(Guest_Count > 50)
  35.  {
  36.   extra_guests = input.Guest_Count - standard_guests;
  37.   cost = cost + cost_per_extra_guest * extra_guests;
  38.  }
  39.  
  40.  //Calculate number of event hours
  41.  event_hours = ((input.Event_End_Time - input.Event_Start_Time)) / (1000 * 3600);
  42.  
  43.  //Charge additional cost for extra hours
  44.  if(event_hours > 5)
  45.  {
  46.   extra_hours = event_hours - standard_hours;
  47.   cost = cost + cost_per_extra_hour_per_guest * extra_hours * input.Guest_Count;
  48.  }
  49.  input.Total_Cost = cost;
  50. }

Now, let's recalculate the total cost on the input of Guest Count field and Start Time field. This is to ensure the correct Total Cost is estimated even if the user re-enters guest count and start time.
 


 
7. Save the same Deluge script from step 5 in the Deluge editor.

See how it works


Points to note

  • This tutorial demonstrates the cost calculation of one party hall that is rented out with a complex pricing structure based on the date, time, and attendance numbers of the event. Thus, for simplicity, the base prices are hardcoded in the script. In order to apply the script to multiple party halls in the hotel that are rented out with similar pricing structure but different rates, store the base prices and additional prices on an admin form and fetch the rates according to the selected party hall as and when required.
     
  • In this tutorial, the hours difference between the start and end time is calculated using a formula instead of using the hoursBetween built-in function. This is because the intended behaviour of this function is to neither round off the hours value based on the minutes difference nor return an accurate decimal equivalent.

    For example:
     
    start_time = '18-Dec-2019 07:00:00';
    end_time = '18-Dec-2019 08:59:59';
    total_hours = hoursBetween(start_time, end_time);

    Here, the value of total_hours is 1 even though the time difference is 1 hour and 59 minutes. So, if hoursBetween function is used, the customer will be charged only for 1 hour even if the event lasted for 1 hour and 59 minutes.

  • In services other than Zoho Creator, you can use timeBetween built-in function to find the accurate time difference between two date-time values. We will support this in Zoho Creator soon. You can use the following formula to achieve the result returned by the timeBetween function.

    start_date = '1-Jun-2021 00:00:07';
    end_date = '24-Jun-2021 12:12:14';
    difference_in_ms = (end_date-start_date);
    hours = difference_in_ms / (1000 * 60 * 60);
    mins = (difference_in_ms / (1000 * 60)) % 60;
    secs = (difference_in_ms/ 1000)% 60;
    info hours.floor()+":"+ mins.floor() + ":" + secs.floor();

    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION






                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          Encrypted Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real EstateKiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives
                          Holiday Forms Google Forms alternative 
                          Form to PDF Jotform alternative





                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Hotel management

                                                                                                                This app has been published in accordance with Marketplace review process. For pricing details, you can refer to this page. Category - Hospitality Vendor - Zoho Corporation Pricing - Free Overview Say goodbye to thick registry books and run your ...
                                                                                                              • Dynamic calculation of price based on the calculated distance

                                                                                                                Requirement Calculate the cost of a taxi or hired car based on distance. Use Case A cab booking application calculates and displays the approximate cost of a trip based on pickup and drop-off addresses, after which the user can choose to book the ...
                                                                                                              • How to filter a report embedded in a page with multiple values

                                                                                                                When embedding a report in a page, Zoho Creator provides a built-in filter option for direct report filtering. However, for dynamic filtering with multiple values, you can pass the values to the page variable and use it to filter the report. This ...
                                                                                                              • Communicate stakeholders about an out-of-stock situation without manual intervention

                                                                                                                Requirement   When an item runs out of stock, send an automated email to the vendor, and alert the customer that the item is not available. Send an alert to the customer when the item gets restocked. Use Case   In an order or inventory management ...
                                                                                                              • Statistical values on a report based on numerical fields

                                                                                                                Requirement Display the common statistical results on the reports for the numerical fields in a form, to help in identifying trends and decision-making process. Use Case In any sales-based business, crunching numbers is a big task. An order ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources