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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping services

Status
Not open for further replies.

Peps

Programmer
Joined
Feb 11, 2001
Messages
140
Location
ES
We have been working with an old program that up until now administrates our taxi services. I have been given the job of implementing this utility in a multi task application I’m presently working on, this is being done Access97.

I can only foresee one challenge:

Although a cab can be licensed to take up to 5 persons, we only assign Max. 3 travelers per car. Let's say we get a service request for 4 people, we assign 2 people per car. The idea I have is to create a table that will accommodate x amount of travelers along with all the other service details. When it comes to printing the ‘bonos’ for the taxi drivers the program should decide the following:

1-3 travelers (one bono – all travelers in the same car)
4 travelers (two bonos – two in one car and two in the other)
6 travelers (two bonos – three in one care and three in the other)
7 travelers (three bonos – two in one care, two in another and three in the other)
8 travelers (three bonos – three in one care, three in another and two in the other)
9 travelers (three bonos – three, three and three)

so on and so on…

Our old program had a form where we could only create a service for three travelers, if we have 4 people arriving at an airport, we have to manually create two new services.

If my intention is two dynamic then it will just have to be a case of grouping the number of travelers into three’s.

Does anyone have any suggestions?

Peps
[auto]
 
Use the built-in INT() and MOD() functions to calculate whether you have all full cabs or not.

INT() returns the integer value of a calculation
MOD() returns the remainder of a division calculation.


If Mod([Total Passengers],3) = 0 then you have even multiples of 3 and you need to create INT([Total Passengers]/3) bonos

If Mod([Total Passengers],3) = 2 then you need to create
(INT([Total Passengers]/3) bonos for 3 passengers + 1 bono for two passengers

If Mod([Total Passengers],3) = 1 then you need to create
(INT([Total Passengers]/3) - 1) bonos for 3 passengers and 2 bonos for 2 passengers.

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top