Job Tracker
(Employee tracking and job reporting software
for The Pacific Restoration Group)
John Trafecanty
CS491B 12/9/05
1.Overview
Job Tracker is a Java Swing application intended for public works, landscape and construction companies. The main function of Job Tracker is the recording of daily job timesheets, tracking cost codes, equipment use, safety issues and generating reports. Job Tracker enables companies to save time by recording job information to a centralized database as well as provide more accurate information about projects, labor and equipment use. Job Tracker’s cost code and labor reports can aid a company in providing more competitive bids by providing accurate labor costs per cost code as well as recoup lost revenue due to missed billable services from sloppy paper time sheets.
2. Technology Overview
Language: Java
Interface: Swing GUI
Data: MySQL database
Third party software:
MySQL
JasperReports
iReport
Java Date Picker
3. Design Overview
I don’t believe that I stuck strictly to the MVC design pattern, but I kept the model and the view separate with most of the controllers e.g. event handlers tied to the view. The singleton design pattern was used heavily when only one instance of a class was ever required. I found it much easier to get the instance from the class declaration rather than storing and or passing the reference into method parameters. I also preferred composition as apposed to inheritance because I felt inheritance had more overhead and I was not constructing a reusable library.
Classes were kept relatively small. If for example the time sheet required several GUI components that would make a time sheet class several thousands of lines long, I would break the components up into separate classes and place them in a package where the timesheet class could then call those components into its class. On the other hand, if a dialog box only had a few components, I would keep them together.
Third party software was integrated to help build Job Tracker. JasperReports was used as the reports engine. iReport provided a GUI interface that helped construct the xml report description that JasperReports uses to generate the reports. MySQL provided the remote database. Java Date Picker provided a graphical component library that allowed the creation of a Calendar type date picker.
4. Design
Following is a description of the higher level package structure of Job Tracker as well as the
database schema. JavaDoc is provided as a separate file for a more in depth view.
Packages:
jt.company.costcode
jt.company.employee
jt.company.equipment
jt.company.project
These packages model the company and are used to generate company objects. These objects are stored in data structures and are used by many other classes. More specifically all JTree objects build their structures using these objects.
jt.data
Provides the in memory data structures as well as utilities for manipulating in memory data.
jt.database
Provides facilities for database connection management as well as generating SQL queries and updates.
jt.date
Provides a class that handles the date policy and cutoff times for users entering time sheet information.
jt.event
Contains event listener classes that are used by more than one component. If a specific listener is only needed by one component, then it can be found with the component; otherwise, it will be found here.
jt.format
Provides a class that handles formatting of user input on the timesheet.
jt.gui.company
Provides dialog classes that can add or update company items such as employees, equipment etc.
jt.gui.login
Provides a Login dialog class that facilitates the login of a user into the system.
jt.gui.reports
Provides report dialog classes that can facilitate the generation of reports.
jt.gui.size
Tracks the main window sizing so that other components can size themselves accordingly.
jt.gui.timesheet
jt.gui.timesheet.components
jt.gui.timesheet.infoarea
These packages provide the GUI components that make up the timesheet.
jt.gui.window
jt.gui.window.components
These packages handle the main window as well as its’ menu bar components.
jt.main
Provides a simple access point into the program.
jt.validate
Provides classes that handle timesheet errors and validation. As well as toggling on/off the save timesheet component when errors are present.
Database Schema
create table employee
(
employee_id char(6) not null,
first_name varchar(20) not null,
middle_initial char,
last_name varchar(20) not null,
address varchar(40),
phone_number varchar(15),
employment_status varchar(30) not null,
primary key (employee_id)
);
create table cost_code_category
(
category_code int(3) not null,
description varchar(20) not null,
primary key(category_code)
);
create table cost_code
(
category_code int(3) not null,
item_code int(3) not null,
description varchar(50) not null,
unit_measure varchar(10),
primary key(category_code, item_code),
foreign key(category_code) references cost_code_category(category_code)
);
create table project
(
project_number int not null,
location varchar(50) not null,
zip_code int(5) not null,
project_description varchar(50),
project_status varchar(10),
primary key(project_number)
);
create table labor_classification
(
labor_classification varchar(30) not null unique,
primary key(labor_classification)
);
create table equipment_category
(
category_number int not null,
description varchar(30) not null,
primary key(category_number)
);
create table equipment
(
equipment_number int not null,
year year not null,
model varchar(20) not null,
equipment_status varchar(15) not null,
description varchar(50) not null,
primary key(equipment_number)
);
create table daily_job
(
job_number int not null AUTO_INCREMENT,
project_number int not null,
foreman_id char(6) not null,
date date not null,
notes text,
primary key(job_number),
foreign key(project_number) references project(project_number),
foreign key(foreman_id) references employee(employee_id)
);
create table works_on
(
employee_id char(6) not null,
category_code int(3) not null,
item_code int(3) not null,
hours decimal(2,1) not null,
overtime varchar(3) not null,
date date not null,
job_number int not null,
labor_classification varchar(30) not null,
primary key(employee_id, category_code, item_code, date, job_number, overtime),
foreign key(employee_id) references employee(employee_id),
foreign key(labor_classification) references labor_classification(labor_classification),
foreign key(category_code, item_code) references cost_code(category_code, item_code),
foreign key(job_number) references daily_job(job_number)
);
create table uses
(
employee_id char(6) not null,
equipment_number int not null,
date date not null,
job_number int not null,
primary key(employee_id, equipment_number, date),
foreign key(job_number) references daily_job(job_number),
foreign key(employee_id) references employee(employee_id),
foreign key(equipment_number) references equipment(equipment_number)
);
create table code_total
(
job_number int not null,
date date not null,
category_code int(3) not null,
item_code int(3) not null,
total_hours double not null,
total_units int not null,
primary key(job_number, category_code, item_code),
foreign key(job_number) references daily_job(job_number),
foreign key(category_code, item_code) references cost_code(category_code, item_code)
);
create table safety_issues
(
job_number int not null,
date date not null,
accidents varchar(3) not null,
tool_box_meeting varchar(3) not null,
inspector varchar(3) not null,
safety_report text,
primary key(job_number, date),
foreign key(job_number) references daily_job(job_number)
);
create table login
(
employee_id char(6),
login_name varchar(50) not null,
password varchar(50) not null,
access_level varchar(15) not null,
primary key (login_name, password)
);