I am working on a formula to show relevant currency £ calculations based on selected dates and times.
The Total formula needs to meet the following criteria:
Another example shown below the booking is taken place for 1 day, 5hrs and 15minutes.
The caculaculation in this case would be: (1 day * dailyRate) + 6hrs * 3.50 < unless I am being wrong.
Please feel free to through in your opinions and better efficient ways in achieving the outcome.
Maybe an introduction to using the FORM VIARIABLE may be beneficial of which I am new to.
Well, I have had a try but still failing to make it work 100%.
This is what I have setup as Form Variables:
// It only shows the minutes within the hour between the dates.
// Example 09/11/2018 10:00 and 09/11/2018 12:15 > shows 15minutes difference.
// This is to say when minutes is above 0 then add + 1 to the hours.
// For example for 1hr and 15 minutes the user gets charged for 2hrs, in other words any minute becomes +1hr.
// Shows the days difference between the days.
// Calculates the daily cost based on the amount of days if above 0
// Otherwise it will show the daily cost which will be 0
// Calculate the hourly rate if calculateHours is between 1 and 8
// Otherwise calculate HoureRate * 8
if(and(calculateHours>=0,calculateHours<=8 ), lookup("Pool Car","Registration", parseLookup(PoolCar), "Hourly Rate")*calculateHours, lookup("Pool Car","Registration", parseLookup(PoolCar), "Hourly Rate")*8 )
// This calculates the two figures together.
The scope seems to be working as following:
- calculate hourly rate
- calculate daily rate if it's more than 8hrs
- cap the daily rate if the hours difference is more than 8 hrs
- summarise the total price
Failing to do:
- calculate the daily cost + hourly cost + the difference hours when it goes above 8hrs
For example, booked it for 2 days and 10 hrs and 30 minutes (from 13/11/2018 07:00 am until 15/11/2018 17:30 pm)
my current calculations: 2 * dailyRate + 8hrs Rate
However, the remaining 2rs + 30min (any minutes becomes an hour so it is 3 hrs) are not taken into account....