Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am working on Leave Management system. Employee applies for a leave and admin accepts or reject leave. When emp applies the status is pending.. and when admin approves or rejects leave status gets changed accordingly..

What I have tried:

My Tables:
empDetails(empID,Name,Gender,JoiningDate,Mobileno,Email,address,DoB,Total Leaves,username,password,usertype)
leave_request(empID,leavetype,DayPart,Category,Reason,fromdate,todate)Im thinking of having one more column as leaveID(PK).
what more tables will I need? 
I have displayed leave request on admin page and added 2 more columns for status and action. Please tell me what to do next!
Updated 6-Oct-19 1:01am

1 solution

First off, yes, add a LeaveID column - you want to identify different columns uniquely. I'd suggest an IDENTITY column, or (if you're comfortable with them) UNIQUEIDENTIFIER.

Secondly, you need a Status column on your leave request, so it can be Pending, Approved, Rejected, or Cancelled. I'd be tempted to add a "DaysOfLeave" column as well, since you have a TotalLeaves column in your Employee table. That way, it's pretty easy to work out the remaining days the employee can take; and a WorkYear column to make it easier to calculate again.

I'd probably add a Satatuses table to link Status value with "human readable" descriptions - you can easily use an SQL JOIN to recover that for presentation.

Start by INSERTing the leave request with Pending status, then use the LeaveID column value to change the Status to Approve or Reject accordingly.
Share this answer
Afzaal Ahmad Zeeshan 6-Oct-19 7:46am    

You forgot to say, "And that'd be 50 bucks"! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900