arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« on: November 24, 2008, 11:20:39 AM » |
|
Hello,
I'm interested in knowing of anyone has attempted this ...and if it was sucessfull,
This is what I'm looking for.
Under Reports I would like to have a new selection that allows me to generate a Operator Preformance Summary Report meaning ....
The report type would be "Operator Preformance Summary Report" and then I select the operator name...and click "build report" .....I would like the output to be a summary of all orders processed by the specified operator via dept worked in .
Example
Dept 1 - 5 Dept 2 - 2 Dept 3 - 56 Dept 4 - 23 Dept 5 - 1
Would this be possible ?
Thank you in advance
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #1 on: November 24, 2008, 11:47:51 AM » |
|
You would need to create this subroutine from scratch.
You should be able to filter and count everything matching each department.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #2 on: November 24, 2008, 11:54:45 AM » |
|
A modified Operator Performance subroutine would do it.
Duplicate and rename the Operator Performance subroutine.
Modify to suit your needs.
Add the new report to the menu list.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #3 on: November 25, 2008, 12:32:01 PM » |
|
Thank you for the response .....
So far I have
Duplicated and renamed the Operator Performance subroutine
Added the new report to the menu list
and I tested it and it works ..... now I need to modify it ..as you stated ... and here is where I'm getting a bit confused
in TTXReports.pm
I see
Line 755 - my $opercnts = {};
I'm guessing that "$opercnts" would = "$grplist"
and anywhere I see "$oper" that would = "$grpname"
Does that seem right?
Thank you in advance
|
|
|
|
|
Logged
|
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #4 on: November 25, 2008, 01:02:10 PM » |
|
Actually ....on second thought .. I think I didn't explain the question properly
Would the following equal each other
my @operlist = my @grplist
$oper = $grp
$opercnts = $grpname
Thank you in advance
|
|
|
|
|
Logged
|
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #5 on: November 25, 2008, 01:44:58 PM » |
|
I decide to try to code this ..... I have created and modified the new subroutine ...but now I'm getting an Internal Server Error.... Here is the subroutine code ..... # ===================================================================== operperfsum
sub operperfsum { my ($cfg, $query, $data) = @_; my $tmcuts = cuttimes($cfg); my $img = $cfg->get('imgurl')."/dot.gif"; fltrcode($cfg, $query, $data, 1, 1); my @fltr = mkfilter($cfg, $query); my %drange = ( fld => 'updated', stm => $tmcuts->{trail}->{months12}->{start}, etm => $tmcuts->{today}->{stop} ); my $cond = {col => 'status', expr => '^(CLS|WFR)$'}; push @fltr, $cond; $| = 1; my $tickets = TTXCommon::dbtik(); my $tmp = $cfg->set('hideoldsolved', ''); my $browser = $tickets->list(0, 999999, 'open', 'A', \@fltr, \%drange); $cfg->set('hideoldsolved', $tmp); $tmcuts->{total}->{cnt} = $browser->{total}; [color=red]my $grplist[/color] = {};
my $m12stop = $tmcuts->{trail}->{months12}->{stop}; my $w12stop = $tmcuts->{trail}->{weeks12}->{stop}; my $w12start = $tmcuts->{trail}->{weeks12}->{start}; my $d30stop = $tmcuts->{trail}->{days30}->{stop}; my $d30start = $tmcuts->{trail}->{days30}->{start}; my $tcnt = 0; foreach my $tid (@{$browser->{list}}) { if (!$tcnt) { print "\n"; $tcnt = 100; } --$tcnt; my $t = $tickets->ticket($tid, 1); next if $t eq undef; [color=red]my $grpname = $t->{grp};[/color] next if [color=red]$grplist [/color] eq undef; my $tm = $t->{updated}; if ($tm < $m12stop) { ++[color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{m12}; } else { ++[color=red]$grplist[/color]>{[color=red]$grpname[/color]}->{thismonth}; } if ($tm >= $w12start) { if ($tm < $w12stop) { ++[color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{w12}; } else { ++[color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{thisweek}; } } if ($tm >= $d30start) { if ($tm < $d30stop) { ++[color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{d30}; } else { ++[color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{today}; } } # # Purge ticket out of memory # This is pretty safe if using SQL Edition (both MySQL and SQL Server). # If using Standard (palin text database) Edition the consequent # $tickets->save would destroy the database. # delete $tickets->{TICKETS}->{$tid}; } my $bars = []; [color=red]my @grplist = TTXGroups::list();[/color] [color=red]@grplist = sort @grplist;[/color] my $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; if ([color=red]$grplist[/color]->{[color=red]$grpname[/color]} ne undef) { $bars->[$i]->{val} = [color=red]$grplist[/color]->{[color=red]$grpname[/color]}->{m12}; } ++$i; } my $chart = TTXBarChart::hbar($bars, 18, 125, 'red', 0.8); $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; [color=red] if ($grplist->{$grpname} ne undef) { $bars->[$i]->{val} = $grplist->{$grpname}->{w12};[/color] } ++$i; } my $chart1 = TTXBarChart::hbar($bars, 18, 125, 'blue', 0.8); $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; [color=red]if ($grplist->{$grpname} ne undef) { $bars->[$i]->{val} = $grplist->{$grpname}->{d30};[/color] } ++$i; } my $chartd30 = TTXBarChart::hbar($bars, 18, 125, 'green', 0.8); $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; [color=red] if ($grplist->{$grpname} ne undef) { $bars->[$i]->{val} = $grplist->{$grpname}->{today};[/color] } ++$i; } my $charttoday = TTXBarChart::hbar($bars, 18, 125, 'green', 0.8); $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; [color=red]if ($grplist->{$grpname} ne undef) { $bars->[$i]->{val} = $grplist->{$grpname}->{thisweek};[/color] } ++$i; } my $chartthisweek = TTXBarChart::hbar($bars, 18, 125, 'blue', 0.8); $i = 0; foreach my [color=red]$grpname (@grplist)[/color] { $bars->[$i]->{lbl} = [color=red]$grpname[/color]; $bars->[$i]->{val} = 0; [color=red] if ($grplist->{$grpname} ne undef) { $bars->[$i]->{val} = $grplist->{$grpname}->{thismonth};[/color] } ++$i; } my $chartthismonth = TTXBarChart::hbar($bars, 18, 125, 'red', 0.8); $data->{REPORT} .=<<EOT; <br> <table cellpadding=0 cellspacing=0> <tr> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, this month%]</b></center> <br> $chartthismonth </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, this week%]</b></center> <br> $chartthisweek </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, today%]</b></center> <br> $charttoday </td> </tr> </table> </td> </tr> <tr> <td colspan=5><img src="$img" width=1 height=10 /></td> </tr> <tr> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 12 months%]</b></center> <br> $chart </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 12 weeks%]</b></center> <br> $chart1 </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 30 days%]</b></center> <br> $chartd30 </td> </tr> </table> </td> </tr> </table> <br class=tiny /> EOT }
|
|
|
|
« Last Edit: November 28, 2008, 12:19:00 PM by Sparky »
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #6 on: November 25, 2008, 02:43:01 PM » |
|
I might suggest an alternate approach to this so that you know where your error is caused. "baby steps" Only change one or two lines, then test results, and continue. I think you may have used a variable name that was meant for something else or forgot to declare it. Without investigating it further, I'm only guessing... $opercnts = $grpname I think $opercnts is a variable created to hold the count... there probably isn't a corresponding one for the groups... you'd have to create it. I'm not sure how familiar you are with Perl but by changing or tweaking one line at a time, you'll learn how the original subroutine works... then you can better be able to make your modification succeed. So far I have
Duplicated and renamed the Operator Performance subroutine
Added the new report to the menu list
and I tested it and it works ..... yes, exactly, the perfect first baby-step ... successful.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #7 on: November 25, 2008, 03:15:29 PM » |
|
Okay ... so I have done extacly how you stated ...baby steps .....
I went to the original code (with duplicate subroutine) ..... tested it and worked
and then the change I made was to line 755 from (my $opercnts) to (my $grplist) and uploaded it, tested it and got the following error
Fatal Error: Unable to load module TTXReports
Global symbol "$opercnts" requires explicit package name at /services/webpages/d/e/dev.csg.mts.net/cgi-bin/TTXReports.pm line 775. Global symbol "$opercnts" requires explicit package name at /services/webpages/d/e/dev.csg.mts.net/cgi-
its the same error from lines 775 to 859 and ends in
Compilation failed in require at (eval 11) line 2. BEGIN failed--compilation aborted at (eval 11) line 2.
SD:/services/webpages/d/e/dev.csg.mts.net/cgi-bin
I'm still a newbie at perl ...but with a lil direction ...i can manage ...it has been about a year since I played with it ...
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #8 on: November 25, 2008, 03:35:07 PM » |
|
... and then the change I made was to line 755 from (my $opercnts) to (my $grplist) and uploaded it, tested it and got the following error
Fatal Error: Unable to load module TTXReports
Global symbol "$opercnts" requires explicit package name... That error is because you removed the declaration for $opercnts but it's still in the subroutine. Fix it by temporarily adding another line... my $opercnts;
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #9 on: November 25, 2008, 04:21:30 PM » |
|
Thank you Sparky ....
I added that line and I'm not getting errors ... still need to modify it to what I need ...I'll be playing with this tommorrow
|
|
|
|
|
Logged
|
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #10 on: November 26, 2008, 08:32:16 AM » |
|
Good Morning ! ...or evening I guess Okay ... this is strange but true ..... I've modified the code for the new subroutine ..... and tested it ... here's the weird part (for me anyways) I select the new report type ( Operator Preformance Summary ) and select an operator ...and click "build report" ..... it runs and displays the same report as if I selected ( Operator Preformance ) The only thing that comes to mind ....or stands out for me is that maybe i have mixed "$grpname->{$grp}" should it be "$grp->{$grpname}" Here is the code # ===================================================================== operperfsum
sub operperfsum { my ($cfg, $query, $data) = @_; my $tmcuts = cuttimes($cfg); my $img = $cfg->get('imgurl')."/dot.gif"; fltrcode($cfg, $query, $data, 1, 1); my @fltr = mkfilter($cfg, $query); my %drange = ( fld => 'updated', stm => $tmcuts->{trail}->{months12}->{start}, etm => $tmcuts->{today}->{stop} ); my $cond = {col => 'status', expr => '^(CLS|WFR)$'}; push @fltr, $cond; $| = 1; my $tickets = TTXCommon::dbtik(); my $tmp = $cfg->set('hideoldsolved', ''); my $browser = $tickets->list(0, 999999, 'open', 'A', \@fltr, \%drange); $cfg->set('hideoldsolved', $tmp); $tmcuts->{total}->{cnt} = $browser->{total}; my $grpname = {}; my $opercnts;
my $m12stop = $tmcuts->{trail}->{months12}->{stop}; my $w12stop = $tmcuts->{trail}->{weeks12}->{stop}; my $w12start = $tmcuts->{trail}->{weeks12}->{start}; my $d30stop = $tmcuts->{trail}->{days30}->{stop}; my $d30start = $tmcuts->{trail}->{days30}->{start}; my $tcnt = 0; foreach my $tid (@{$browser->{list}}) { if (!$tcnt) { print "\n"; $tcnt = 100; } --$tcnt; my $t = $tickets->ticket($tid, 1); next if $t eq undef; my $grp = $t->{grp}; next if $grp eq undef; my $tm = $t->{updated}; if ($tm < $m12stop) { ++$grpname->{$grp}->{m12}; } else { ++$grpname->{$grp}->{thismonth}; } if ($tm >= $w12start) { if ($tm < $w12stop) { ++$grpname->{$grp}->{w12}; } else { ++$grpname->{$grp}->{thisweek}; } } if ($tm >= $d30start) { if ($tm < $d30stop) { ++$grpname->{$grp}->{d30}; } else { ++$grpname->{$grp}->{today}; } } # # Purge ticket out of memory # This is pretty safe if using SQL Edition (both MySQL and SQL Server). # If using Standard (palin text database) Edition the consequent # $tickets->save would destroy the database. # delete $tickets->{TICKETS}->{$tid}; } my $bars = []; my @grplist = TTXUser::list(); @grplist = sort @grplist; my $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{m12}; } ++$i; } my $chart = TTXBarChart::hbar($bars, 18, 125, 'red', 0.8); $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{w12}; } ++$i; } my $chart1 = TTXBarChart::hbar($bars, 18, 125, 'blue', 0.8); $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{d30}; } ++$i; } my $chartd30 = TTXBarChart::hbar($bars, 18, 125, 'green', 0.8); $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{today}; } ++$i; } my $charttoday = TTXBarChart::hbar($bars, 18, 125, 'green', 0.8); $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{thisweek}; } ++$i; } my $chartthisweek = TTXBarChart::hbar($bars, 18, 125, 'blue', 0.8); $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{thismonth}; } ++$i; } my $chartthismonth = TTXBarChart::hbar($bars, 18, 125, 'red', 0.8); $data->{REPORT} .=<<EOT; <br> <table cellpadding=0 cellspacing=0> <tr> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, this month%]</b></center> <br> $chartthismonth </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, this week%]</b></center> <br> $chartthisweek </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, today%]</b></center> <br> $charttoday </td> </tr> </table> </td> </tr> <tr> <td colspan=5><img src="$img" width=1 height=10 /></td> </tr> <tr> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 12 months%]</b></center> <br> $chart </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 12 weeks%]</b></center> <br> $chart1 </td> </tr> </table> </td> <td><img src="$img" width=17 height=1 /></td> <td align=center valign=top> <table width="100%" cellpadding=10 style="border-style:solid;border-color:gray;border-width:1px;"> <tr> <td align=left> <center><b>[%Service Requests Confirmed, last 30 days%]</b></center> <br> $chartd30 </td> </tr> </table> </td> </tr> </table> <br class=tiny /> EOT }
|
|
|
|
« Last Edit: November 28, 2008, 12:19:26 PM by Sparky »
|
Logged
|
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #11 on: November 26, 2008, 10:02:28 AM » |
|
Update !
I changed lines
my $bars = []; my @operlist = TTXUser::list(); @operlist = sort @operlist; my $i = 0; foreach my $oper (@operlist) { $bars->[$i]->{lbl} = $oper; $bars->[$i]->{val} = 0; if ($opercnts->{$oper} ne undef) { $bars->[$i]->{val} = $opercnts->{$oper}->{m12}; } ++$i;
To ....
my $bars = []; my @grplist = TTXGroups::grouplist(); @grplist = sort @grplist; my $i = 0; foreach my $grp (@grplist) { $bars->[$i]->{lbl} = $grp; $bars->[$i]->{val} = 0; if ($grpname->{$grp} ne undef) { $bars->[$i]->{val} = $grpname->{$grp}->{m12}; } ++$i;
and tested it and ....it seems like it tries to run the report ... and just when its about to display it ...I get a blank page .......
any thoughts anyone .....
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #12 on: November 26, 2008, 10:03:55 AM » |
|
Have you created any new variables yet or just substituting and guessing? I think $opercnts is a variable created to hold the count... there probably isn't a corresponding one for the groups... you'd have to create it. You'll have to spend enough time figuring out how this subroutine works before you can modify it.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 9
Posts: 400
Yeah thats right !
|
 |
« Reply #13 on: November 26, 2008, 10:10:21 AM » |
|
Hi Sparky,
just substituting and guessing ..... where would I create the new variable?
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 82
Posts: 2,206
stop pushing all those buttons
|
 |
« Reply #14 on: November 26, 2008, 10:14:22 AM » |
|
Hi Sparky,
just substituting and guessing ..... where would I create the new variable?
my $newcustomvariable; ... someplace near the top of the subroutine. Like I said, I'd spend a day or two making sure I fully understand how this subroutine works before making my mod. That's how I started.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
|