Page 1 of 1

Help in database design and php logic

Posted: Tue Apr 22, 2008 10:07 am
by iceangel89
a long post but hope someone can help :)

i need to do a system as follows
its a employee claims system where employees can claim medical expenses etc. they will submit a claim request (this part has no problems) basically a form. then this claim will need to be forwarded to 0 (in the case of a boss for example) to many "managers" from what i understand. then finally it will reach the finance department.
as for database design, i was thinking:

Users table
- UserID
- Username
- Password
...

"ClaimSequence" < (dunno what to name it) table
- ID
- UserID - UserID of the employee who submitted the claim
- Number - Sequence number of the manager
- ManagerID - UserID of Manager in charge
- NextManager - UserID of the next manager in charge

abit abstract so i will give an example:

say managers man1, man2 needs to approve my claim
the admin when registering me will set that

ClaimSequence 1:
- UserID - ME
- Number - 1 - indicating the 1st manager
- ManagerID - UserID of "man1"
- NextManager - UserID of "man2"

ClaimSequence 2:
- UserID - ME
- Number - 2 - indicating the 2nd manager
- ManagerID - UserID of "man2"
- NextManager - NULL - indicating no more managers, or maybe the finance ppl in charge, i'll probably ask if the finance is fixed people doing it for all employees anot...

what do u think of this?

then for the 2nd part to have "Management/Finance" being able to see and approve/process claims of subordinates/colleagues they are in charge of. maybe i dont need this? cos i just do like a
if UserID IN ClaimSequence.ManagerID then able to see the page something like that
OR
i can do a Roles table and put people with management/finance roles and able to see respective pages?
which is better?

what kind of Accerss control is best? i normally use restrict access to page server behaviour but think ts not really efficient. is there somtthing like web.config like in ASP that i can restrict access by folder?

Re: Help in database design and php logic

Posted: Tue Apr 22, 2008 11:25 am
by onion2k
I think that any specification that contains the words "from what i understand" needs to be finalised before you do a load of work on it and find out the person who wrote it didn't understand it properly.

Re: Help in database design and php logic

Posted: Wed Apr 23, 2008 9:28 pm
by califdon
I strongly endorse onion2k's comments. Further, I recommend that you approach this with the conventional relational database design methodology: explicitly identify and define the entities that will represent your data model, then create Entity/Relation Diagrams (ERDs). If you neglect this formal first step, I wouldn't give you much hope for a successful database design. There is a world of reading on this subject. It's worth spending a few hours studying the process before trying to guess at "what might work".

Re: Help in database design and php logic

Posted: Fri Apr 25, 2008 9:15 am
by iceangel89
UPDATE: its not a from what i understand now... its confirmed.

The old:
its a employee claims system where employees can claim medical expenses etc. they will submit a claim request (this part has no problems) basically a form. then this claim will need to be forwarded to 0 (in the case of a boss for example) to many "managers" from what i understand. then finally it will reach the finance department.
and on the finance part, it will also need to be selected for individual employees, so NOT fixed for all employees as what i understood last time.