Rounding time x Rate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

I have created a field in a query which allows me to calcualte the duration
between time arrived and time left using the ElapsedTimeString. What i now
want to do is round this time off to the next nearest hour and then calculate
it by an Hourly Rate.

For example:-

10 mins would be rounded to 1 hr and this would be multiplied by £45 = £45

or 1 hr 45mins would be rounded to 2hrs and would be multiplied by £45 = £90.

Is there anyone who would have an idea on whether this could be done?

Regards
Mike
 
Mike Diamond said:
I have created a field in a query which allows me to calcualte the
duration
between time arrived and time left using the ElapsedTimeString. What i now
want to do is round this time off to the next nearest hour and then
calculate
it by an Hourly Rate.

For example:-

10 mins would be rounded to 1 hr and this would be multiplied by £45 = £45

or 1 hr 45mins would be rounded to 2hrs and would be multiplied by £45 =
£90.

Is there anyone who would have an idea on whether this could be done?

Hi Mike,

I don't know why you would want to
mess with a string when the times calc
is fairly straightforward:

(-int(-(datediff("n",starttime,endtime))/60))*45

of course, maybe I have misunderstood...
 
Thats excellent Gary, you are the man...Is there a way that the value of 45
can be changed to 50 depending on the value of a yes/no field?
 
Field: mult: IIF([ynfield] = -1,45,50)
Table:
Sort:
Show: <checked>
Criteria:
Or:

Field: hrs: (-int(-(datediff("n",[starttime],[endtime]))/60))
Table:
Sort:
Show: <checked>
Criteria:
Or:

Field: calc: CCur(hrs * mult)
Table:
Sort:
Show: <checked>
Criteria:
Or:


Is there a way that the value of 45
 
Thanks a lot Gary you have been a great help, wish i had your knowledge..

Regards
Mike

Gary Walter said:
Field: mult: IIF([ynfield] = -1,45,50)
Table:
Sort:
Show: <checked>
Criteria:
Or:

Field: hrs: (-int(-(datediff("n",[starttime],[endtime]))/60))
Table:
Sort:
Show: <checked>
Criteria:
Or:

Field: calc: CCur(hrs * mult)
Table:
Sort:
Show: <checked>
Criteria:
Or:


Is there a way that the value of 45
can be changed to 50 depending on the value of a yes/no field?
 
Back
Top