Rounding time x Rate

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
 
G

Gary Walter

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...
 
G

Guest

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?
 
G

Gary Walter

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
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top