database and web database systems - call center management system
DESCRIPTION
A Call Center Management System using Microsoft SQL server 2005 and PHPTRANSCRIPT
Acknowledgement
First of all, I owe my deepest gratitude to my database and web database systems
lecturer Mr.Thangavel Saravanan, whose encouragement, guidance and support from
the beginning to the final stages enabled me to develop an understating of the database
systems and web programming.
Finally I thank you for all who supported during the completion of the project.
1
Table of contents
Assumptions.....................................................................................................................3
ER Diagram......................................................................................................................4
Database functions..........................................................................................................7
Rules.............................................................................................................................7
User defined data types................................................................................................7
Stored Procedures........................................................................................................8
Triggers.......................................................................................................................11
Views..........................................................................................................................12
Screen Design................................................................................................................13
DDL Statements.............................................................................................................21
References.....................................................................................................................27
2
Assumptions
Every problem type is assigned with one or more than specialist.
Equipment has only one manufacturer.
Specialist does not need any caller’s information to solve the problem only problem details and equipment details are required. (Caller information is encapsulated from the specialist).
Every equipment is belongs to an equipment type and that equipment type has a specified problem category.
Caller’s problem logging time and server time are synchronized.
One problem belongs to only one problem type and there can be more than one solution for that problem type
3
ER Diagram
4
Normalization
Un Normalized form
Problem
(ProblemID,CalllogID,Date,Time,CallerID,DepID,ProblemCatogory,ProblemType,Assign
ed_Specalist_ID,Comments,Solution Description )
Calllo
g(Call_ID,Caller_ID,Name,Department,Problem_ID,Operator_ID,Date,Time,Problem_co
unt)
Equipment(Equipment_ID, Name, Type, Manufacturer)
First Normalized form
Problem
(ProblemID,CalllogID
,Date,Time,CallerID,DepID,Problem_Catogory,Problem_Type,Assigned_Specalist_ID,C
omments,Solution Description )
Department(Department_ID,Name,Number_of_emp)
Equipment(Equipment_ID, Name, Type, Manufacturer, Equipment_Type_ID)
Equiment_Type(Equipment_Type_ID,Desc)
5
Manufacturer(Manifactuer_ID,Name)
Calllog(Call_ID,Caller_ID,Name,
DepartmentID,Problem_ID,Operator_ID,Date,Time,Problem_count)
Solution(Solution_ID, Solution_Desc, Specalist_ID)
Problem_Catogory(Catolory_ID,Desc,Equipement_Type)
Problem_Type(Problem_Type,Desc, Catolory_ID)
Second and third normalization form
Problem
(
ProblemID,CalllogID, , ,CallerID, ,Problem_Catogory,Problem_Type,Assigned_Specalis
t_ID,Comments,)
Department(Department_ID,Name,Number_of_emp)
Equipment(Equipment_ID, Name, Type, , Equipment_Type_ID)
Equiment_Type(Equipment_Type_ID,Desc)
Manufacturer(Manifactuer_ID,Name)
6
Calllo
g(Call_ID,Caller_ID,Name,DepartmentID,Problem_ID,Operator_ID,Date,Time,Problem_
count)
Caller(Caller_ID,Name,DepartmentID)
Solution(Solution_ID, Solution_Desc, Specalist_ID)
Problem_Catogory(Catolory_ID,Desc,Equipement_Type)
Problem_Type(Problem_Type,Desc, Catolory_ID)
Database functions
Rules
SQL rules are created to restrict the user input values to selected columns for example
the operator ID should start with ‘OP’ if not data cannot be inserted. The following table
shows the rules which are used in this database.
Name Purpose Definition
Admin_id Restrict Administration ID
should start with ‘ADMIN’
CREATE ruleAS
@value LIKE 'ADMIN%[0-
9]'
Op_idule Restrict operator ID
should start with ‘OP
CREATE RULE [dbo].[op_idrule]
AS@value LIKE 'OP%[0-9]'
Specialist_idrule Restrict specialist ID
should start with ‘SP’
CREATE RULE [dbo].[specalist_idrule]
AS@value LIKE 'SP%[0-9]'
Table 1 – SQL Rules
7
User defined data types
Name Purpose
AdministratorIDAdminstrator’s ID always starts with
ADMIN and increment the numeric value
OperatorIDOperator ID always start with OP and
increment the numeric value
SpecialistIDSpecialist ID always start with SP and
increment the numeric value
Table 2 – SQL user defined data types
Stored Procedures
Name PurposeParameters
IN OUT
Assign_Specialist Assign a
specific
specialist to a
problem
Problem ID Assigned
specialist
ID
fowardProblem Forward the
problem to a
another
specialist
Problem ID Newly
assigned
specialist
ID
getCalllogBYID Get the calllog
by calllog ID
Calllog ID CallLog
8
getDep Get all
available
departments
getDeparmentByEquipmentId Get the all
equipment
which belongs
to a
department
DepartmentID Equipment
details
getDepartmentByUserID Get
department
information by
CalllerID
Caller ID Department
Details
geteqibyID Get equipment
information by
ID
Equipment ID Equipment
details
getEqu Get all
equipment
details
getEquipmentDetailsByProblemI
D
Get the
equipment
details which
belongs to a
problem
Problem ID Equipment
details
getEquipmentTypes Get all the
equipment
types
Get all the
equipment types
getinfoByProblemID Get the
problem
Problem ID Problem
Details
9
information by
Problem ID
getLogin Login for
operator
Username,passwor
d
boolean
getLoginAdmin Login for
administrator
Username,passwor
d
boolean
getLoginsp Login for
specialist
Username,passwor
d
boolean
getManifacturer Get all
Manufacturers
getProblemByEquipmentID Get problem
details which
belongs to a
equipment
Equipment ID
getSpecalistByID Get specialist
details by
specialist ID
Specialist ID
newCaller Create a new
caller
Caller details
newCalllog Create a new
call log
Calllog details
NewEquipment Create new
equipment
Equipment details
newsolution Create a new
solution for a
problem
ProblemID ,Solution
details
10
setReputation Update the
reputation of
the specialist
Specialist ID New
reputation
timelineByCaller Get the caller
history
Caller ID
Table 3 – Stored procedures
11
Triggers
Name Table Action Description
updateeqtype Equipment INSERT,UPDATE,DELETE When equipment
is inserted or
updated the
Equipment type
table’s Quantity
will be updated.
Update_problems_in_calllog Problem INSERT Update the
problem count in
call log when a
new problem is
created.
Numberofcallers Department INSERT,UPDATE,DELETE Update the
number of
employees in the
department
Table 4– Triggers
12
Views
Name Purpose Tables
Calllog_Problem
To access caller
information and problem
information in one query
Problem, Calllog
View_Specalist_Problem
Encapsulate the caller
information from the
specialist
Problem, Specialist
Specalization_sp_pcSpecialist and his
specialization details
Specialization , Specialist
and problem category
Problem Type_SolutionTo view the problem type
and the solutionProblem Type, Solution
Table 5– Views
13
Screen Design
Login Screen
Figure 1 - Login Screen
14
Operator Main Screen
Figure 2 - Operator Main menu
15
New Troubleshooting
Figure 3 - New troubleshooting
16
Common Solutions
Figure 4 - Common solutions
17
Troubleshooting Status
Figure 5 - Troubleshooting status
18
Assigned specialist
Figure 6 - Assigned Specialist details
19
Specialist problem view
Figure 7 - Problems assigned to specialist
20
New Solution
Figure 8 - New Solution
21
DDL Statements
Stored procedures
Sto
red
Pro
ced
ure
– A
ssi
gn
_Sp
ecal
ist
ALTER proc [dbo].[Assign_Specialist] @prob_cat_id varchar(10),@Calllog_ID int ,@Equipment_ID int ,@Problem_Catogory_ID
varchar(10),@Problem_Type_ID varchar(10),@Comments textAS
begin transaction
declare @sp_id varchar(10)
SELECT @sp_id=Specialist_ID FROM Specialization WHERE Problem_Catogory_ID=@Problem_Catogory_ID ORDER BY NEWID()
INSERT INTO problem values (
@Calllog_ID,@Equipment_ID,@prob_cat_id,@Problem_Type_ID,@sp_id,0,@Comments,null)
declare @call_id intdeclare @problem_id int
select top 1 @call_id=Call_ID from calllog order by Call_ID descselect top 1 @problem_id=Problem_ID from problem order by Problem_ID desc
UPDATE calllog SET Problem_ID=@problem_id WHERE CALL_ID=@call_id
commit
22
Fo
rwa
rd P
rob
lem
ALTER proc [dbo].[fowardProblem] @prob_id varchar(10)AS
declare @prob_type intdeclare @sp_id varchar(10)
declare @sp_name varchar(50)
SELECT @prob_type=Problem_Type_ID FROM Problem WHERE Problem_ID=@prob_id
SELECT @sp_id=Specialist_ID FROM Specialization WHERE Problem_Catogory_ID=@prob_type ORDER BY NEWID()
SELECT @sp_name=Name From Specialist WHERE Specialist_ID=@sp_id
UPDATE Problem SET Assigned_Specalist_ID=@sp_id WHERE Problem_ID=@prob_id
SELECT @sp_id AS New_SP,@sp_name AS Name
Lo
gin
ALTER PROC [dbo].[getLogin] @username varchar(50),@password varchar(50)
AS
if exists (SELECT * FROM Operator WHERE OperatorID=@username AND PASSWORD=@password)
BEGIN
return 1END
else
return 0
23
New
cal
l lo
gALTER proc [dbo].[newCalllog] @callerid varchar(10),@problemid
varchar(10),@operatorid varchar(10), @date varchar(10), @stime varchar(10)AS
INSERT INTO calllog values
(@callerid,@problemid,@operatorid,@date,@stime,0)
New
so
luti
on
ALTER proc [dbo].[newsolution] @solution varchar(50),@problem_id int,@specalist varchar(10)
AS
declare @prob_type_id varchar(10)
SELECT @prob_type_id=Problem_Type_ID from problem WHERE problem_id=@problem_id
INSERT INTO Solution values (@solution,@prob_type_id,@specalist)
declare @solution_id intSELECT top 1 @solution_id=Solution_ID FROM solution ORDER BY
Solution_ID DESCPRINT @solution_id
UPDATE problem set solution_ID=@solution_id,status=1 WHERE
Problem_Id=@problem_id
Set
rep
uta
tio
n
ALTER proc [dbo].[setReputation] @sp_id varchar(50) ,@level intAS
declare @currentrep intdeclare @newrep int
SELECT @currentrep=Reputation FROM Specialist WHERE Specialist_ID=@sp_id
SET @newrep=@currentrep+@level
UPDATE Specialist SET Reputation=@newrep WHERE Specialist_ID=@sp_id
24
ge
tEq
uip
me
nt
by
Dep
art
mn
t ID
ALTER proc [dbo].[getDeparmentByEquipmentId] @eqid intAS
SELECT * FROM Department WHERE depID=(SELECT depID FROM Equipment WHERE EquipmentId=@eqid)
Ger
info
by
pro
ble
mID
ALTER proc [dbo].[getinfoByProblemID] @problem_id intas
declare @caller_id varchar(10)declare @sp_id varchar(10)
declare @status intdeclare @op_id varchar(10)
SELECT @caller_id=caller_id FROM CallLog WHERE problem_id=@problem_id
SELECT @sp_id=Assigned_Specalist_ID FROM problem WHERE Problem_ID=@problem_id
SELECT @status=status from problem WHERE Problem_ID=@problem_id
SELECT @op_id=Opeartor_ID FROM CallLog WHERE Problem_ID=@problem_id
SELECT Date,Caller=(SELECT Name from Caller WHERE CallerID=@caller_id),SP=(SELECT name from Specialist WHERE
Specialist_ID=@sp_id),@status As Status,@op_id as Operator from calllog WHERE problem_id=@problem_id
get
De
par
men
tB
yEq
uip
me
ntI
d
ALTER proc [dbo].[getDeparmentByEquipmentId] @eqid intAS
SELECT * FROM Department WHERE depID=(SELECT depID FROM Equipment WHERE EquipmentId=@eqid)
25
Ca
ller
tim
elin
eALTER proc [dbo].[timelineByCaller] @callerid varchar(10),@startdate varchar(12),@enddate varchar(12)as
SELECT * FROM calllog WHERE caller_id=@callerid AND date BETWEEN @startdate AND @enddate ORDER BY date,time
Table 5– DDL for stored procedures
26
TriggersU
pd
ate
Eq
typ
e
ALTER TRIGGER [dbo].[updateeqtype] ON [dbo].[Equipment]FOR INSERT,UPDATE,DELETEAS
declare @eqtype_id varchar(10)declare @cnt int
SELECT @eqtype_id=CatogoryID FROM inserted
SELECT @cnt=count(*) FROM Equipment WHERE CatogoryID=@eqtype_id
Update Equipment_type SET Quantity=@cnt WHERE Eq_type_ID=@eqtype_id
Up
dat
e N
o.P
rob
ems
ALTER TRIGGER [dbo].[update_problems_in_calllog] ON [dbo].[Problem]FOR INSERT,UPDATE,DELETEAS
declare @calllog_id varchar(10)declare @cnt int
SELECT @calllog_id=Calllog_ID FROM inserted
SELECT @cnt=count(*) FROM Problem WHERE Calllog_ID=@calllog_id
Update calllog SET Problem_count=@cnt WHERE Call_ID=@calllog_id
Nu
mb
er o
f ca
llers
ALTER TRIGGER [dbo].[updatenumcallers] ON [dbo].[Caller]FOR INSERT,UPDATE,DELETEAS
declare @caller_id varchar(10)declare @cnt int
SELECT @caller_id=DepID FROM inserted
SELECT @cnt=count(*) FROM Caller WHERE DepID=@caller_id
Update Department SET No_Employees=@cnt WHERE DepID=@caller_id
Table 5– DDL for triggers
27
References
JQuery(2010).The jQuery Project [Online].Available from:http://jquery.com/ [Accessed 9 July 2010].
28