A.D.TEJPAL
adtp at airtelbroadband.in
Wed Apr 19 07:47:23 CDT 2006
Mark, As a generic solution, it might be desirable to cater to different types of rate structures & discounts, depending upon whether it is a week-end or normal day. More-over, there could be activities where the client continues for a period spanning multiple days (some of which could be week-ends and the others normal ones). My sample db named PoolCalcDynamicRates might be of interest to you. It is available at Rogers Access Library (other developers library). Link - http://www.rogersaccesslibrary.com/OtherLibraries.asp#Tejpal,A.D. For each booking, this db also provides a break-up of total computed charges, showing periods covered by different rate-slabs and the sub-amounts actually charged. Best wishes, A.D.Tejpal --------------- ----- Original Message ----- From: Mark A Matte To: accessd at databaseadvisors.com Sent: Friday, April 14, 2006 00:16 Subject: [AccessD] Calculate Pool Times Hello All, I need some help with my logic here. The app will track how long some one is on a pool table and charge accordingly. I want to have the specials calculate automatically. For example: Someone shoots from 16:00 to 23:00. The normal rate is 3dph. From 17:00 to 19:00 is free and from 20:00 to 22:00 is 1.5dph. These are only the specials today...there might only be one tomorrow. I started with a specials table that would have the day,start,end, and rate. Each special is its own record. In the end it would charge: 16:00-16:59 3$ 17:00-18:59 0$ 19:00-19:59 3$ 20:00-21:59 1.5$ 22:00-23:00 3$ I guess I could loop through minute by minute and compare the time to the each special... and sum that way...but that didn't seem right? Any ideas/suggestions on an approach would be greatly appreciated. Thanks, Mark A. Matte