Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-15-2012, 06:42 PM   PM User | #1
jaacmmason
New to the CF scene

 
Join Date: Jun 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
jaacmmason is an unknown quantity at this point
modify report to print totals by month, not just in 1 large group

I need to modify the code below to add a breakdown of each months totals. Currently the data is only showing total tickets in one row. I want to be able to break the totals down into months so we can see what months are our busy months. I would like the layout to be shown similar to:

Quote:
Month Name / Total Tickets / Total Filtered
Jan / 200 / 109
Feb / 216 / 134

Code:
        $qry = "select count(ticket_number)from tickets where open_time > '$start_epoch' and open_time < '$stop_epoch'";
	$sth = $dbh->prepare("$qry");
	$sth->execute();
	$count1 = $sth->fetchrow_array();
	$count1 = "(Couldn't obtain count)" if !defined($count1);
	$sth->finish();

        $qry = "select count(ticket_number)from tickets where open_time > '$start_epoch' and open_time < '$stop_epoch' and notes != 'automated Ticket' and notes != 'Customer Opened'";
	$sth = $dbh->prepare("$qry");
	$sth->execute();
	$count2 = $sth->fetchrow_array();
	$count2 = "(Couldn't obtain count)" if !defined($count2);
	$sth->finish();

	&reportHeader;
	print "<table border=0 width=25% cellspacing=1 cellpadding=2>";
	print qq{<tr><td>Total Tickets Opened:</td><td>Filtered Tickets Opened:</td>};
	$lastUpdate = localtime($ref->{'last_update'});
	print qq{<tr><td>$count1</td><td>$count2</td></tr>};
The date selection comes from (based on 2 input fields):
Code:
        $start = $input{'start_date'};($start_m,$start_d,$start_y) = split(/\//,$start);
	$stop = $input{'end_date'};($stop_m,$stop_d,$stop_y) = split(/\//,$stop);

	$stop_m -= 1;
	$start_m -= 1;

	$start_epoch = timelocal(0,0,0,$start_d,$start_m,$start_y);
	$stop_epoch = timelocal(59,59,23,$stop_d,$stop_m,$stop_y);

	$startgood = localtime($start_epoch);
	$stopgood = localtime($stop_epoch);
I know I need to have a loop in here somewhere. I am just not sure what the easiest way to do this would be.
jaacmmason is offline   Reply With Quote
Reply

Bookmarks

Tags
perl

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:14 PM.


Advertisement
Log in to turn off these ads.