-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomer.php
164 lines (159 loc) · 8.16 KB
/
customer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
include('db.inc.php');
session_start();
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") || $_GET['xml']=="true") {
header("Content-type: application/xhtml+xml");
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";}
else {header("Content-type: text/html");}
if(isset($_REQUEST['cid']) and is_numeric($_REQUEST['cid'])){
$cid = $_REQUEST['cid'];
$_SESSION['cid'] = $_REQUEST['cid'];}
//elseif(!is_null($_SESSION['cid']) and is_numeric($_SESSION['cid'])) $cid = $_SESSION['cid'];
else $cid = NULL;
if(isset($_REQUEST['call_id']) and is_numeric($_REQUEST['call_id'])){
$call_id = $_REQUEST['call_id'];
$_SESSION['call_id'] = $_REQUEST['call_id'];}
//elseif(!is_null($_SESSION['call_id']) and is_numeric($_SESSION['call_id'])) $call_id = $_SESSION['call_id'];
else $call_id = NULL;
if(isset($_REQUEST['coid']) and is_numeric($_REQUEST['coid'])){
$coid = $_REQUEST['coid'];
$_SESSION['coid'] = $_REQUEST['coid'];}
elseif(isset($_SESSION['coid']) and is_numeric($_SESSION['coid'])) $coid = $_SESSION['coid'];
else $coid = NULL;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Perceptionist, Inc. - Customer Information</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="Description" content="Perceptionist, Inc. Bringing Everyone Together" />
<meta name="Keywords" content="receptionist, call center, secretary, professional" />
<meta name="Author" content="3AM Productions" />
<meta name="Copyright" content="2005" />
<link rel="Shortcut Icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="constant.css" type="text/css" media="screen" />
<link rel="stylesheet" href="customer.css" type="text/css" media="screen" />
<script type="text/javascript" src="scripts/countdown.js" defer="defer"></script>
</head>
<body>
<div id="header"></div><!--Header-->
<div id="container">
<div id="titlebar"></div><!--titlebar-->
<br style="clear:both;" />
<div id="main">
<ul id="nav">
<li><a href="perception.php" accesskey="h"><em>h</em>ome</a></li>
<li><a href="report.php#complaints" accesskey="c"><em>c</em>omplaints</a></li>
<li><a href="report.php#unresolved" accesskey="u"><em>u</em>nresolved calls</a></li>
<li><a href="contact.php" accesskey="o">c<em>o</em>ntact list</a></li>
<li><a href="report.php" accesskey="r"><em>r</em>eport</a></li>
</ul> <!--nav-->
<div id="navfill">
<h1>Customer Information</h1>
This page contains information concerning one particular customer. It includes he basics like name, address and phone number. But it also contains an in-depth biography of the customer along with their request to give a more personalized experience. The <b>Perceptionist Call Flow</b> showing the path this customer took to appear on this page is also shown.
</div><!--navfill-->
<br style="clear:both;" />
<?php
if(!is_null($cid))
{
$sql = 'SELECT *,to_char(customer_bio.birthday, \'FMMonth DDth, YYYY\') AS bdate FROM customer LEFT JOIN customer_bio ON (customer.customer_id = customer_bio.customer_id) WHERE (customer.customer_id = $1)';
$result = pg_query_params($db, $sql, [$cid]);
if($bio = pg_fetch_assoc($result))
{
if(!is_null($call_id))
{
$sql = 'SELECT * FROM call LEFT JOIN flow ON (call.call_id = flow.call_id) LEFT JOIN employee ON (flow.employee_id = employee.employee_id) LEFT JOIN customer ON (customer.customer_id = call.customer_id) WHERE call.call_id = $1 AND (call.resolved != 1)';
$params = [$call_id];
if(!is_null($coid)){
$sql .= " AND call.company_id = $2";
array_push($params, $coid);
}
$sql.= ' ORDER BY call.call_time';
$result2 = pg_query_params($db, $sql, $params);
if($call = pg_fetch_assoc($result2))
echo '<div id="time">Time since this call: -<span id="countdown1">'.$call['call_time'].'</span></div><!--time-->'."\n";
}
echo '<div id="infocontainer">'."\n";
echo '<h3>'.$bio['fname'].' '.$bio['lname'].'</h3>'."\n";
echo '<address id="phone">'.$bio['phone'].'</address>'."\n";
echo '<address>'.$bio['address'].'<br />'.$bio['city'].', '.$bio['state'].' '.$bio['zip'].'</address>'."\n";
if(!is_null($call_id) and pg_result_seek($result2, 0))
{
if($call = pg_fetch_assoc($result2)){
echo '<dl id="request">'."\n";
echo ' <dt>Request:</dt><dd>'.wordwrap($call['request'], 75, " ", 1).'</dd>'."\n";
echo ' <dt>Perceptionist Call Flow:</dt>'."\n";
echo ' <dd><a id="resolve_call" href="resolve.php?call_id='.$call['call_id'].'" title="Click to resolve this call." onclick="return confirm(\'Click \\\'OK\\\' if '.$call['fname'].' '.$call['lname'].'\\\'s call has been resolved.\');"><img src="images/resolve2.gif" alt="Resolve Call" onmouseover="this.src=\'images/resolve2hover.gif\'" onmouseout="this.src=\'images/resolve2.gif\'" /></a>';
echo $bio['fname'].' (Customer) --- Perceptionist --- <a href="perception.php?eid='.$call['employee_id'].'">'.$call['employee_fname'].'</a>';
while($call = pg_fetch_assoc($result2)) echo ' --- <a href="perception.php?eid='.$call['employee_id'].'">'.$call['employee_fname'].'</a>';
echo "</dd>\n</dl>\n";
}
}
$sql = 'SELECT * FROM call WHERE call.resolved != 1 AND customer_id = $1';
$params = [$cid];
if(!is_null($coid)){
array_push($params, $coid);
$sql .= ' AND call.company_id = $'.sizeof($params);
}
if(!is_null($call_id)){
array_push($params, $call_id);
$sql .= ' AND call_id != $'.sizeof($params);
$counter = 2;}
else{
$counter = 1;}
$result2 = pg_query_params($db, $sql, $params);
if($call = pg_fetch_assoc($result2)){
echo '<div id="tablewrapper">'."\n";
echo '<table id="calls">'."\n";
echo '<thead><tr><th colspan="4">! '.$bio['fname'].' has '.pg_num_rows($result2).' other unresolved call'.(pg_num_rows($result2)>1? 's' : '').'.</th></tr></thead>';
echo '<tbody>'."\n";
pg_result_seek($result2, 0);
while($call = pg_fetch_assoc($result2)){
// trim request
$request = $call['request'];
if(strlen($request) > 50){
$request = substr($request,0,50);
$pos = strrpos ($request,'.');
if($pos !== false) $request = substr($request,0,$pos+1 );
else {
$pos = strrpos ($request,' ');
if($pos !== false) $request = substr($request,0,$pos) . '...';
else $request .= '...';
}
}
echo "<tr>\n";
echo ' <td class="one"><a href="?cid='.$call['customer_id'].'&call_id='.$call['call_id'].'">'.$bio['fname'].'</a></td>'."\n";
echo ' <td class="two">Request: '.$request.'</td>'."\n";
echo ' <td class="three"> -<span id="countdown'.$counter.'">'.$call['call_time'].'</span></td>'."\n";
//echo ' <td class="four"><a href="resolve.php?call_id='.$call['call_id'].'&refer='.$PHP_SELF.'" title="Click to resolve this call." onclick="return confirm(\'Click \\\'OK\\\' if '.$bio['fname'].' '.$bio['lname'].'\\\'s call has been resolved.\');"><img src="images/resolve.gif" alt="Resolve Call" /></a></td>';
echo '</tr>'."\n";
$counter++;
}
echo '</tbody>'."\n";
echo '</table>'."\n";
echo '</div>'."\n";
}
echo '<h4>Bio Info</h4>'."\n";
echo '<dl id="bio">'."\n";
echo ' <dt>Nickname:</dt><dd>"'.$bio['nickname'].'"</dd>'."\n";
echo ' <dt>Birthday:</dt><dd>'.$bio['bdate'].'</dd>'."\n";
echo ' <dt>Hobbies:</dt><dd>'.$bio['hobbies'].'</dd>'."\n";
echo ' <dt>Miscellaneous:</dt><dd>'.$bio['misc'].'</dd>'."\n";
echo '</dl><!--bio-->'."\n";
echo '</div><!--infocontainer-->'."\n";
}
}
?>
<a href="http://student.cob.ohio-state.edu/velasquez_13">
<span id="innerfooter">
<span class="ifootheader">a 3AM production</span>
<span class="ifootertop">Does your company have a web presence?</span>
<span class="ifooterbottom">Click here to find out why you need one and how 3AM can help you get there...</span>
</span><!--innerfooter-->
</a>
</div> <!-- main -->
</div><!-- container -->
<div id="footer"></div><!--footer-->
</body>
</html>