Employee School Attendance in payroll system database schema - database

I have payroll system with attendance log-in and log-out, am and pm.
These are the tables:
DTR: list of all emloyees with there log-ins and log-outs for the day
Date Empid timein_am timeout_pm timein_pm timeout_pm status tothrslate
12-4-13 1000 7:00 12:00 1:00 5:00 log-out 0
dtrlogs:
Columns are equal with the dtr tables. The attendance above will be moved here after the employee made an attendance for the day.
This table is list of all attendance of all employees everyday.
After the records of dtr table will be moved here, the time-ins and time-outs status, tothrslate will be deleted for the next day.
Questions:
Is it a good idea to have a dtrlogs in my database schema?
In any sense, is there anyway to do this for my attendance?
Btw, my client application is vb6 and I am using msaccess. Im just having a hard time designing database for payroll with attendance. I want to record all attendances of an employee everyday in a table. I was thinking to store attendances by months, meaning, I will have to create tables Jan-Dec. But I don't know if this is a good idea. Any advice? Any help would be apreciated.

The first thing I noticed was that your DTR table is very restrictive. What if a boss decides that everyone needs to clock out when they take smoke breaks? With your DTR table, the employee can only clock in and out once in the afternoon.
You also need an Employee table with the employee's ID, name, phone number, emergency contact, etc.
I recommend 1 source table to hold your permanent data. It will never be deleted. Give it 3 fields:
EmpID
Clock_In
Clock_Out
This allows multiple 'work periods' during the day, including if someone skips lunch completely. From this 1 table, you can schedule a nightly process that will clock out people who forget, build daily and monthly summaries, etc.
I also imagine this is a fairly common task. Try googling it.

Related

How to store "Infinite data" in a database?

I'm creating a feature that has an option to create infinite bank account transactions by month, for example: A user buy something in 12x parcels, will be created 12 rows on database with relation with this purchase in a table called bank_account_transactions.
Now the problematic scenario: A user has a salary that increase the balance of bank account every month for the rest of his life, how can i store this in database?
I thought store data equivalent to 100 years (12*100=1200) but it is so slow because when the user update the value of his salary, will update 1200 rows in database.
How can I solve this in a performatic way? The project is developed with Nodejs and MongoDB.

Hourly Time Sheets Database Design

Building an internal web-based project management tool for my company. Need some help with the database design for the timesheet component.
We currently use an MS Excel file where:
Column headings - Days of the week
Rows - Time of the day with 30 minutes per row (Row1: 9:00AM, Row2: 9:30AM and so on)
Each cell in the table has a dropwdown menu that fetches from a set of predefined tasks set by a manager and the employee selects one of the tasks against that day and that particular 30 minute time slot.
I want the front end interface to remain the same for the employees.
Need help with designing a database that supports this. I'm open to any suggestions/changes in the restrictions I laid out if it allows for better efficiency. Thank you!
Is something like this what you're after?
Task (all of the tasks an employee might be assigned)
PK: Id
Name
... other details ...
Employee
PK: Id
Name
... other details ...
EmployeeTask (the list of tasks that have been assigned to an employee)
PK: Id
FK: TaskId
FK: EmployeeId
TimePeriod (the row labels)
PK: Id
Start (9:30, 10:00 etc.)
Timesheet (chops out a region of time and says it's one thing - gives column headings)
PK: Id
Start date
End date (don't need this if timesheets cover the same length of time)
EmployeeTimesheetCell
PK: Id
FK: TimesheetId
FK: EmployeeId
FK: TimePeriodId
FK: TaskId
Date or day of the week
Time spent
You'd probably want some kind of status or Finished Date on Task and/or EmployeeTask, so that old finished tasks don't clutter up the GUI.

How to get a proper table design( 0NF) for my database

I have to design tables in 0NF for my project, I am required to design the tables in 0NF form first then proceed to normalization and then draw the ERD. However it has been a real challenge for me to obtain the 0NF forms of my tables, lots of time has been wasted trying to redesign so I thought of asking help from people who might be more experienced in database design.
My database is of a Car Rental System. The system should keep records of customers,cars,employees, details of each rental and also the company is supposed to have multiple branches at different locations and each branch must have their own set of unique(identified by their license plate number) cars available.
One customer can have multiple rental records(i.e. made a rental in January then another in March .e.t.c) but one rental record is related to only one customer
A customer can book multiple cars in a single rental
Each rental is made through a single booking agent(an employee)
Employees is divided between Managers and booking agents. Each branch has a single manager but multiple booking agents.
Each branch has multiple cars located there but each car can be located at a single branch
So far, I've come up with these 0NF tables, they don't look correct to me though:
Cars(CarID,LicensePlateNo,Make,Model,Year,Color,mileage,Capacity,seats,Availability, Rate, BranchID,BranchLocation)
Customer(CustomerID, FirstName,LastName, Address ,ContactNo,Gender,DOB,NIC,RentalID,DateRented,RentalCost)
Agent(AgentID,FirstName,LastName,Address,ContactNo,Gender,DOB,NIC,MonthlyRentals,Salary,ManagerID,ManagerName,MangerLastName,ManagerAddress,ManagerContact,BranchID,BranchLocation)
Rental(RentalID,DateRented,Duration,RentalCost,Discount,AgentID,CarID,LicensePlateNo,Make,Model)
Branch(BranchID,BranchName,BranchLocation,ContactNumber,ManagerID)
I have replaced the Agent table with the Employee table and I have added 2 new columns (Position and Manager) to it. I believe the position column should store either 'Agent' or 'Manager'. If employee is an Agent, the Manager field should contain the ID of his/her Manager (EmployeeID). If employee is Manager, most probably the Manager column should be left NULL. I have also removed all other columns which were being repeated(Example BranchLocation in cars table etc...)
Cars(CarID,LicensePlateNo,Make,Model,Year,Color,Mileage,Capacity,Seats,Availability, Rate, BranchID)
Customer(CustomerID, FirstName,LastName,Address,ContactNo,Gender,DOB,NIC,RentalID)
Rental(RentalID,DateRented,Duration,RentalCost,Discount,EmployeeID,CarID)
Branch(BranchID,BranchName,BranchLocation,ContactNumber,EmployeeID)
Employee(EmployeeID,FirstName,LastName,Address,ContactNo,Gender,DOB,NIC,MonthlyRentals,Salary,BranchID,Position,Manager)
Thanks

Database schema design strategy for pharmacy and drug prescriptions

I am in the process of designing a small database application for a health center in my local community. The health center can receive both In & Out-Patients.
The one area i am not sure of how best it should be implemented is how to bill the patient automatically from the drugs/medication they have be given. I don't want the user to type in the name and price of the drugs given to the patient. I want to automate it with a list of all available drugs and their CURRENT prices in a table so that the user just selects a drug from a list & i the software should be able to determine the total.
I also want to maintain the history of drugs over time. Some thing like drug XXX was selling at $1234 in January, $4567 in September, $12 in 2008. So if i am to print a receipt for a patient who visited in 2008, the patient should be billed at the rates of 2008 not the drug current rate.
I am just asking for some general guidance and suggestions on the best database schema of a scenario related to my problem description above.
Thanks a lot.
With a table of drugprices
DrugPriceID DrugID PriceStartDate DrugPrice
1 1 1-1-2008 1234
2 1 1-9-2008 4567
which links to a table of drugs on DrugID. The price applies until it is superseded by a new price.
A table of Patients, which links to a table of PatientOrders,
PatientOrderID PatientID OrderDate
5 3 4-5-2008
and a further table of OrderDrugs
OrderDrugID PatientOrderID DrugID
6 5 1

Database designing help for billing system

I am developing a Electronic Bill Payment System for a bank which has more than 100 customers subscribing for Electronic Bill Payment.
I have a table in which I am creating profile for customer like the following.
Customer Table
Customer_ID (Primary key)
Customer_Name
Address
Phone
Bill_Master
Customer_ID
Enrollment_Date
UtilityCompany_ID
Bill_Generation_Date (lets say 18th of every month)
Bill_Due_Date (lets say 27th of every month)
Our_CutOff_Date (when the bank will generate the bill for payment)
I have created the customer along with clue that which utility company's bill generates on which date and what will be the due date of EVERY MONTH.
I want to create an interface where the user will see the entries of all the customers whoz date is due for bill generation and after that user will click on the particular entry and generate the bill manually by entering the amount and other details so for this I am clueless how to find out which customer's utility company bill is due for generation..
Any help how should I design it and query of it? or would be a automatic procedure like job or something which will do it.
thanks
Well if its a query you need to generate bills that are due 27th of every month and also find the customer's utility company, then you can try this -
SELECT A.Customer_Name, B.UtilityCompany_ID FROM
Customer A inner join Bill_Master B on A.Customer_ID = B.Customer_ID
WHERE Bill_Due_Date BETWEEN GETDATE() AND DATEADD(MONTH,-1,GETDATE())

Resources