Process of creating invoices requiring human thought!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nunners
Forum Commoner
Posts: 89
Joined: Tue Jan 28, 2003 7:52 am
Location: Worcester, UK
Contact:

Process of creating invoices requiring human thought!

Post by Nunners »

I’m creating an invoicing system for a children’s nursery, and I’m trying to work out how I can replicate the thought process one would normally go through when working out the bill for each day.

I’ve created all the mysql tables that I think I need, with all the info possible, along the following lines (I’m only showing what’s relevant)

Child -> childId, starttime, endtime
Fees -> feeId, starttime, endtime, rate (£)

The easiest way to explain this is as follows:

The nursery fees are broken down into AM (8am to 12.30pm), PM (12.30pm to 6pm) and All Day (8am to 6pm), and furthermore there’s an hourly rate for extras.

Child A starts at 9 and finishes at 5 therefore they come under the all day rate
Child B starts at 8.30 and finishes at 12pm therefore they come under the AM rate
Child C starts at 9.30 and finishes at 1pm, and because it’s not a straight they do AM, PM or All Day, they’ll probably fall under AM, cos it’s including lunch.

Can anyone see an easy way of putting that sort of “human thinking” into a script? Any guidance would be gratefully received…

Just to give a bit more background, there are two nurseries (at the moment) and they have different session times, so the fees table does need to have the starttime and endtime. (:

Cheers
Nunners
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post by andym01480 »

Surely the human thinking is

Does the start time fall in am or pm? if pm then pm rate, if am ask next question
Does the end time fall totally in am? Yes - am rate
Does the end time fall within x minutes of pm starting? Yes grace period - am
else its a day rate.

Decide your grace period - x!
Post Reply