Reporting by Dates

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
jrankin
Posts: 1
Joined: Sat Jun 27, 2009 3:43 pm

Reporting by Dates

Post by jrankin »

Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

Great Software!!!

We are a small company and your script was a great value for the dollar!!

I would like to run reports on tickets that have been closed at the end of each month. I see where I can view tickets by date, but not between dates, such as between 7-1-09 and 7-31-09. I can view all tickets, depending on the attributes I choose, but sorting through them by the name of the tech that closed the ticket throughout a given month would be very time consuming.

Is this possible and I have just missed the setting?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

As a quick fix you can try this:

- open file "find_tickets.php" (located in admin folder) in Notepad
- change

Code: Select all

	    if (!preg_match("/\d{4}-\d{2}-\d{2}/",$extra))
	    {
	    	hesk_error($hesklang['date_not_valid']);
	    }
	    $sql .= "(`dt` LIKE '$extra%' OR `lastchange` LIKE '$extra%')";
to this:

Code: Select all

$sql .= " `lastchange` LIKE '$extra%' "; 
- save changes and upload to the server

You should be able to list all tickets closed in a month by entering YYYY-MM-% in the date field. For example to list all tickets closed in June 2009 you would enter:
2009-06-%

For all tickets closed in November 2008:
2008-11-%

and so on...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
bexter
Posts: 16
Joined: Wed Jun 16, 2010 9:05 pm

Post by bexter »

hi klemen
how can i do this in 2.2 version?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

A bit more complicated. In find_tickets.php try changing

Code: Select all

if (preg_match("/(\d{4})-(\d{2})-(\d{2})/",$_GET['dt'],$m))
{
	$_GET['dt']=$m[2].$m[3].$m[1];
}

/* -> Now process the date value */
$dt = preg_replace('/[^0-9]/','',$_GET['dt']);
if (strlen($dt) == 8)
{
	$date = substr($dt,4,4) . '-' . substr($dt,0,2) . '-' . substr($dt,2,2);
	$date_input= substr($dt,0,2) . '/' . substr($dt,2,2) . '/' . substr($dt,4,4);

	/* This search is valid even if no query is entered */
	if ($no_query)
	{
		$hesk_error_buffer = str_replace($hesklang['fsq'],'',$hesk_error_buffer);
	}
    else
    {
    	$sql .= ' AND ';
    }

	$sql .= " (`dt` LIKE '".hesk_dbEscape($date)."%' OR `lastchange` LIKE '".hesk_dbEscape($date)."%') ";
}
to

Code: Select all

if (preg_match("/(\d{4})-(\d{2})/",$_GET['dt'],$m))
{
	$_GET['dt']=$m[2].'01'.$m[1];
}

/* -> Now process the date value */
$dt = preg_replace('/[^0-9]/','',$_GET['dt']);
if (strlen($dt) == 8)
{
	$date = substr($dt,4,4) . '-' . substr($dt,0,2);
	$date_input= substr($dt,0,2) . '/01/' . substr($dt,4,4);

	/* This search is valid even if no query is entered */
	if ($no_query)
	{
		$hesk_error_buffer = str_replace($hesklang['fsq'],'',$hesk_error_buffer);
	}
    else
    {
    	$sql .= ' AND ';
    }

	$sql .= " (`dt` LIKE '".hesk_dbEscape($date)."%' OR `lastchange` LIKE '".hesk_dbEscape($date)."%') ";
}
Haven't tested it though...
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
eastersealsnh
Posts: 1
Joined: Thu Nov 11, 2010 7:11 pm

Re: Reporting by Dates

Post by eastersealsnh »

This worked great for us! Thank you so much Klemen! (the v2.2 fix)
Post Reply