Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations in code for Hire periods between Dates

Status
Not open for further replies.

james33

Technical User
Dec 23, 2000
1,345
IE
Dear All,
I have been working on a Hire Db and on the Pricing form [frmJobsBack]I have 5 fields that will accept entries up to a maximum for each field:

Hours....2 or less (otherwise a halfday)
1/2 Day....Obviously 1 (otherwise add up to two hours or it is a Day
Days....3 or less (or add a HalfDay) or it is a week
Weeks....2 weeks or less (or add up to 3 Days or it is a Month)
Months....5 months or less (Very definitely unlikely to be any more)

All are whole numbers (No Decimals)

This is based around the pricing structure that encourages customers to take a machine for longer rather than for shorter periods and to also encourage them to return the equipment on time...
Well that is the general idea!!

I have two Date fields and two Time fields
Named: [DateOut], [DateBack], [TimeOut], [TimeBack]
No surprises there!!

I wish to calculate the Hours/ HalfDays/ Days/ Weeks/ Months as individual quantities so that I can use them in calculations to determine the overall price of the hire.

These calculations are already in place and if I fill the Fields in with the duration of hire the calculations work.
I need to allow the fields to be edited for the purpose of reconciling the customer to the overall cost (i.e. I need to be able to manually Discount a day here, an hour there etc) so values set will have to be Editable or I guess I could use option buttons for Discounts
(I will need to add the results to a history Table so not too many extra objects please)

The employer is adverse to a system using a set Hourly price and a formula for the various Halfdays/Days etc etc.
The method needs to observe the Maximum allowed for each particular Field but to calculate the lowest overall price with regards to the strictures of those fields..

In some cases the Minimum Hire is a 1/2Day therefore the Rate per Hour is the same as the Rate per 1/2Day
Similarly for the Minimum Hire of 1 Day the rate for the Hour and the 1/2Day is the same


Any ideas for the code? I have to admit I'm not up to much speed, on Modules especially.
I would really appreciate any help or advice.
Thank you in advance.
Regards Jim
 
I have some code which might be of use, but before I post it and confuse the issue could you post some supplementary information?

1. Can any of these periods spread over two of the next, ie can the two hours be one hour in the afternoon and one hour the next morning?

2. Do weekends and public holidays count?

3. Do you have a definitive start and end time each day(ie shop opening hours)? Sandy
 
Dear B827,
Thanks for the quick reply,
To your Questions:

1.The Time out is the total time out
(it might be altered manually by the operator subsequently as I have said in my first post)

2.Yes they do but the note in italics applies here also

3.9.00am-6.00pm but this is not set in stone either

Sorry that it is so indefinite.

Regards Jim
 
Jim,
I have to drive back up the motorway now, I'll look out some code I have for calculating elapsed time. The system I have breaks things down into working days (Mon to Fri no public holidays) It will need some modification to meet your requirements, which I'll do tonight. I'll post something tomorrow. Sandy
 
Jim,
If you post your e-mail address I'll send you something which you may be able to use modified to your requirements. Sandy
 
Thanks B827,
My email address is james.maidment@oceanfree.net
Regards Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top