Jump to content

Display your average ticket response time (Client area, admin and email)


Recommended Posts

I am a customer at media temple and decided to mimic their "response time" thing. So now we can show off the average time it takes us to reply tickets.

 

You can get the code for the widget and client area at: http://portaldohost.com.br/whmcs/media-do-tempo-de-resposta-de-tickets-no-whmcs#.T334EtXNmg8

 

The code for the email template: http://www.whmcs.blog.br/principal/media-do-tempo-de-resposta-de-tickets-no-whmcs/#.T332CdXNmg8

Link to comment
Share on other sites

  • 1 month later...

I tried this in a plain php file and got this result

 

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/dreamweb/public_html/time.php on line 2

 

$ User = "myusername" / / user database

 

Any ideas why I got this result

Link to comment
Share on other sites

Actually the first code works in any php page:

 

<?php
$servidor = "localhost"; // database server
$usuario = "usuario"; // user
$senha = "senha"; // password
$banco = "login_banco"; // database name

$conecta = mysql_connect($servidor,$usuario,$senha);
if (!$conecta){ die('Error connecting: ' . mysql_error()); }
mysql_select_db($banco, $conecta);

$result = mysql_query("SELECT tk.date, rp.date, tk.id FROM tbltickets as tk, tblticketreplies as rp WHERE tk.id=rp.tid AND tk.admin='' GROUP BY tk.id ORDER BY tk.date DESC LIMIT 0,10");

while($row = mysql_fetch_array($result)) {
$tempo = abs(strtotime($row['0']) - strtotime($row['1']));
$minutos  = floor(($tempo)/ 60);
$tempos[] = $minutos;
}
$media = round(array_sum($tempos)/10);
$horas = (int)($media / 60);
$h = $horas."h";
$minutos = $media - ($horas * 60);
$m = $minutos."min";
echo "Our average response time: ".$h."".$m;
mysql_close($conecta);
?>

 

Hope it helps

Link to comment
Share on other sites

  • 4 weeks later...

hello,

 

i've edited the script to take the last 30 tickets like this:

 

$result = mysql_query("SELECT tk.date, rp.date, tk.id FROM tbltickets as tk, tblticketreplies as rp WHERE tk.id=rp.tid AND tk.admin='' GROUP BY tk.id ORDER BY tk.date DESC LIMIT 0,30");

 

and

 

$media = round(array_sum($tempos)/30);

 

My response time for last 30 tickets are this:

 

0 0 5 5

0 0 2 20

0 0 7 58

0 0 4 10

0 0 27 29

0 0 1 5

0 1 20 57

0 3 51 41

0 0 6 26

0 1 58 34

0 0 36 34

0 0 40 18

0 0 12 15

0 0 10 42

0 0 21 23

0 0 17 18

0 1 12 2

0 0 4 5

0 0 5 45

0 0 10 43

0 0 5 25

0 0 2 3

0 0 42 8

0 1 3 45

0 0 36 51

0 0 27 59

0 0 16 34

0 0 22 55

0 6 33 43

0 0 1 56

(days-hours-minuts-seconds)

 

The average is supposed to be of about 44 minutes, but the script is saying 49 minutes, where is the error? thanks. :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 11 months later...
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated