You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							1957 lines
						
					
					
						
							86 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							1957 lines
						
					
					
						
							86 KiB
						
					
					
				
								#!/usr/bin/perl
							 | 
						|
								#
							 | 
						|
								# Source File: IntegroPassion.pl
							 | 
						|
								
							 | 
						|
								# Get config
							 | 
						|
								use FileHandle;
							 | 
						|
								use Time::Local;
							 | 
						|
								use Data::Dumper;
							 | 
						|
								use IntegroLib;
							 | 
						|
								require 'sitecfg.pl';
							 | 
						|
								require 'testlib.pl';
							 | 
						|
								require 'tstatlib.pl';
							 | 
						|
								require 'LikertData.pl';
							 | 
						|
								
							 | 
						|
								use strict;
							 | 
						|
								use vars qw(%FORM %SESSION %CLIENT %TEST_SESSION %SUBTEST_QUESTIONS %TEST
							 | 
						|
									    %SUBTEST_SUMMARY %CANDIDATE %SUBTEST_ANSWERS %SYSTEM %REPORT
							 | 
						|
									    %SUBTEST_RESPONSES @xlatphrase);
							 | 
						|
								use vars qw($testcomplete $cgiroot $pathsep $dataroot @rptparams $testpending $testinprog $testcomplete);
							 | 
						|
								
							 | 
						|
								&app_initialize;
							 | 
						|
								
							 | 
						|
								$FORM{"idlist"} =~ tr/\000/,/ ; # Change separator for multiple values from NULL to comma.  HBI
							 | 
						|
								
							 | 
						|
								# Make sure we have a valid session, and exit if we don't
							 | 
						|
								if (not &get_session($FORM{'tid'})) {
							 | 
						|
								    exit(0);
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								&LanguageSupportInit();
							 | 
						|
								#print STDERR Dumper(\%SESSION);
							 | 
						|
								&get_client_profile($SESSION{'clid'}); # Populate $CLIENT{}
							 | 
						|
								
							 | 
						|
								if ($FORM{'tstid'}) {
							 | 
						|
									&get_test_profile($CLIENT{'clid'}, $FORM{'tstid'}); # Populate $TEST{}
							 | 
						|
								} elsif (!$rptparams[0]) {
							 | 
						|
									# Check for multiple tests
							 | 
						|
									my @trecs = &get_test_list($CLIENT{'clid'});	#tests in an array
							 | 
						|
									my @tmptrecs = ();
							 | 
						|
									for (1 .. $#trecs) {
							 | 
						|
										my ($id, $desc) = split(/&/, $trecs[$_]);	#id=testid, descr=test description
							 | 
						|
										if ($id =~ "^passion") {push @tmptrecs, join('&', "$desc", "$id");}
							 | 
						|
									}
							 | 
						|
									@trecs = sort @tmptrecs;
							 | 
						|
									if ($#trecs > 0) {
							 | 
						|
										# show test chooser
							 | 
						|
										&print_test_chooser(@trecs);
							 | 
						|
									} 
							 | 
						|
								} 
							 | 
						|
								
							 | 
						|
								# Get the group filters, if any
							 | 
						|
								my ($idlist,$groups);
							 | 
						|
								if (exists $FORM{'grouping'} and $FORM{'grouping'} eq 'subset') {
							 | 
						|
								    #my @tmp = split(/,/,$FORM{'idlist'});
							 | 
						|
								    my @tmp = param('idlist');
							 | 
						|
								    $FORM{'idlist'} = join(',', @tmp);
							 | 
						|
								    @{$groups}{@tmp} = @tmp;
							 | 
						|
								    $idlist = &getIdlist($CLIENT{'clid'},$FORM{'idlist'});
							 | 
						|
								}
							 | 
						|
								# $idlist is a reference to an un-named hash.
							 | 
						|
								#   The keys are candidate ids in the selected groups.
							 | 
						|
								
							 | 
						|
								# Get the time stamp style
							 | 
						|
								my $timestamp;
							 | 
						|
								if ($FORM{'timestamp'} eq 'currenttime') {
							 | 
						|
								    $timestamp = scalar(localtime(time));
							 | 
						|
								} elsif ($FORM{"timestamp"} eq 'custom' and $FORM{'customtime'} ne '') {
							 | 
						|
								    $timestamp = $FORM{'customtime'};
							 | 
						|
								} elsif ($FORM{'timestamp'} eq 'mostrecent' and $FORM{'tstid'}) {
							 | 
						|
								    my $file = join($pathsep,$testcomplete,"$CLIENT{'clid'}.$FORM{'tstid'}.history");
							 | 
						|
								    my $fh = new FileHandle;
							 | 
						|
								    if ($fh->open($file)) {
							 | 
						|
									my @history = map([split(/(?:<<>>|&)/,$_,4)],<$fh>);
							 | 
						|
									#print "<pre>".Dumper(\@history)."</pre>";
							 | 
						|
									if (defined $idlist) {
							 | 
						|
									    foreach (reverse @history) {
							 | 
						|
										if (exists $idlist->{$_->[2]}) {
							 | 
						|
										    $timestamp = scalar(localtime(toGMSeconds($_->[0])));
							 | 
						|
										    last;
							 | 
						|
										}
							 | 
						|
									    }
							 | 
						|
									} else {
							 | 
						|
									    $timestamp = scalar(localtime(toGMSeconds($history[$#history]->[0])));
							 | 
						|
									}
							 | 
						|
								    } else {
							 | 
						|
									print STDERR "Could not open $file in Integro.pl\n";
							 | 
						|
								    }
							 | 
						|
								}
							 | 
						|
								if (substr($FORM{'reportname'},-3) ne 'csv') {
							 | 
						|
									if (defined $timestamp) {
							 | 
						|
									    $timestamp = "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$timestamp</b></font><br><BR>\n";
							 | 
						|
									} else {
							 | 
						|
									    $timestamp = "<br>\n";
							 | 
						|
									}
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# Generate the reports
							 | 
						|
								if ($FORM{'reportname'} eq 'PassionPeopleGroups') { # Section 1
							 | 
						|
								    &PassionPeopleGroups($idlist, $groups, $timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'PassionPeopleSummary') { # Section 1
							 | 
						|
								    &PassionPeopleSummary($timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'PassionIndexGroups') { # Section 2
							 | 
						|
								    &PassionIndexGroups($idlist, $groups, $timestamp);
							 | 
						|
								# } elsif ($FORM{'reportname'} eq 'PassionVertGroups') { # Section 2
							 | 
						|
								#     &PassionVertGroups($idlist, $groups, $timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'PassionIndexSummary') { # Section 2
							 | 
						|
								    &PassionIndexSummary($timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'values') { # Section 3
							 | 
						|
								    &ValuesReport($idlist, $groups, $timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'valuessummary') { # Section 3
							 | 
						|
								    &ValuesSummary($idlist, $groups, $timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'valuescsv') { # Section 3
							 | 
						|
								    &ValuesCSV($idlist, $groups, $timestamp);
							 | 
						|
								} elsif ($FORM{'reportname'} eq 'comments') {  # General Reports
							 | 
						|
								    &CommentsReport($idlist, $timestamp, 0);
							 | 
						|
								# Disable because there are comments on only one question.
							 | 
						|
								# } elsif ($FORM{'reportname'} eq 'comments2') {  # General Reports
							 | 
						|
								#     &CommentsReport($idlist, $timestamp, 1);
							 | 
						|
								} else {
							 | 
						|
								    &ReportChooser();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# There should only be function definitions beyond this point.
							 | 
						|
								exit(0);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								sub grepa {
							 | 
						|
								  # Parms
							 | 
						|
								  # (\@boola, \@data)
							 | 
						|
								  # Returned value.
							 | 
						|
								  # Array of the @data array with a cooresponding value of @boola that is true.
							 | 
						|
								  my (@reta, $bool, $data, $index) ;
							 | 
						|
								  ($bool, $data) = @_ ;
							 | 
						|
								  for ($index=0; $index<=$#$data ; $index++) {
							 | 
						|
								    push @reta, $$data[$index] if ($$bool[$index]) ;
							 | 
						|
								  }
							 | 
						|
								  return @reta ;
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub HTMLHeader {
							 | 
						|
								    return "<html>\n<head>\n<title>$_[0]</title>\n".
							 | 
						|
									"<!--Integro3.pl-->\n".
							 | 
						|
									"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n</head>\n".
							 | 
						|
									"<BODY BACKGROUND=\"$SYSTEM{'BACKGROUND'}\" BGCOLOR=\"$SYSTEM{'BGCOLOR'}\"".
							 | 
						|
									" TEXT=\"$SYSTEM{'TEXT'}\" LINK=\"$SYSTEM{'LINK'}\"".
							 | 
						|
									" VLINK=\"$SYSTEM{'VLINK'}\" ALINK=\"$SYSTEM{'ALINK'}\" " .
							 | 
						|
									" LEFTMARGIN=30 MARGINWIDTH=30 " .
							 | 
						|
									">\n";
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub HTMLHeaderPlain {
							 | 
						|
								    return "<html>\n<head>\n<title>$_[0]</title>\n".
							 | 
						|
									"<script language=\"JavaScript\">\n<!-- \n$_[1]\n -->\n</script>\n" . 
							 | 
						|
									"$_[2]" .
							 | 
						|
									"</head>\n".
							 | 
						|
									"<BODY " .
							 | 
						|
									" LEFTMARGIN=30 MARGINWIDTH=30 " .
							 | 
						|
									">\n";
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub HTMLFooter {
							 | 
						|
								    my $year = `date +%Y`;
							 | 
						|
								    my $ionline;
							 | 
						|
								    if ($ENV{'SERVER_NAME'} =~ "integroonline.com") {
							 | 
						|
									$ionline = " - Copyright (c) $year, Integro Learning Company";
							 | 
						|
								    }
							 | 
						|
								    return "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">Copyright (c) $year, Integro Leadership Institute$ionline</body>\n</html>\n";
							 | 
						|
								    # return "</body>\n</html>\n";
							 | 
						|
										# return "</html>" ;
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub ReportChooser {
							 | 
						|
								    # Links w/javascript for chosing report
							 | 
						|
								    # Radio button to choose between all and select group(s)
							 | 
						|
								    # Menu box to chose one or more groups
							 | 
						|
								    my $groups = &getGroups($CLIENT{'clid'});
							 | 
						|
								    my $js = "function parmsIntegro(oform,rpt) {\n\t".
							 | 
						|
									"if (rpt.indexOf('csv') > 0) { oform.csv.value=1; } else{ oform.csv.value=0; }\n\t".
							 | 
						|
									"oform.reportname.value=rpt;\n\t".
							 | 
						|
									"oform.action='/cgi-bin/creports.pl';\n\t".
							 | 
						|
									"oform.submit();\n};\n";
							 | 
						|
								    $js .= "\nfunction commIntegro(oform) {\n\t".
							 | 
						|
									"oform.rptid.value='ACT-C-004';\n\t".
							 | 
						|
									"oform.rptdesc.value='Test Statistics by Test'\n\t".
							 | 
						|
									"oform.action='/cgi-bin/IntegroTS.pl';\n\t".
							 | 
						|
									"oform.submit();\n};\n";
							 | 
						|
								    my $organizationname = $CLIENT{'clnmc'};
							 | 
						|
								    my $uberheader;
							 | 
						|
								    my $test;
							 | 
						|
								    if ($FORM{'tstid'}) {
							 | 
						|
									    $test = $FORM{'tstid'};
							 | 
						|
								    } elsif ($rptparams[0]) {
							 | 
						|
									    $test = $rptparams[0];
							 | 
						|
								    } else {
							 | 
						|
									    $test = "passion"; # Default test id for this report.  HBI
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    my ($tstid) = grep((/($test\s*)&/ && ($_=$1)),get_data("tests.$CLIENT{'clid'}"));
							 | 
						|
								    if (not $tstid) {
							 | 
						|
									print HTMLHeader("Error! No Employee Passion Survey Found.");
							 | 
						|
									print "<h1>Error! No Employee Passion Survey Found.</h1>\n";
							 | 
						|
									print HTMLFooter();
							 | 
						|
								    }
							 | 
						|
								    #print STDERR get_data("tests.$CLIENT{'clid'}");
							 | 
						|
								    #print STDERR "Test ID = $tstid\n"; 
							 | 
						|
								    print HTMLHeader("Integro Learning Custom Reports",$js);
							 | 
						|
								    print "<form name=\"integrorpt\" action=\"/cgi-bin/creports.pl\" method=\"Post\" target=\"rptwindow\" enctype=\"multipart/form-data\" >\n";
							 | 
						|
								    print "<input type=\"hidden\" name=\"tid\" value=\"$SESSION{'tid'}\">\n";
							 | 
						|
								    # For development purposes we hardcode the survey id.
							 | 
						|
								    # Fix this before production
							 | 
						|
								    print "<input type=hidden name=\"tstid\" value=\"$tstid\">\n";
							 | 
						|
								    print "<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">\n";
							 | 
						|
								    print "<input type=hidden name=\"rptdesc\" value=\"$REPORT{'rptdesc'}\">\n";
							 | 
						|
								    print "<input type=hidden name=\"rptid\" value=\"$REPORT{'rptid'}\">\n";
							 | 
						|
								    print "<input type=\"hidden\" name=\"reportname\" value=\"\">\n";
							 | 
						|
								    print "<input type=\"hidden\" name=\"csv\" value=\"\">\n";
							 | 
						|
								    
							 | 
						|
								    print "<center>\n<table border>\n<caption>Integro Learning Custom Reports</Caption>\n".
							 | 
						|
									"<tr><td valign=\"top\"><input type=\"radio\" name=\"grouping\" value=\"all\" checked>All Groups</td>\n".
							 | 
						|
									"<td valign=\"top\"><input type=\"radio\" name=\"grouping\" value=\"subset\">Choose Groups<br>\n".
							 | 
						|
								        "<select name=\"idlist\" onchange='this.form.grouping[1].click();' multiple>\n";
							 | 
						|
								    foreach (sort {$a->{'grpnme'} cmp $b->{'grpnme'}} values %$groups) {
							 | 
						|
									print "<option value=\"$_->{'grpid'}\">$_->{'grpnme'}</option>\n";
							 | 
						|
								    }
							 | 
						|
								    print "</select>\n";
							 | 
						|
								    #print "<tr><td colspan=\"2\">$xlatphrase[797] $xlatphrase[279]: <input type=\"text\" name=\"orgname\" value=\"$organizationname\"></td></tr>\n";
							 | 
						|
								    print "<tr><td colspan=\"3\"><table border=0><tr><td>Organization Name:</td><td><input type=\"text\" name=\"orgname\" value=\"$organizationname\"></td></tr>\n";
							 | 
						|
								    print "<tr><td>Header Override:</td><td><input type=\"text\" name=\"uberheader\" value=\"$uberheader\"></td></tr></table></tr></td>\n";
							 | 
						|
								    print "<tr><td colspan=\"2\">Time Stamp:<ul style=\"list-style: none\">".
							 | 
						|
									"<li><input type=\"radio\" name=\"timestamp\" value=\"mostrecent\" checked>Most Recent Survey Taken</li>".
							 | 
						|
									"<li><input type=\"radio\" name=\"timestamp\" value=\"currenttime\">Current Time</li>".
							 | 
						|
									"<li><input type=\"radio\" name=\"timestamp\" value=\"custom\">Custom Value: ".
							 | 
						|
									"<input type=\"text\" name=\"customtime\"></li></tr></td>";
							 | 
						|
								    print "</table></center>\n";
							 | 
						|
								    print "<hr>\n";
							 | 
						|
								    #print "<input type=\"checkbox\" name=\"pdf\">Display reports as PDF\n";
							 | 
						|
								    print "<p>Section 1<ul style=\"list-style: none\">" .
							 | 
						|
									"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'PassionPeopleGroups');\">Employee Passion Report</a></li>" .
							 | 
						|
									"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'PassionPeopleSummary');\">Employee Passion Summary</a></li>" ;
							 | 
						|
										print "</ul>" ;
							 | 
						|
								    print "<p>Section 2<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'PassionIndexGroups');\">Passion Index Report</a></li>".
							 | 
						|
								# 	"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'PassionVertGroups');\">Passion Vertical Index Report</a></li>".
							 | 
						|
									"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'PassionIndexSummary');\">Passion Index Summary</a></li>".
							 | 
						|
									# "<li><a href=\"javascript:parmsIntegro(document.integrorpt,'trustlevelcsv');\">Group Trust Level CSV</a></li></ul></p>\n" .
							 | 
						|
										"</ul>" ;
							 | 
						|
								    print "<p>Section 3<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'values');\">Values That Build Trust Report</a></li>".
							 | 
						|
									"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'valuessummary');\">Values That Build Trust Summary</a></li>".
							 | 
						|
									"<li><a href=\"javascript:parmsIntegro(document.integrorpt,'valuescsv');\">Values That Build Trust CSV</a></li></ul></p>\n";
							 | 
						|
								    # print "<p>Section 4<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'commeffect');\">Group Alignment Report</a></li>".
							 | 
						|
									# "<li><a href=\"javascript:parmsIntegro(document.integrorpt,'commeffectsummary');\">Group Alignment Summary</a></li></ul></p>\n";
							 | 
						|
								    # print "<p>Section 5<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'diversity');\">Diversity and Inclusion Report</a></li>".
							 | 
						|
									# "<li><a href=\"javascript:parmsIntegro(document.integrorpt,'diversitysummary');\">Diversity and Inclusion Summary</a></li>".
							 | 
						|
									# "<li><a href=\"javascript:parmsIntegro(document.integrorpt,'diversitycsv');\">Diversity and Inclusion CSV</a></li></ul></p>\n";
							 | 
						|
								    print "<p>General Reports<ul style=\"list-style: none\"><li><a href=\"javascript:parmsIntegro(document.integrorpt,'comments');\">Comments</a></li>";
							 | 
						|
								    # print "<li><a href=\"javascript:parmsIntegro(document.integrorpt,'comments2');\">Comments by Category</a></li>";
							 | 
						|
								    print "<input type=hidden name=\"testsummary\" value=\"composite\">\n";
							 | 
						|
								    print "<input type=hidden name=\"showcmts\" value=\"donot\">\n";
							 | 
						|
								    #my $commurl = "/cgi-bin/teststats.pl?tstid=$tstid".
							 | 
						|
								#	"&tid=$FORM{'tid'}&rptid=ACT-C-004&rptdesc=Test%20Statistics%20by%20Test".
							 | 
						|
								#	"&testsummary=composite&showcmts=donot";
							 | 
						|
								    print "<li><a href=\"javascript:commIntegro(document.integrorpt);\">Question Statistics</a></li></p>\n";
							 | 
						|
								    print "</form>";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The original request was for a pie chart of all
							 | 
						|
								# of the answers on the last question, number 37.  I wrote the survey,
							 | 
						|
								# so question 37 is a Likert Scale question that uses a value of
							 | 
						|
								# "Employee Passion" for its super category.  This function generates the
							 | 
						|
								# report on the Employee Passion super category regardless of the 
							 | 
						|
								# question number.
							 | 
						|
								# This version of the subroutine will have one 3-D piechart with a legend.
							 | 
						|
								# It will have a table with three columns for each 
							 | 
						|
								#   type: Name, Description, and Percentage.
							 | 
						|
								sub PassionPeopleGroups {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
										# warn "idlist $idlist .\n" ;
							 | 
						|
										# warn "idlist keys " . join (" ",keys (%$idlist)) . ".\n" ;
							 | 
						|
										# warn "groups $groups .\n" ;
							 | 
						|
										# warn "groups keys " . join (" ",keys (%$groups)) . ".\n" ;
							 | 
						|
										# warn "timestamp $timestamp .\n" ;
							 | 
						|
										# warn "Client $CLIENT{'clid'} .\n" ;
							 | 
						|
										# warn "Test Id $TEST{'id'} .\n" ;
							 | 
						|
										my $data ;
							 | 
						|
								    my $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
										my %Categories = () ; my $resp ;
							 | 
						|
										# Keith said he wanted to ignore the data for non-responding candidates.
							 | 
						|
										# $Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ;
							 | 
						|
										my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash.
							 | 
						|
										# warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ;
							 | 
						|
										foreach $resp ( keys %$mystery ) {
							 | 
						|
											# each response score.
							 | 
						|
											$Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ;
							 | 
						|
										}
							 | 
						|
								    print HTMLHeaderPlain("Section 1 - Employee Passion");
							 | 
						|
								    print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>" ;
							 | 
						|
										print "Section 1 - Employee Passion Report<br></font>" ;
							 | 
						|
										print "<font size=\"4\">The percentage of employees at each level of Passion</b></font><br><br>\n";
							 | 
						|
								    print "</font></b>\n" ;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								  } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								  }
							 | 
						|
								
							 | 
						|
									my (@values , @Labels , $url, $mykey, @scores, $total) ;
							 | 
						|
									$total = 0 ;
							 | 
						|
									# @Labels = sort keys %Categories ;
							 | 
						|
									@Labels = ("Level 5 - Job and Org", "Level 4 - Job", "Level 3 - Org", 
							 | 
						|
															"Level 2 - Conscientious", "Level 1 - Disconnected") ;
							 | 
						|
									foreach $mykey (sort keys %Categories) {
							 | 
						|
										push @scores,$Categories{$mykey} ;
							 | 
						|
										$total += $Categories{$mykey} ;
							 | 
						|
									}
							 | 
						|
									if ($total) {
							 | 
						|
										@values = map ((100 * $_ / $total),@scores ) ;
							 | 
						|
									} else {
							 | 
						|
										# $total is zero. (Do not divide by zero.)
							 | 
						|
										@values = @scores ;
							 | 
						|
									}
							 | 
						|
									$url = "/cgi-bin/piechart4.pl?values=" .
							 | 
						|
									    join(':',map(int($_+0.5),grepa(\@values,\@values))) .
							 | 
						|
									    # "&labels=" . 
							 | 
						|
											"&xdim=700&ydim=200" .
							 | 
						|
									    "&labels=" . join(":",@Labels) ;
							 | 
						|
											# "&xdim=200&ydim=100&nolegend=1" ;
							 | 
						|
									print "<br><br>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									print join(":", grepa(\@values, ["lred", "lorange", "lyellow", "lgreen", "decentblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "<br><br>\n" ;
							 | 
						|
								  print "<table border>";
							 | 
						|
									# I just need to add the colors to each graph.
							 | 
						|
									# The selected colors are "lred", "lorange", "lyellow", "lgreen", "lblue"
							 | 
						|
									# The deselected colors are "dred", "dbrown", "dyellow", "dgreen", "dblue"
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 5 - Passionate about the job and the organization:</b>\n" ;
							 | 
						|
									print " Employees at level 5 are passionate about their work and the organization they work for.\n";
							 | 
						|
									print " They feel valued and respected and know that what they do makes a real difference." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the percentage.
							 | 
						|
									print "<td><b>\n" ;
							 | 
						|
									printf " %.1f", $values[0] ;
							 | 
						|
								  print " %" ;
							 | 
						|
									print "</b></td>\n" ;
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 4 - Passionate only about the job:</b>\n" ;
							 | 
						|
									print " Level 4 employees are passionate about their work " ;
							 | 
						|
									print "and get great satisfaction from knowing they make a difference.\n";
							 | 
						|
									print " However they feel somewhat disengaged from the organization - " ;
							 | 
						|
									print "they don't feel their contribution is valued." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the percentage.
							 | 
						|
									print "<td><b>\n" ;
							 | 
						|
									printf " %.1f", $values[1] ;
							 | 
						|
								  print " %" ;
							 | 
						|
									print "</b></td>\n" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 3 - Passionate only about the organization:</b>\n" ;
							 | 
						|
									print " Employees at this level are passionate about the organization " ;
							 | 
						|
									print "and believe it delivers real value.\n " ;
							 | 
						|
									print " But they find their work unrewarding - it's just a job." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the percentage.
							 | 
						|
									print "<td><b>\n" ;
							 | 
						|
									printf " %.1f", $values[2] ;
							 | 
						|
								  print " %" ;
							 | 
						|
									print "</b></td>\n" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 2 - Not Passionate, but still conscientious:</b>\n" ;
							 | 
						|
									print " Employees at level 2 are not passionate about the work " ;
							 | 
						|
									print "they do, but are still conscientious about doing a good job. " ;
							 | 
						|
									print "However they feel disconnected from the organization " ;
							 | 
						|
									print "and what it stands for." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the percentage.
							 | 
						|
									print "<td><b>\n" ;
							 | 
						|
									printf " %.1f", $values[3] ;
							 | 
						|
								  print " %" ;
							 | 
						|
									print "</b></td>\n" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 1 - Disconnected from the job and the organization:</b>\n" ;
							 | 
						|
									print " Level 1 employees feel really disconnected from both the work they do " ;
							 | 
						|
									print "and their organization.  If they could find another job, " ;
							 | 
						|
									print "they would take it." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the percentage.
							 | 
						|
									print "<td><b>\n" ;
							 | 
						|
									printf " %.1f", $values[4] ;
							 | 
						|
								  print " %" ;
							 | 
						|
									print "</b></td>\n" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
									# Finish the Table and the page.
							 | 
						|
									print "</table>\n";
							 | 
						|
									print "<br><br>\n";
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a pie chart on the People Passion question,
							 | 
						|
								# on the Employee Passion Survey (id passion).  The original request was for a pie chart of all
							 | 
						|
								# of the answers on the last question, number 37.  I wrote the survey,
							 | 
						|
								# so question 37 is a Likert Scale question that uses a value of
							 | 
						|
								# "Employee Passion" for its super category.  This function generates the
							 | 
						|
								# report on the Employee Passion super category regardless of the 
							 | 
						|
								# question number.
							 | 
						|
								sub PassionPeopleSummary {
							 | 
						|
								  my ($timestamp) = @_;
							 | 
						|
									# warn "timestamp $timestamp .\n" ;
							 | 
						|
									# warn "Client $CLIENT{'clid'} .\n" ;
							 | 
						|
									# warn "Test Id $TEST{'id'} .\n" ;
							 | 
						|
									my $grp_data = getGroups($CLIENT{'clid'}) ;
							 | 
						|
									my %id_grp = () ; # Hash of candidate ids, and groups.
							 | 
						|
									# warn "Do GROUPS" ;
							 | 
						|
									foreach my $grp_id (sort keys %{$grp_data}) {
							 | 
						|
										# warn "Do grp_id $grp_id" ;
							 | 
						|
										my $can_ids = $grp_data->{$grp_id}->{'grplist'} ;
							 | 
						|
										foreach my $id (@$can_ids) {
							 | 
						|
											if ($id_grp{$id}) {
							 | 
						|
												# Candidate id already has a group id.
							 | 
						|
												warn "Candidate id $id is in two groups $id_grp{$id} and $grp_id" ;
							 | 
						|
											} else {
							 | 
						|
												# Candidate id can be assigned.
							 | 
						|
												$id_grp{$id} = $grp_id ;
							 | 
						|
												# warn "GRP MEMBER $id GRP $grp_id" ;
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
									my $data ; my $data_grp ;
							 | 
						|
								  ($data, $data_grp) = &GetLikertGrpData($CLIENT{'clid'},$TEST{'id'}, \%id_grp);
							 | 
						|
									my %Categories = () ; my $resp ;
							 | 
						|
									$Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ;
							 | 
						|
									my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash.
							 | 
						|
									# warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ;
							 | 
						|
									foreach $resp ( keys %$mystery ) {
							 | 
						|
									# each response score.
							 | 
						|
										$Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ;
							 | 
						|
									}
							 | 
						|
								  print HTMLHeaderPlain("Section 1 - Employee Passion Summary");
							 | 
						|
								  print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 1 - Employee Passion Summary</b></font><br><br><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The percentage of employees at each level of passion.</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Integro Leadership Institute</b></font><br><br><br>\n";
							 | 
						|
								  # print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
									print "<br>\n" ;
							 | 
						|
								  print "<table border>";
							 | 
						|
									my (@values , @Labels , $url, $mykey) ;
							 | 
						|
									@Labels = grep !/NoResponse/, sort keys %Categories ;
							 | 
						|
									# The keys of the categories will be 1, 2, 3, 4, and 5.
							 | 
						|
									#   These are Person 1, etc.  They are numbered backwards from Levels.
							 | 
						|
									foreach $mykey (@Labels) {
							 | 
						|
										push @values,$Categories{$mykey} ;
							 | 
						|
									}
							 | 
						|
									print "<tr><th> </th>" ;
							 | 
						|
									print "<th><b>Level 5</b></th>" ;
							 | 
						|
									print "<th><b>Level 4</b></th>" ;
							 | 
						|
									print "<th><b>Level 3</b></th>" ;
							 | 
						|
									print "<th><b>Level 2</b></th>" ;
							 | 
						|
									print "<th><b>Level 1</b></th>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
								  my $grp_name ;
							 | 
						|
								
							 | 
						|
									print "<tr><td>Overall</td>" ;
							 | 
						|
									my $total = 0 ; my $percent ;
							 | 
						|
									foreach $mykey (@Labels) {
							 | 
						|
										$total += $Categories{$mykey} ;
							 | 
						|
									}
							 | 
						|
									foreach $mykey (@Labels) {
							 | 
						|
										if ($total) {
							 | 
						|
											# Compute percent
							 | 
						|
											$percent = 100 * $Categories{$mykey} / $total ;
							 | 
						|
										} else {
							 | 
						|
											# $total is zero.  Use 0% for all values.
							 | 
						|
											$percent = 0 ;
							 | 
						|
										}
							 | 
						|
										printf "<td align=center>%.1f %</td>", $percent ;
							 | 
						|
									}
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									
							 | 
						|
									print "<tr><td><b>Group Breakdown</b></td></tr>\n" ;
							 | 
						|
								
							 | 
						|
									print "<tr><td><b>Group</b></td>" ;
							 | 
						|
									print "<td><b>Level 5</b></td>" ;
							 | 
						|
									print "<td><b>Level 4</b></td>" ;
							 | 
						|
									print "<td><b>Level 3</b></td>" ;
							 | 
						|
									print "<td><b>Level 2</b></td>" ;
							 | 
						|
									print "<td><b>Level 1</b></td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
									foreach my $grp_id (sort keys %{$grp_data}) {
							 | 
						|
										# Get the total for the group.
							 | 
						|
										$total = 0 ;
							 | 
						|
										foreach $mykey (@Labels) {
							 | 
						|
											$total += $data_grp->{$grp_id}->{'Employee Passion'}->{'ScoreCount'}->{$mykey} ;
							 | 
						|
											# warn "grp $grp_id new total $total" ;
							 | 
						|
										}
							 | 
						|
										my $group_name = $grp_data->{$grp_id}->{'grpnme'} ;
							 | 
						|
										print "<tr><td>$group_name</td>" ;
							 | 
						|
										foreach $mykey (@Labels) {
							 | 
						|
											if ($total) {
							 | 
						|
												# Compute percent
							 | 
						|
												$percent = 100 * $data_grp->{$grp_id}->{'Employee Passion'}->{'ScoreCount'}->{$mykey} / $total ;
							 | 
						|
											} else {
							 | 
						|
												# $total is zero.  Use 0% for all values.
							 | 
						|
												$percent = 0 ;
							 | 
						|
											}
							 | 
						|
											printf "<td align=center>%.1f %</td>", $percent ;
							 | 
						|
										}
							 | 
						|
										print "</tr>\n" ;
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									print "</table>\n";
							 | 
						|
									print "<br><br>\n";
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a bar chart on the Passion index,
							 | 
						|
								# on the Employee Passion Survey (id passion).
							 | 
						|
								# They want bar charts comparing the desire of the 
							 | 
						|
								# employees for a goal, vs. the Organizations ability
							 | 
						|
								# to deliver that goal, and a summary gap number.
							 | 
						|
								sub OldPassionIndexGroups {
							 | 
						|
								  my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
									my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" ,
							 | 
						|
															"Need for Meaning" , "Winning Team" ) ;
							 | 
						|
									my @GoalSuffixes = ("Me" , "Org.") ;
							 | 
						|
									my $data ;
							 | 
						|
								  $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
									# Compute the Summary gap number.
							 | 
						|
									# It is the average of the gaps for each Goal.
							 | 
						|
									my $url;
							 | 
						|
									my $Gap = 0 ;
							 | 
						|
									my $goal ;
							 | 
						|
								  foreach $goal (@Goals) {
							 | 
						|
										my $pigoal = $goal . " " . $GoalSuffixes[0] ;
							 | 
						|
										my $wpgoal = $goal . " " . $GoalSuffixes[1] ;
							 | 
						|
										my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
										my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
										my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
										my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
										my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
										my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
										my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
										my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
										my $diff = $pinum - $wpnum;
							 | 
						|
										$Gap += $diff ;
							 | 
						|
								    }
							 | 
						|
								  print HTMLHeaderPlain("Section 2 - Values That Build Passion");
							 | 
						|
								  print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Employee Passion Survey<br>Section 2 - Values That Build Passion</b></font><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Passion and the degree to <br>which the $xlatphrase[797] operates by these Values</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    $timestamp;
							 | 
						|
								    printf "<table border><tr><td>Your Trust Values Gap Score is %.1f",$Gap ;
							 | 
						|
								    print "</td></tr></table>\n";
							 | 
						|
								    print "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">The graphs below show the Personal Importance and Perceptions of Work Passion".
							 | 
						|
									" for each of the values.</font>";
							 | 
						|
								    print "<tr><td> </td><th>Gap</th></tr>\n";
							 | 
						|
								    my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Passion:Work%20Passion".
							 | 
						|
									"&xdim=500&ydim=60&hbar=1&ymax=11&ymin=0&yticknum=11";
							 | 
						|
										my $goal ;
							 | 
						|
								    foreach $goal (@Goals) {
							 | 
						|
											my $url;
							 | 
						|
											my $pigoal = $goal . " " . $GoalSuffixes[0] ;
							 | 
						|
											my $wpgoal = $goal . " " . $GoalSuffixes[1] ;
							 | 
						|
											my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
											my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
											my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											$diff = sprintf("%1.1f", $diff);
							 | 
						|
											$url = $baseurl."&values=".$pinum.":";
							 | 
						|
											$url = $url."&values2=:".$wpnum;
							 | 
						|
											print "<tr><th colspan=\"3\" align=\"left\">$goal</th></tr>\n";
							 | 
						|
											print "<tr><td><img src=\"$url\"></td><td align=\"center\">$diff</td></tr>\n";
							 | 
						|
								    }
							 | 
						|
								    print "<tr><th>Total Trust Values Gap</th>";
							 | 
						|
								    printf "<td align=center>%.1f</td>", $Gap;
							 | 
						|
								    # print "<td align=center>13.8</td>\n" ;  # International Average
							 | 
						|
										print "</tr>\n";
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a summary of the Passion index,
							 | 
						|
								# on the Employee Passion Survey (id passion).
							 | 
						|
								sub PassionIndexSummary {
							 | 
						|
								  my ($timestamp) = @_;
							 | 
						|
									my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" ,
							 | 
						|
															"Need for Meaning" , "Winning Team" ) ;
							 | 
						|
								  my @GoalPrefixes = ("Man", "Org") ;
							 | 
						|
									my @GoalSuffixes = ("Me" , "Org.") ;
							 | 
						|
								
							 | 
						|
									# Get Groups Data
							 | 
						|
								  my $grp_data = getGroups($CLIENT{'clid'}) ;
							 | 
						|
								  my %id_grp = () ; # Hash of candidate ids, and groups.
							 | 
						|
								  foreach my $grp_id (sort keys %{$grp_data}) {
							 | 
						|
								    my $can_ids = $grp_data->{$grp_id}->{'grplist'} ;
							 | 
						|
								    foreach my $id (@$can_ids) {
							 | 
						|
								      if ($id_grp{$id}) {
							 | 
						|
								        # Candidate id already has a group id.
							 | 
						|
								        warn "Candidate id $id is in two groups $id_grp{$id} and $grp_id" ;
							 | 
						|
								      } else {
							 | 
						|
								        # Candidate id can be assigned.
							 | 
						|
								        $id_grp{$id} = $grp_id ;
							 | 
						|
								      }
							 | 
						|
								    }
							 | 
						|
								  }
							 | 
						|
								
							 | 
						|
								  my ($data, $data_grp) = &GetLikertGrpData($CLIENT{'clid'},$TEST{'id'}, \%id_grp);
							 | 
						|
									my $goal ; my $Gap = 0 ; my $pre_goal ; my %Summ= () ;
							 | 
						|
								  my $TotalImp = 0 ; my $TotalSat = 0 ; my $TotalGap = 0 ;
							 | 
						|
								  my $ImpAvail = 0 ; my $SatAvail = 0 ;
							 | 
						|
								  my $ImpScore = 0 ; my $SatScore = 0 ;
							 | 
						|
									my $piaver ;
							 | 
						|
									my $pinum ;
							 | 
						|
									my $wpaver ;
							 | 
						|
									my $wpnum ;
							 | 
						|
									foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
								  	foreach $goal (@Goals) {
							 | 
						|
								  		$ImpAvail = 0 ; $SatAvail = 0 ;
							 | 
						|
								  		$ImpScore = 0 ; $SatScore = 0 ;
							 | 
						|
											my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
											my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
											$ImpAvail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											$ImpScore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											$SatAvail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											$SatScore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											$piaver = $ImpAvail ? ($ImpScore/$ImpAvail) : 0 ;
							 | 
						|
											$pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											$wpaver = $SatAvail ? ($SatScore/$SatAvail) : 0 ;
							 | 
						|
											$wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											$Gap = $pinum - $wpnum;
							 | 
						|
											$TotalImp += $pinum ;
							 | 
						|
											$TotalSat += $wpnum ;
							 | 
						|
											$TotalGap += $Gap ;
							 | 
						|
											# warn "SUMM pigoal $pigoal wpgoal $wpgoal $TotalImpAvail $TotalImpScore $TotalSatAvail $TotalSatScore" ;
							 | 
						|
								  	}
							 | 
						|
									}
							 | 
						|
									# $piaver = $TotalImpAvail ? ($TotalImpScore/$TotalImpAvail) : 0 ;
							 | 
						|
									# $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
									# $wpaver = $TotalSatAvail ? ($TotalSatScore/$TotalSatAvail) : 0 ;
							 | 
						|
									# $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
									# $Gap = $pinum - $wpnum;
							 | 
						|
								
							 | 
						|
								  print HTMLHeaderPlain("Section 2 - The Passion Index Summary");
							 | 
						|
								  print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 2 - The Passion Index Summary</b></font><br><br><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Needs and the degree to which the Needs are being satisfied</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  # } elsif (defined $idlist) {
							 | 
						|
										# my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										# print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    # .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								  # } else {
							 | 
						|
										# print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								  }
							 | 
						|
								  $timestamp;
							 | 
						|
									print "<br><br><br>\n" ;
							 | 
						|
									print "<table border>" ;
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<th> </th>" ;
							 | 
						|
									print "<th><b>Total Importance</b></th>" ;
							 | 
						|
									print "<th><b>Total Satisfaction</b></th>" ;
							 | 
						|
									print "<th><b>Passion Gap</b></th>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>Overall</td>" ;
							 | 
						|
									printf "<td align=\"center\">%.1f</td>", $TotalImp ;
							 | 
						|
									printf "<td align=\"center\">%.1f</td>", $TotalSat ;
							 | 
						|
									printf "<td align=\"center\">%.1f</td>", $TotalGap ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td><b>Group Breakdown</b></td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>Group</td>" ;
							 | 
						|
									print "<td><b>Total Importance</b></td>" ;
							 | 
						|
									print "<td><b>Total Satisfaction</b></td>" ;
							 | 
						|
									print "<td><b>Passion Gap</b></td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									my ($pigoal, $wpgoal) ;
							 | 
						|
								  foreach my $grp_id (sort keys %{$grp_data}) {
							 | 
						|
								    # Get the total for the group.
							 | 
						|
								    my $group_name = $grp_data->{$grp_id}->{'grpnme'} ;
							 | 
						|
										$TotalImp = 0 ; $TotalSat = 0 ;
							 | 
						|
										$TotalGap = 0 ; 
							 | 
						|
										foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
											foreach $goal (@Goals) {
							 | 
						|
												$pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
												$wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
								      $ImpAvail = $data_grp->{$grp_id}->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
								      $ImpScore = $data_grp->{$grp_id}->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
								      $SatAvail = $data_grp->{$grp_id}->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
								      $SatScore = $data_grp->{$grp_id}->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
								      $piaver = $ImpAvail ? ($ImpScore/$ImpAvail) : 0 ;
							 | 
						|
								      $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
								      $wpaver = $SatAvail ? ($SatScore/$SatAvail) : 0 ;
							 | 
						|
								      $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
								      $Gap = $pinum - $wpnum;
							 | 
						|
								      $TotalImp += $pinum ;
							 | 
						|
								      $TotalSat += $wpnum ;
							 | 
						|
								      $TotalGap += $Gap ;
							 | 
						|
											# $TotalImpAvail += $data_grp->{$grp_id}->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											# $TotalImpScore += $data_grp->{$grp_id}->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											# $TotalSatAvail += $data_grp->{$grp_id}->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											# $TotalSatScore += $data_grp->{$grp_id}->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
										# $piaver = $TotalImpAvail ? ($TotalImpScore/$TotalImpAvail) : 0 ;
							 | 
						|
								  	# $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
								  	# $wpaver = $TotalSatAvail ? ($TotalSatScore/$TotalSatAvail) : 0 ;
							 | 
						|
								  	# $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
								  	# $Gap = $pinum - $wpnum;
							 | 
						|
								
							 | 
						|
								    print "<tr>" ;
							 | 
						|
								  	print "<td>$group_name</td>" ;
							 | 
						|
								  	printf "<td align=\"center\">%.1f</td>", $TotalImp ;
							 | 
						|
								  	printf "<td align=\"center\">%.1f</td>", $TotalSat ;
							 | 
						|
								  	printf "<td align=\"center\">%.1f</td>", $TotalGap ;
							 | 
						|
								  	print "</tr>\n" ;
							 | 
						|
								
							 | 
						|
								  }
							 | 
						|
								  print "</table>\n" ;
							 | 
						|
								
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub CommEffectSummary {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = &CommEffectData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    my @cols = ("Purpose","Values","Vision","Goals","Procedures","Roles");
							 | 
						|
								    $groups = getGroups($CLIENT{'clid'});
							 | 
						|
								    print HTMLHeaderPlain("Section 4 - Group Alignment Summary");
							 | 
						|
								    print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Strategic Alignment Survey<br>Section 4 - Group Alignment Summary</i></b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The Degree to which Group Members are in Alignment</b></font><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    print $timestamp;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<tr>\n<th> </th>\n";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
									print "<th colspan=2>$col</th>";
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "<tr>\n<td> </td>\n";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
								    	print "<td align=center><font size=-1><b>Clarity</b></font></td><td><font size=-1><b>Approval</b></font></td>";
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "<tr><td>Overall</td>";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
								    	printf "<td align=center>%.1f %%</td>", $data->{'organization'}->{'claritysum'}->{$col}->{'value'};
							 | 
						|
								    	printf "<td align=center>%.1f %%</td>", $data->{'organization'}->{'approvalsum'}->{$col}->{'value'};
							 | 
						|
								    }
							 | 
						|
								    if (exists $data->{'groups'}) {
							 | 
						|
									print "<tr><th colspan=13 align=\"left\">Group Breakdown</th></tr>\n";
							 | 
						|
									print "<tr><th>Group</th>";
							 | 
						|
									foreach my $col (@cols) {
							 | 
						|
									    print "<th colspan=2>$col</th>";
							 | 
						|
								    	}
							 | 
						|
									print "</tr>\n";
							 | 
						|
									foreach my $grp (sort keys %{$data->{'groups'}}) {
							 | 
						|
									    print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
							 | 
						|
									    foreach my $col (@cols) {
							 | 
						|
									        printf "<td align=center>%.1f %%</td>", $data->{'groups'}->{$grp}->{'claritysum'}->{$col}->{'value'};
							 | 
						|
									        printf "<td align=center>%.1f %%</td>", $data->{'groups'}->{$grp}->{'approvalsum'}->{$col}->{'value'};
							 | 
						|
								    	    }
							 | 
						|
									    print "</tr>\n";
							 | 
						|
									}
							 | 
						|
								    }
							 | 
						|
								    print "<tr>\n<td rowspan=2><b>International<br>Average</b></td>\n";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
									print "<th colspan=2>$col</th>";
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "<tr>";
							 | 
						|
								    print "<td align=center>86%</td>";
							 | 
						|
								    print "<td align=center>88%</td>";
							 | 
						|
								    print "<td align=center>77%</td>";
							 | 
						|
								    print "<td align=center>86%</td>";
							 | 
						|
								    print "<td align=center>72%</td>";
							 | 
						|
								    print "<td align=center>78%</td>";
							 | 
						|
								    print "<td align=center>79%</td>";
							 | 
						|
								    print "<td align=center>85%</td>";
							 | 
						|
								    print "<td align=center>78%</td>";
							 | 
						|
								    print "<td align=center>71%</td>";
							 | 
						|
								    print "<td align=center>84%</td>";
							 | 
						|
								    print "<td align=center>70%</td>";
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub TrustLevelReport {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    my $histograms = $data->{'organization'}->{'histogram'};
							 | 
						|
								    my $trust = $data->{'organization'}->{'trust'};
							 | 
						|
								    print HTMLHeaderPlain("Section 2 - Group Trust Level Report");
							 | 
						|
								    print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Strategic Alignment Survey<br>Section 2 - Group Trust Level Report</b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>$xlatphrase[801]</b></font><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    print $timestamp;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border><tr><th> </th><th> </th><th>Group Trust Level</th><th>Int'l Average</th></tr>\n";
							 | 
						|
								    my $baseurl = "/cgi-bin/bargraph.pl?labels=Low::::Medium::::High&title=Trust%20Level&ylabel=Respondents";
							 | 
						|
								    $baseurl .= "&xdim=400&ydim=100";
							 | 
						|
								    my %intl;
							 | 
						|
								    $intl{'Congruence'} = "66";
							 | 
						|
								    $intl{'Openness'} = "69";
							 | 
						|
								    $intl{'Acceptance'} = "73";
							 | 
						|
								    $intl{'Reliability'} = "79";
							 | 
						|
								    foreach my $row (qw(Congruence Openness Acceptance Reliability)) {
							 | 
						|
									print "<tr><th>$row</th>";
							 | 
						|
									print "<td><img src=\"$baseurl&values=".join(":",@{$histograms->{$row}})."\"></td>";
							 | 
						|
									printf "<td align=\"center\">%.1f%% </td>\n", $trust->{$row}->{'value'};
							 | 
						|
									printf "<td align=\"center\">%.1f%% </td></tr>\n", $intl{$row};
							 | 
						|
								    }
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    #printf "<P><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>Overall Group Trust Level</b></font> = %.1f %%.</p>\n",$data->{'organization'}->{'overalltrust'};
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub TrustLevelSummary {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    my @cols = ("Congruence","Openness","Acceptance","Reliability");
							 | 
						|
								    $groups = getGroups($CLIENT{'clid'});
							 | 
						|
								    print HTMLHeaderPlain("Section 2 - Group Trust Level Summary");
							 | 
						|
								    print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Strategic Alignment Survey<br>Section 2 - Group Trust Level Summary</b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>$xlatphrase[801]</b></font><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[800]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    print $timestamp;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<tr><td> </th>";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
									print "<th align=center>$col</th>";
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "<tr><td>Overall</td>";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
								    	printf "<td align=center>%.1f %%</td>", $data->{'organization'}->{'trust'}->{$col}->{'value'};
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    if (exists $data->{'groups'}) {
							 | 
						|
									print "<tr><th colspan=5 align=\"left\">Group Breakdown</th></tr>\n";
							 | 
						|
									print "<tr><th>Group</th>";
							 | 
						|
								        foreach my $col (@cols) {
							 | 
						|
									    print "<th>$col</th>";
							 | 
						|
								        }
							 | 
						|
									print "</tr>\n";
							 | 
						|
									foreach my $grp (sort keys %{$data->{'groups'}}) {
							 | 
						|
									    print "<tr><td align=left>$groups->{$grp}->{'grpnme'}</td>";
							 | 
						|
								            foreach my $col (@cols) {
							 | 
						|
									        printf "<td align=center>%.1f %%</td>", $data->{'groups'}->{$grp}->{'trust'}->{$col}->{'value'};
							 | 
						|
								            }
							 | 
						|
									}
							 | 
						|
									print "</tr>\n";
							 | 
						|
								    }
							 | 
						|
								    print "<tr>\n<td rowspan=2><b>International<br>Average</b></td>\n";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
									print "<th align=center>$col</th>";
							 | 
						|
								    }
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "<tr>";
							 | 
						|
								    print "<td align=center>66%</td>";
							 | 
						|
								    print "<td align=center>69%</td>";
							 | 
						|
								    print "<td align=center>73%</td>";
							 | 
						|
								    print "<td align=center>79%</td>";
							 | 
						|
								    print "</tr>\n";
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub TrustLevelCSV {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = TrustLevelData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    my @cols = ("Congruence","Openness","Acceptance","Reliability");
							 | 
						|
								    $groups = getGroups($CLIENT{'clid'});
							 | 
						|
								    print "Content-Disposition: attachment; filename=TrustLevel.csv\n\n";
							 | 
						|
								    print "Strategic Alignment Survey,Section 2 - Group Trust Level Summary,";
							 | 
						|
								    print "$xlatphrase[801],";
							 | 
						|
								    print "$FORM{'orgname'},";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print $FORM{'uberheader'};
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "Summary for Groups:,"
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})));
							 | 
						|
								    } else {
							 | 
						|
									print "$xlatphrase[798] $xlatphrase[800]";
							 | 
						|
								    }
							 | 
						|
								    print ",".$timestamp."\n";
							 | 
						|
								    print "Group";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
									print ",$col";
							 | 
						|
								    }
							 | 
						|
								    print "\n";
							 | 
						|
								    print "Overall";
							 | 
						|
								    foreach my $col (@cols) {
							 | 
						|
								    	printf ",%.1f %%", $data->{'organization'}->{'trust'}->{$col}->{'value'};
							 | 
						|
								    }
							 | 
						|
								    print "\n";
							 | 
						|
								    if (exists $data->{'groups'}) {
							 | 
						|
									foreach my $grp (sort keys %{$data->{'groups'}}) {
							 | 
						|
									    print "$groups->{$grp}->{'grpnme'}";
							 | 
						|
								            foreach my $col (@cols) {
							 | 
						|
									        printf ",%.1f %%", $data->{'groups'}->{$grp}->{'trust'}->{$col}->{'value'};
							 | 
						|
								            }
							 | 
						|
									    print "\n";
							 | 
						|
									}
							 | 
						|
								    }
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# Aka Gap Analysis
							 | 
						|
								sub ValuesReport {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    print HTMLHeaderPlain("Section 3 - Values That Build Trust");
							 | 
						|
								    print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 3 - Values That Build Trust</b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Expectation and the degree to <br>which the $xlatphrase[797] operates by these Values</b></font><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    $timestamp;
							 | 
						|
								    printf "<table border><tr><td>Your Trust Values Gap Score is %.1f",$data->{'organization'}->{'gap'};
							 | 
						|
								    #print "<br>World Class Standard ?<br>International Benchmark ?<br>";
							 | 
						|
								    print "</td></tr></table>\n";
							 | 
						|
								    print "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">The graphs below show the Personal Importance and Perceptions of Work Performance".
							 | 
						|
									" for each of the eight values.</font>";
							 | 
						|
								    print "<tr><td> </td><th>Gap</th>" ;
							 | 
						|
										# print "<th>Int'l<br>Avg</th>" ;
							 | 
						|
										print "</tr>\n";
							 | 
						|
								    my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Importance:Work%20Performance".
							 | 
						|
									"&xdim=500&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30";
							 | 
						|
								    my %intl;
							 | 
						|
								    $intl{'Straightforwardness'} = "2.0";
							 | 
						|
								    $intl{'Honesty'} = "1.7";
							 | 
						|
								    $intl{'Receptivity'} = "1.6";
							 | 
						|
								    $intl{'Disclosure'} = "1.8";
							 | 
						|
								    $intl{'Respect'} = "1.8";
							 | 
						|
								    $intl{'Recognition'} = "2.2";
							 | 
						|
								    $intl{'Seeks Excellence'} = "1.5";
							 | 
						|
								    $intl{'Keeps Commitments'} = "1.9";
							 | 
						|
								    foreach ('Straightforwardness', 'Honesty', 'Receptivity', 'Disclosure', 'Respect',
							 | 
						|
									     'Recognition', 'Seeks Excellence', 'Keeps Commitments') {
							 | 
						|
											my $url;
							 | 
						|
											my $pinum = (int(10*$data->{'organization'}->{$_}->{'Personal Importance'}+0.5)/10);
							 | 
						|
											my $wpnum = (int(10*$data->{'organization'}->{$_}->{'Work Performance'}+0.5)/10);
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											$diff = sprintf("%1.1f", $diff);
							 | 
						|
											$url = $baseurl."&values=".$pinum.":";
							 | 
						|
											$url = $url."&values2=:".$wpnum;
							 | 
						|
											print "<tr><th colspan=\"3\" align=\"left\">$_</th></tr>\n";
							 | 
						|
											print "<tr><td><img src=\"$url\"></td><td align=\"center\">$diff</td>" ;
							 | 
						|
											# print "<td align=\"center\">$intl{$_}</td>" ;
							 | 
						|
											print "</tr>\n";
							 | 
						|
								    }
							 | 
						|
								    print "<tr><th>Total Trust Values Gap</th>";
							 | 
						|
								    printf "<td align=center>%.1f</td>", $data->{'organization'}->{'gap'};
							 | 
						|
								    # print "<td align=center>13.8</td></tr>\n"; # International Average
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub ValuesSummary {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    $groups = getGroups($CLIENT{'clid'});
							 | 
						|
								    print HTMLHeaderPlain("Section 3 - Values That Build Trust Summary");
							 | 
						|
								    print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Section 3 - Values That Build Trust Summary</b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Expectation and the degree to <br>which the $xlatphrase[797] operates by these Values</b></font><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Summary for Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    print $timestamp;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<tr><td> </th><th>Total Importance</th><th>Total Performance</th><th>Trust Values Gap</th></tr>\n";
							 | 
						|
								    print "<tr><td>Overall</td>";
							 | 
						|
								    printf "<td align=center>%.1f</td>", $data->{'organization'}->{'Personal Importance'};
							 | 
						|
								    printf "<td align=center>%.1f</td>", $data->{'organization'}->{'Work Performance'};
							 | 
						|
								    printf "<td align=center>%.1f</td></tr>\n", $data->{'organization'}->{'gap'};
							 | 
						|
								    if (exists $data->{'groups'}) {
							 | 
						|
									print "<tr><th colspan=4 align=\"left\">Group Breakdown</th></tr>\n";
							 | 
						|
								        print "<tr><th>Group</th><th>Total Importance</th><th>Total Performance</th><th>Trust Values Gap</th></tr>\n";
							 | 
						|
									foreach my $grp (sort keys %{$data->{'groups'}}) {
							 | 
						|
									    print "<tr><td>$groups->{$grp}->{'grpnme'}</td>";
							 | 
						|
									    printf "<td align=center>%.1f</td>", $data->{'groups'}->{$grp}->{'Personal Importance'};
							 | 
						|
									    printf "<td align=center>%.1f</td>", $data->{'groups'}->{$grp}->{'Work Performance'};
							 | 
						|
									    printf "<td align=center>%.1f</td></tr>\n", $data->{'groups'}->{$grp}->{'gap'};
							 | 
						|
									}
							 | 
						|
								    }
							 | 
						|
								    print "<tr><td> </th><th>Total Importance</th><th>Total Performance</th><th>Trust Values Gap</th></tr>\n";
							 | 
						|
								    # print "<tr><td><b>International Average</b></td>"; # International Average
							 | 
						|
								    # printf "<td align=center>%.1f</td>", 74.6; # International Average
							 | 
						|
								    # printf "<td align=center>%.1f</td>", 60.8; # International Average
							 | 
						|
								    # printf "<td align=center>%.1f</td>\n", 13.8; # International Average
							 | 
						|
								    # print "</tr>\n" ; # International Average
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub ValuesCSV {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
								    my $data = &ValuesData($CLIENT{'clid'},$TEST{'id'},$idlist,$groups);
							 | 
						|
								    $groups = getGroups($CLIENT{'clid'});
							 | 
						|
								    print "Content-Disposition: attachment; filename=ValuesThatBuildTrust.csv\n\n";
							 | 
						|
								    print "Strategic Alignment Survey,Section 3 - Values That Build Trust Summary,";
							 | 
						|
								    print "The gap between Employee Expectation and the degree to which the $xlatphrase[797] operates by these Values,";
							 | 
						|
								    print "$FORM{'orgname'},";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print $FORM{'uberheader'};
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "Summary for Groups:,"
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})));
							 | 
						|
								    } else {
							 | 
						|
									print "$xlatphrase[798] $xlatphrase[799]";
							 | 
						|
								    }
							 | 
						|
								    print ",".$timestamp."\n";
							 | 
						|
								    print "Group,Total Importance,Total Performance,Trust Values Gap\n";
							 | 
						|
								    print "Overall,";
							 | 
						|
								    printf "%.1f,", $data->{'organization'}->{'Personal Importance'};
							 | 
						|
								    printf "%.1f,", $data->{'organization'}->{'Work Performance'};
							 | 
						|
								    printf "%.1f\n", $data->{'organization'}->{'gap'};
							 | 
						|
								    if (exists $data->{'groups'}) {
							 | 
						|
									foreach my $grp (sort keys %{$data->{'groups'}}) {
							 | 
						|
									    print "$groups->{$grp}->{'grpnme'},";
							 | 
						|
									    printf "%.1f,", $data->{'groups'}->{$grp}->{'Personal Importance'};
							 | 
						|
									    printf "%.1f,", $data->{'groups'}->{$grp}->{'Work Performance'};
							 | 
						|
									    printf "%.1f\n", $data->{'groups'}->{$grp}->{'gap'};
							 | 
						|
									}
							 | 
						|
								    }
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub CommentsReport {
							 | 
						|
								  my ($idlist, $timestamp, $bycat)  = @_;
							 | 
						|
								  my @filelist = &get_test_result_files($testcomplete, $CLIENT{'clid'},$TEST{'id'});
							 | 
						|
								  my @comments;
							 | 
						|
								  for (my $i=0; $i<=59; $i++) {$comments[$i] = [];}
							 | 
						|
								  my @questions = map([split(/&/,$_)],&get_question_list($TEST{'id'},$CLIENT{'clid'}));
							 | 
						|
								  foreach (@questions) {$_->[4] =~ s/:::.*$//;}
							 | 
						|
								  foreach (@questions) {$_->[4] =~ s/\;//g ;}
							 | 
						|
								  foreach my $file (@filelist) {
							 | 
						|
										my $user = $file;
							 | 
						|
										$user =~ s/.$TEST{'id'}$//;
							 | 
						|
										$user =~ s/^$CLIENT{'clid'}.//;
							 | 
						|
										if (defined $idlist and not $idlist->{$user}) {
							 | 
						|
									    next;
							 | 
						|
										}
							 | 
						|
										my ($answers,$usercomm) = &get_survey_results( $CLIENT{'clid'}, $user, $TEST{'id'});
							 | 
						|
										# In the test passion, only question 37, allows comments.
							 | 
						|
										for (my $i=37; $i<=37; $i++) {
							 | 
						|
									    if ($usercomm->[$i] == -1) {
							 | 
						|
												$comments[$i] = -1;
							 | 
						|
									    } elsif ($usercomm->[$i]) {
							 | 
						|
												push @{$comments[$i]},$usercomm->[$i];
							 | 
						|
									    }
							 | 
						|
										}
							 | 
						|
										# if ($answers->[59]) { push @{$comments[59]},$answers->[59]; }
							 | 
						|
								  }
							 | 
						|
								    print HTMLHeaderPlain("Comments Report");
							 | 
						|
								    print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Strategic Alignment Survey<br>Comments Report</b></font><br><br>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								    if ($FORM{'uberheader'} ne "") {
							 | 
						|
								        print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								    } elsif (defined $idlist) {
							 | 
						|
									my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
									print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    print $timestamp;
							 | 
						|
								    print "</center>\n";
							 | 
						|
								    # print "<blockquote>\n";
							 | 
						|
								
							 | 
						|
								    my @outary = ();
							 | 
						|
								    for (my $i=37 ; $i <=37 ; $i++) {
							 | 
						|
									if ($comments[$i] == -1) {
							 | 
						|
									    # inactive question
							 | 
						|
									    next;
							 | 
						|
									}
							 | 
						|
									$outary[$i] = "<hr width=\"100%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>\n";
							 | 
						|
									$outary[$i] .= "$questions[$i]->[0] - $questions[$i]->[4]</b><p>\n";
							 | 
						|
									if (@{$comments[$i]}) {
							 | 
						|
									    $outary[$i] .= "<ul>\n";
							 | 
						|
									    foreach (@{$comments[$i]}) {
							 | 
						|
										$outary[$i] .= "<li>$_</li>\n";
							 | 
						|
									    }
							 | 
						|
									    $outary[$i] .= "</ul>\n";
							 | 
						|
									} else {
							 | 
						|
									    $outary[$i] .= "<ul><li><small><i>No Comments</i></small></li></ul>\n";
							 | 
						|
									}
							 | 
						|
									$outary[$i] .= "</font>\n";
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    # Read in .rgo file which defines question presentation order
							 | 
						|
								    my $out;
							 | 
						|
								    my $lookupfile = join($pathsep,$dataroot,"IntegroSAS.rgo");
							 | 
						|
								    if ($bycat && -e $lookupfile) {
							 | 
						|
									my $fh = new FileHandle;
							 | 
						|
									if ($fh->open($lookupfile)) {
							 | 
						|
										$out = "";
							 | 
						|
										my @lines = <$fh>;
							 | 
						|
										$fh->close();
							 | 
						|
										shift @lines;
							 | 
						|
										foreach (@lines) {
							 | 
						|
											chomp;
							 | 
						|
											my @line = split(/\&/,$_);
							 | 
						|
											my $section = shift @line;
							 | 
						|
											if ($section ne "") {
							 | 
						|
												$out .= "<tr><td colspan=6><hr width=\"100\%\"></td></tr>\n";
							 | 
						|
												$out .= "<tr><td colspan=6><font size=+1><b>$section</b></font></td></tr>\n";
							 | 
						|
											}
							 | 
						|
											foreach my $sub (@line) {
							 | 
						|
												my ($subheader, $quess) = split(/:/,$sub);
							 | 
						|
												if ($subheader ne "") {
							 | 
						|
													$out .= "<hr width=100%><tr><td colspan=6><b>$subheader:</b></td></tr>\n";
							 | 
						|
												}
							 | 
						|
												my @ques = split(/\,/,$quess);
							 | 
						|
												foreach my $quesid (@ques) {
							 | 
						|
													$out .= $outary[$quesid] ;
							 | 
						|
												}
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
										print $out;
							 | 
						|
									}
							 | 
						|
								    } else {
							 | 
						|
									for (1 .. $#outary) {
							 | 
						|
										print $outary[$_];
							 | 
						|
									}
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    print "<hr width=\"100%\">\n";
							 | 
						|
								    # print "</blockquote>\n";
							 | 
						|
								    #print "<pre>".Dumper(\@questions,\@comments)."</pre>\n";
							 | 
						|
								    print "<center>".HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub print_test_chooser {
							 | 
						|
									my @trecs = @_;
							 | 
						|
									my ($testscompleted, $testsinprogress, $testspending, $href, $tstoption, $tstoptions);
							 | 
						|
									my $js = "function setTest(oform,test) {\n\t".
							 | 
						|
										"oform.tstid.value=test;\n\t".
							 | 
						|
										"oform.submit();\n};\n";
							 | 
						|
									for (0 .. $#trecs) {
							 | 
						|
										my ($desc,$id) = split(/&/, $trecs[$_]);
							 | 
						|
										$testscompleted = CountTestFiles($testcomplete,$CLIENT{'clid'},$id);
							 | 
						|
										$testsinprogress = CountTestFiles($testinprog, $CLIENT{'clid'},$id);
							 | 
						|
										$testspending = CountTestFiles($testpending, $CLIENT{'clid'},$id);
							 | 
						|
										$href="javascript:setTest(document.testform1,\'$id\')\;";
							 | 
						|
										$tstoption ="	<TR>
							 | 
						|
										<TD valign=top><FONT SIZE=2><a href=\"$href\">$id</a></FONT></TD>
							 | 
						|
										<TD valign=top><FONT SIZE=2>$desc</FONT></TD>
							 | 
						|
										<TD align=right valign=top><FONT SIZE=2>$testscompleted</FONT></TD>
							 | 
						|
										<TD align=right valign=top><FONT SIZE=2>$testsinprogress</FONT></TD>
							 | 
						|
										<TD align=right valign=top><FONT SIZE=2>$testspending</FONT></TD>
							 | 
						|
									</TR>\n";
							 | 
						|
										$tstoptions = join('', $tstoptions, $tstoption); 
							 | 
						|
									}
							 | 
						|
									print HTMLHeader("Integro Learning Custom Reports", $js);
							 | 
						|
									print "<CENTER><B>Please choose the survey for which you would like reports:</B><br>
							 | 
						|
									<form name=\"testform1\" action=\"/cgi-bin/creports.pl\" method=\"Post\">
							 | 
						|
									<input type=\"hidden\" name=\"tid\" value=\"$SESSION{'tid'}\">
							 | 
						|
									<input type=\"hidden\" name=\"tstid\" value=\"\">
							 | 
						|
									<input type=hidden name=\"rptno\" value=\"$FORM{'rptno'}\">
							 | 
						|
									</form>
							 | 
						|
								<TABLE cellpadding=1 cellspacing=1 border=0 width=\"100\%\">
							 | 
						|
									<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
							 | 
						|
									<TR>
							 | 
						|
										<TD valign=top><B><FONT SIZE=1>Test ID</FONT></B></TD>
							 | 
						|
										<TD valign=top><B><FONT SIZE=1>Description</FONT></B></TD>
							 | 
						|
										<TD align=right valign=top><B><FONT SIZE=1>Cmp</FONT></B></TD>
							 | 
						|
										<TD align=right valign=top><B><FONT SIZE=1>InP</FONT></B></TD>
							 | 
						|
										<TD align=right valign=top><B><FONT SIZE=1>Pnd</FONT></B></TD>
							 | 
						|
									</TR>
							 | 
						|
									<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
							 | 
						|
									$tstoptions
							 | 
						|
									<TR><TD colspan=5><HR WIDTH=\"100\%\"></TD></TR>
							 | 
						|
								</TABLE>
							 | 
						|
								";
							 | 
						|
									print HTMLFooter();
							 | 
						|
									exit();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								sub TwoBarCharts {
							 | 
						|
								# TwoBarCharts prints the table rows for the Employee
							 | 
						|
								#  Importance, and Satisfaction of part of the Passion
							 | 
						|
								#  Index Report.
							 | 
						|
								# Parms
							 | 
						|
								# $data - Ref to a hash with all of the data.
							 | 
						|
								# $pigoal - String for the Importance Super Category (Likert Scale question)
							 | 
						|
								# $wpgoal - String for the Satisfaction Super Category (Likert Scale question)
							 | 
						|
								# $IntlAver - Optional numeric value for international average.
							 | 
						|
									my $data = @_[0] ;
							 | 
						|
									my $pigoal = @_[1] ;
							 | 
						|
									my $wpgoal = @_[2] ;
							 | 
						|
									my $IntlAver = @_[3] ;
							 | 
						|
									my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
									my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
									my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
									my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
									# warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ;
							 | 
						|
									my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
									my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
									my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
									my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
									# warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ;
							 | 
						|
									my $diff = $pinum - $wpnum;
							 | 
						|
									# warn "diff $diff X" ;
							 | 
						|
									$diff = sprintf("%1.1f", $diff);
							 | 
						|
									#  $IntlAver = sprintf("%1.1f", $IntlAver);
							 | 
						|
									my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal Importance:Workplace Satisfaction" .
							 | 
						|
												"&colours=orange:blue" .
							 | 
						|
												"&xdim=600&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30" ;
							 | 
						|
									my $url = $baseurl."&values=".$pinum.":";
							 | 
						|
									$url = $url."&values2=:".$wpnum;
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td align=\"right\">" ;
							 | 
						|
									print "<img src=\"$url\">" ;
							 | 
						|
									print "</td>" ;
							 | 
						|
									print "<td align=\"center\">$diff</td>" ;
							 | 
						|
									# print "<td align=\"center\">$IntlAver</td>" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a bar chart on the Passion index,
							 | 
						|
								# on the Employee Passion Survey (id passion).
							 | 
						|
								# They want bar charts comparing the desire of the 
							 | 
						|
								# employees for a goal, vs. the Organizations ability
							 | 
						|
								# to deliver that goal, and a summary gap number.
							 | 
						|
								sub PassionIndexGroups {
							 | 
						|
								  my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
									my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" ,
							 | 
						|
															"Need for Meaning" , "Winning Team" ) ;
							 | 
						|
									# The Goals are the general passion ignitors.
							 | 
						|
									my @GoalSuffixes = ("Me" , "Org.") ;
							 | 
						|
									# The suffix is "Me" for its importance to the Candidate.
							 | 
						|
									# The suffix is "Org." for its delivery by the company.
							 | 
						|
								  my @GoalPrefixes = ("Man", "Org") ;
							 | 
						|
									# The prefix is "Man" for the manager's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the Candidate.
							 | 
						|
									# The prefix is "Org" for the organization's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the other employees.
							 | 
						|
								
							 | 
						|
									my $data ;
							 | 
						|
								  $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
									# Compute the Summary gap number.
							 | 
						|
									# It is the average of the gaps for each Goal.
							 | 
						|
									my $url;
							 | 
						|
									my $Gap = 0 ;
							 | 
						|
									my $goal ; my $gen_goal ; my $pre_goal ;
							 | 
						|
									foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
								  	foreach $goal (@Goals) {
							 | 
						|
											my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
											my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
											my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
											my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											# warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ;
							 | 
						|
											my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
											my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											# warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ;
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											# warn "diff $diff X" ;
							 | 
						|
											$Gap += $diff ;
							 | 
						|
								    }
							 | 
						|
									}
							 | 
						|
								
							 | 
						|
									my $style_with_page = "" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "P.breakhere { page-break-before: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "div { page-break-before: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "pageit { page-break-after: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
								# The following is an enheritable class.
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= ".break_after { page-break-after: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
								  print HTMLHeaderPlain("Section 2 - The Passion Index", 
							 | 
						|
										"", $style_with_page );
							 | 
						|
									# print "<pageit>\n" ;
							 | 
						|
								  print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\">" ;
							 | 
						|
									print "<b>Section 2 - The Passion Index</b></font><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\">" ;
							 | 
						|
									print "<b>Employee Needs That Ignite Passion" ;
							 | 
						|
									print "</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								  $timestamp;
							 | 
						|
								  # printf "<table border><tr><td>Your Employee Passion Gap Score is %.1f",$Gap ;
							 | 
						|
								  # print "</td></tr></table>\n";
							 | 
						|
								  print "<br><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" ;
							 | 
						|
									print "The graphs below show employees' perceptions of the importance of these needs " ;
							 | 
						|
									print "and the level of \"satisfaction\" being experienced.\n" ;
							 | 
						|
									print "</font>";
							 | 
						|
								  print "<tr><td> </td><th>Gap</th>" ;
							 | 
						|
									# print "<th>Intl</th>" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>1. <font color=#3333FF><b>The Need To Be Respected</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>1a. My immediate manager or supervisor trusts me and treats me with respect.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need to be Respected Me", "Man Need to be Respected Org.") ;
							 | 
						|
									print "<td>1b. My organization's policies and practices regarding compensation, work/life balance, and valuing diversity demonstrate respect for all employees.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need to be Respected Me", "Org Need to be Respected Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>2. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Learn and Grow</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>2a. I have the opportunity to increase my knowledge and develop new skills in my job.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Learn and Grow Me", "Man Learn and Grow Org.") ;
							 | 
						|
									print "<td>2b. My organization invests in developing the potential of all employees.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Learn and Grow Me", "Org Learn and Grow Org.") ;
							 | 
						|
								
							 | 
						|
								# Close the table, set up a page break for printing, and restart the table.
							 | 
						|
								  # print "</table>\n";
							 | 
						|
									# Works for Firefox 8 on Linux, but not IE.
							 | 
						|
									# print "<div style=\"page-break-after: always\"></div>\n" ;
							 | 
						|
									# print "<div style=\"page-break-before: always\">\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-after:always\"></p>\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-after: always\"></p>\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-before: always\"></p>\n" ;
							 | 
						|
									# print "<P CLASS=\"breakhere\"> </p>\n" ;
							 | 
						|
									# print "<p style=\"page-break-after: always\">\n" ;
							 | 
						|
									# print "<!–[if IE 4]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									# print "<!–[if IE 5]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									# print "<!–[if IE 6]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									# print "<!–[if IE 7]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									# print "<!–[if IE 8]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									# print "</p>" ;
							 | 
						|
									# print "</pageit>\n" ;
							 | 
						|
									# print "<pageit>\n" ;
							 | 
						|
								  # print "<table border>\n" ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>3. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Be an Insider</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>3a. My immediate manager or supervisor values my contribution and cares about my well-being.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need to be an Insider Me", "Man Need to be an Insider Org.") ;
							 | 
						|
									print "<td>3b. My organization is open with employees about information and organizational performance to help us understand the decisions that are being made.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need to be an Insider Me", "Org Need to be an Insider Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>4. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need for Meaning</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>4a. The mission or purpose of my organization makes me feel proud to work here.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need for Meaning Me", "Man Need for Meaning Org.") ;
							 | 
						|
									print "<td>4b. The work I do is meaningful because it helps my organization fulfill our mission.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need for Meaning Me", "Org Need for Meaning Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>5. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Be Part of a Winning Team</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>5a. My team is making a significant contribution to our organization.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Winning Team Me", "Man Winning Team Org.") ;
							 | 
						|
									print "<td>5b. My team is focused on continually improving our performance.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Winning Team Me", "Org Winning Team Org.") ;
							 | 
						|
								
							 | 
						|
								# Closing values.
							 | 
						|
								  print "<tr><th>Total Employee Passion Gap</th>";
							 | 
						|
								  printf "<td align=center>%.1f</td>", $Gap;
							 | 
						|
								  # print "<td align=center>13.8</td>\n" ;  # International Average
							 | 
						|
									print "</tr>\n";
							 | 
						|
								  # print "</table></b></font>\n";
							 | 
						|
								  print "</table>\n";
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a bar chart on the Passion index,
							 | 
						|
								# on the Employee Passion Survey (id passion).
							 | 
						|
								# They want bar charts comparing the desire of the 
							 | 
						|
								# employees for a goal, vs. the Organizations ability
							 | 
						|
								# to deliver that goal, and a summary gap number.
							 | 
						|
								sub NewOldPassionIndexGroups {
							 | 
						|
								  my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
									my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" ,
							 | 
						|
															"Need for Meaning" , "Winning Team" ) ;
							 | 
						|
									# The Goals are the general passion ignitors.
							 | 
						|
									my @GoalSuffixes = ("Me" , "Org.") ;
							 | 
						|
									# The suffix is "Me" for its importance to the Candidate.
							 | 
						|
									# The suffix is "Org." for its delivery by the company.
							 | 
						|
								  my @GoalPrefixes = ("Man", "Org") ;
							 | 
						|
									# The prefix is "Man" for the manager's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the Candidate.
							 | 
						|
									# The prefix is "Org" for the organization's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the other employees.
							 | 
						|
								
							 | 
						|
									my $data ;
							 | 
						|
								  $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
									# Compute the Summary gap number.
							 | 
						|
									# It is the average of the gaps for each Goal.
							 | 
						|
									my $url;
							 | 
						|
									my $Gap = 0 ;
							 | 
						|
									my $goal ; my $gen_goal ; my $pre_goal ;
							 | 
						|
									foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
								  	foreach $goal (@Goals) {
							 | 
						|
											my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
											my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
											my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
											my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											# warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ;
							 | 
						|
											my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
											my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											# warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ;
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											# warn "diff $diff X" ;
							 | 
						|
											$Gap += $diff ;
							 | 
						|
								    }
							 | 
						|
									}
							 | 
						|
								
							 | 
						|
								  print HTMLHeaderPlain("Section 2 - Values That Build Passion");
							 | 
						|
								  print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>Employee Passion Survey<br>Section 2 - Values That Build Passion</b></font><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\"><b>The gap between Employee Passion and the degree to <br>which the $xlatphrase[797] operates by these Values</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								    $timestamp;
							 | 
						|
								    printf "<table border><tr><td>Your Trust Values Gap Score is %.1f",$Gap ;
							 | 
						|
								    print "</td></tr></table>\n";
							 | 
						|
								    print "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">The graphs below show the Personal Importance and Perceptions of Work Passion".
							 | 
						|
									" for each of the values.</font>";
							 | 
						|
								    print "<tr><td> </td><th>Gap</th></tr>\n";
							 | 
						|
								    my $baseurl = "/cgi-bin/bargraph.pl?labels=Personal%20Passion:Work%20Passion".
							 | 
						|
									"&xdim=500&ydim=60&hbar=1&ymax=10&ymin=0&yticknum=10&r_margin=30";
							 | 
						|
										my $localteam ;
							 | 
						|
										my $goal ;
							 | 
						|
										foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
								  	foreach $goal (@Goals) {
							 | 
						|
											my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
											my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
											my $url;
							 | 
						|
											my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
											my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
											my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											$diff = sprintf("%1.1f", $diff);
							 | 
						|
											$url = $baseurl."&values=".$pinum.":";
							 | 
						|
											$url = $url."&values2=:".$wpnum;
							 | 
						|
											$localteam = ($pre_goal eq "Man") ? "Manager" : "Organization" ;
							 | 
						|
											print "<tr><th colspan=\"3\" align=\"left\">$goal $localteam</th></tr>\n";
							 | 
						|
											print "<tr><td><img src=\"$url\"></td><td align=\"center\">$diff</td></tr>\n";
							 | 
						|
								    }
							 | 
						|
										}
							 | 
						|
								    print "<tr><th>Total Trust Values Gap</th>";
							 | 
						|
								    printf "<td align=center>%.1f</td>", $Gap;
							 | 
						|
								    # print "<td align=center>13.8</td>\n" ;  # International Average
							 | 
						|
										print "</tr>\n";
							 | 
						|
								    print "</table></b></font>\n";
							 | 
						|
								    print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The original request was for a pie chart of all
							 | 
						|
								# of the answers on the last question, number 37.  I wrote the survey,
							 | 
						|
								# so question 37 is a Likert Scale question that uses a value of
							 | 
						|
								# "Employee Passion" for its super category.  This function generates the
							 | 
						|
								# report on the Employee Passion super category regardless of the 
							 | 
						|
								# question number.
							 | 
						|
								# This version creates a table with 2 columns and 5 rows.
							 | 
						|
								# One row for each type of enthusiasm.
							 | 
						|
								# one column has the description for a type.
							 | 
						|
								# The second column has a 2-D piechart with colors,
							 | 
						|
								#  and the color is lighter for the described type.
							 | 
						|
								sub PassionPeopleGroups_obsolete {
							 | 
						|
								    my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
										# warn "idlist $idlist .\n" ;
							 | 
						|
										# warn "idlist keys " . join (" ",keys (%$idlist)) . ".\n" ;
							 | 
						|
										# warn "groups $groups .\n" ;
							 | 
						|
										# warn "groups keys " . join (" ",keys (%$groups)) . ".\n" ;
							 | 
						|
										# warn "timestamp $timestamp .\n" ;
							 | 
						|
										# warn "Client $CLIENT{'clid'} .\n" ;
							 | 
						|
										# warn "Test Id $TEST{'id'} .\n" ;
							 | 
						|
										my $data ;
							 | 
						|
								    my $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
										my %Categories = () ; my $resp ;
							 | 
						|
										# Keith said he wanted to ignore the data for non-responding candidates.
							 | 
						|
										# $Categories{'NoResponse'} = $$data{'Employee Passion'}->{'NoResponses'} ;
							 | 
						|
										my $mystery = $data->{'Employee Passion'}->{'ScoreCount'} ; # Should be a reference to a hash.
							 | 
						|
										# warn "Mystery Keys " . join(" ", keys %$mystery) . " . " ;
							 | 
						|
										foreach $resp ( keys %$mystery ) {
							 | 
						|
											# each response score.
							 | 
						|
											$Categories{$resp} = $data->{'Employee Passion'}->{'ScoreCount'}->{$resp} ;
							 | 
						|
										}
							 | 
						|
								    print HTMLHeaderPlain("Section 1 - Employee Passion");
							 | 
						|
								    print "<Center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\"><b>" ;
							 | 
						|
										print "Section 1 - Employee Passion Report<br></font>" ;
							 | 
						|
										print "<font size=\"4\">The percentage of employees at each level of Passion</b></font><br><br>\n";
							 | 
						|
								    print "</font></b>\n" ;
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								  } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								  }
							 | 
						|
								
							 | 
						|
								    print "<table>";
							 | 
						|
									my (@values , @Labels , $url, $mykey, @scores, $total) ;
							 | 
						|
									$total = 0 ;
							 | 
						|
									@Labels = sort keys %Categories ;
							 | 
						|
									foreach $mykey (@Labels) {
							 | 
						|
										push @scores,$Categories{$mykey} ;
							 | 
						|
										$total += $Categories{$mykey} ;
							 | 
						|
									}
							 | 
						|
									if ($total) {
							 | 
						|
										@values = map ((100 * $_ / $total),@scores ) ;
							 | 
						|
									} else {
							 | 
						|
										# $total is zero. (Do not divide by zero.)
							 | 
						|
										@values = @scores ;
							 | 
						|
									}
							 | 
						|
									$url = "/cgi-bin/piechart4.pl?values=" .
							 | 
						|
									    join(':',map(int($_+0.5),grepa(\@values,\@values))) .
							 | 
						|
									    "&labels=" . 
							 | 
						|
											"&xdim=150&ydim=150&nolegend=1¬3d=1" ;
							 | 
						|
									    # "&labels=" . join(":",@Labels) .
							 | 
						|
											# "&xdim=200&ydim=100&nolegend=1" ;
							 | 
						|
									# I just need to add the colors to each graph.
							 | 
						|
									# The selected colors are "lred", "lorange", "lyellow", "lgreen", "lblue"
							 | 
						|
									# The deselected colors are "dred", "dbrown", "dyellow", "dgreen", "dblue"
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 5 - Passionate about the job and the organization:</b>\n" ;
							 | 
						|
									print " Employees at level 5 are passionate about the work and the organization they work for.\n";
							 | 
						|
									print " They feel valued and respected and know that what they do makes a real difference." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the pie chart.
							 | 
						|
									print "<td>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									# print join(":", grepa(\@values, ["red", "white", "white", "white", "white"])) ;
							 | 
						|
									print join(":", grepa(\@values, ["lred", "dbrown", "dyellow", "dgreen", "dblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "</td></tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 4 - Passionate only about the job:</b>\n" ;
							 | 
						|
									print " Level 4 employees are passionate about their work " ;
							 | 
						|
									print "and get great satisfaction from knowing they make a difference.\n";
							 | 
						|
									print " However they feel somewhat disengaged from the organization - " ;
							 | 
						|
									print "they don't feel their contribution is valued." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the pie chart.
							 | 
						|
									print "<td>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									# print join(":", grepa(\@values, ["white", "orange", "white", "white", "white"])) ;
							 | 
						|
									print join(":", grepa(\@values, ["dred", "lorange", "dyellow", "dgreen", "dblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "</td></tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 3 - Passionate only about the organization:</b>\n" ;
							 | 
						|
									print " Employees at this level are passionate about the organization " ;
							 | 
						|
									print "and believe it delivers real value.\n " ;
							 | 
						|
									print " But they find their work unrewarding - it's just a job." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the pie chart.
							 | 
						|
									print "<td>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									# print join(":", grepa(\@values, ["white", "white", "yellow", "white", "white"])) ;
							 | 
						|
									print join(":", grepa(\@values, ["dred", "dbrown", "lyellow", "dgreen", "dblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "</td></tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 2 - Not Passionate, but still conscientious:</b>\n" ;
							 | 
						|
									print " Employees at level 2 are not passionate about the work " ;
							 | 
						|
									print "they do, but are still conscientious about doing a good job. " ;
							 | 
						|
									print "However they feel disconnected from the organization " ;
							 | 
						|
									print "and what it stands for." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the pie chart.
							 | 
						|
									print "<td>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									# print join(":", grepa(\@values, ["white", "white", "white", "green", "white"])) ;
							 | 
						|
									print join(":", grepa(\@values, ["dred", "dbrown", "dyellow", "lgreen", "dblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "</td></tr>\n";
							 | 
						|
									# Start a row.
							 | 
						|
									print "<tr>\n";
							 | 
						|
									# Do the Description.
							 | 
						|
									print "<td><b>Level 1 - Disconnected from the job and the organization:</b>\n" ;
							 | 
						|
									print " Level 1 employees feel really disconnected from both the work they do " ;
							 | 
						|
									print "and the organization.  If they could find another job, " ;
							 | 
						|
									print "would take it." ;
							 | 
						|
								  print "</td>\n" ;
							 | 
						|
									# Do the pie chart.
							 | 
						|
									print "<td>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									# print join(":", grepa(\@values, ["white", "white", "white", "white", "blue"])) ;
							 | 
						|
									print join(":", grepa(\@values, ["dred", "dbrown", "dyellow", "dgreen", "lblue"])) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "</td></tr>\n";
							 | 
						|
									# Finish the Table and the page.
							 | 
						|
									print "</table>\n";
							 | 
						|
									print "<br><br>\n";
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								# The request is for a bar chart on the Passion index,
							 | 
						|
								# on the Employee Passion Survey (id passion).
							 | 
						|
								# This was an attempt to use a different style chart 
							 | 
						|
								#   to get the data displayed on one page.
							 | 
						|
								#   It was abandoned.
							 | 
						|
								sub PassionVertGroups {
							 | 
						|
								  my ($idlist,$groups,$timestamp) = @_;
							 | 
						|
									my @Goals = ("Need to be Respected" , "Learn and Grow" , "Need to be an Insider" ,
							 | 
						|
															"Need for Meaning" , "Winning Team" ) ;
							 | 
						|
									# The Goals are the general passion ignitors.
							 | 
						|
									my @GoalSuffixes = ("Me" , "Org.") ;
							 | 
						|
									# The suffix is "Me" for its importance to the Candidate.
							 | 
						|
									# The suffix is "Org." for its delivery by the company.
							 | 
						|
								  my @GoalPrefixes = ("Man", "Org") ;
							 | 
						|
									# The prefix is "Man" for the manager's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the Candidate.
							 | 
						|
									# The prefix is "Org" for the organization's delivery of the ignitor,
							 | 
						|
									#		or the delivery to the other employees.
							 | 
						|
								
							 | 
						|
									my $data ;
							 | 
						|
								  $data = &GetLikertData($CLIENT{'clid'},$TEST{'id'},$idlist);
							 | 
						|
									# Compute the Summary gap number.
							 | 
						|
									# It is the average of the gaps for each Goal.
							 | 
						|
									my $url;
							 | 
						|
									my $Gap = 0 ;
							 | 
						|
									my $goal ; my $gen_goal ; my $pre_goal ;
							 | 
						|
									foreach $pre_goal(@GoalPrefixes) {
							 | 
						|
								  	foreach $goal (@Goals) {
							 | 
						|
											my $pigoal = join(" ", $pre_goal, $goal, $GoalSuffixes[0]) ;
							 | 
						|
											my $wpgoal = join(" ", $pre_goal, $goal, $GoalSuffixes[1]) ;
							 | 
						|
											my $piavail = $data->{$pigoal}->{'PointsAvail'} ;
							 | 
						|
											my $piscore = $data->{$pigoal}->{'PointsEarned'} ;
							 | 
						|
											my $piaver = $piavail ? ($piscore/$piavail) : 0 ;
							 | 
						|
											my $pinum = (int(100*$piaver + 0.5))/10 ;
							 | 
						|
											# warn "pigoal $pigoal piavail $piavail piscore $piscore piaver $piaver pinum $pinum X" ;
							 | 
						|
											my $wpavail = $data->{$wpgoal}->{'PointsAvail'} ;
							 | 
						|
											my $wpscore = $data->{$wpgoal}->{'PointsEarned'} ;
							 | 
						|
											my $wpaver = $wpavail ? ($wpscore/$wpavail) : 0 ;
							 | 
						|
											my $wpnum = (int(100*$wpaver + 0.5))/10 ;
							 | 
						|
											# warn "wpgoal $wpgoal wpavail $wpavail wpscore $wpscore wpaver $wpaver wpnum $wpnum X" ;
							 | 
						|
											my $diff = $pinum - $wpnum;
							 | 
						|
											# warn "diff $diff X" ;
							 | 
						|
											$Gap += $diff ;
							 | 
						|
								    }
							 | 
						|
									}
							 | 
						|
								
							 | 
						|
									my $style_with_page = "" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "P.breakhere { page-break-before: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "div { page-break-before: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= "pageit { page-break-after: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
								# The following is an enheritable class.
							 | 
						|
									$style_with_page .= "<style type=\"text/css\">\n" ;
							 | 
						|
									$style_with_page .= ".break_after { page-break-after: always; } \n" ;
							 | 
						|
									$style_with_page .= "</style>\n" ;
							 | 
						|
								  print HTMLHeaderPlain("Section 2 - The Passion Index", 
							 | 
						|
										"", $style_with_page );
							 | 
						|
									# print "<pageit>\n" ;
							 | 
						|
								  print "<center><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"5\">" ;
							 | 
						|
									print "<b>Section 2 - The Passion Index</b></font><br><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"4\">" ;
							 | 
						|
									print "<b>Employee Needs That Ignite Passion" ;
							 | 
						|
									print "</b></font><br>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$FORM{'orgname'}</b></font><br>\n";
							 | 
						|
								  if ($FORM{'uberheader'} ne "") {
							 | 
						|
								    print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>".$FORM{'uberheader'}."</b></font><br>\n";
							 | 
						|
								  } elsif (defined $idlist) {
							 | 
						|
										my $groups = getGroups($CLIENT{'clid'});
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>Groups: "
							 | 
						|
									    .join(", ",map($groups->{$_}->{'grpnme'},split(/,/,$FORM{'idlist'})))."</b></font><br>\n";
							 | 
						|
								    } else {
							 | 
						|
										print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><b>$xlatphrase[798] $xlatphrase[799]</b></font><br>\n";
							 | 
						|
								    }
							 | 
						|
								  $timestamp;
							 | 
						|
								  # printf "<table border><tr><td>Your Employee Passion Gap Score is %.1f",$Gap ;
							 | 
						|
								  # print "</td></tr></table>\n";
							 | 
						|
								  print "<br><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><table border>\n";
							 | 
						|
								  print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">" ;
							 | 
						|
									print "The graphs below show employees' perceptions of the importance of these needs " ;
							 | 
						|
									print "and the level of \"satisfaction\" being experienced.\n" ;
							 | 
						|
									print "</font>";
							 | 
						|
									$url = "/cgi-bin/linegraph.pl?values=B:C::1:6::2:4" .
							 | 
						|
									    "&labels=J:K:L&y_label=Scale&x_label=letter" . 
							 | 
						|
											"&xdim=700&ydim=200" .
							 | 
						|
											"&xdim=200&ydim=100" ;
							 | 
						|
									print "<br><br>\n" ;
							 | 
						|
									print "<img src=\"${url}&colors=" ;
							 | 
						|
									print join(":", ("lred", "lorange", "lyellow", "lgreen", "decentblue")) ;
							 | 
						|
									print "\">" ;
							 | 
						|
									print "<table>" ;
							 | 
						|
								  print "<tr><td> </td><th>Gap</th>" ;
							 | 
						|
									# print "<th>Intl</th>" ;
							 | 
						|
									print "</tr>\n";
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>1. <font color=#3333FF><b>The Need To Be Respected</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>1a. My immediate manager or supervisor trusts me and treats me with respect.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need to be Respected Me", "Man Need to be Respected Org.") ;
							 | 
						|
									print "<td>1b. My organization's policies and practices regarding compensation, work/life balance, and valuing diversity demonstrate respect for all employees.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need to be Respected Me", "Org Need to be Respected Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>2. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Learn and Grow</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>2a. I have the opportunity to increase my knowledge and develop new skills in my job.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Learn and Grow Me", "Man Learn and Grow Org.") ;
							 | 
						|
									print "<td>2b. My organization invests in developing the potential of all employees.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Learn and Grow Me", "Org Learn and Grow Org.") ;
							 | 
						|
								
							 | 
						|
								# Close the table, set up a page break for printing, and restart the table.
							 | 
						|
								  print "</table>\n";
							 | 
						|
									# Works for Firefox 8 on Linux, but not IE.
							 | 
						|
									# print "<div style=\"page-break-after: always\"></div>\n" ;
							 | 
						|
									# print "<div style=\"page-break-before: always\">\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-after:always\"></p>\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-after: always\"></p>\n" ;
							 | 
						|
									# Works for ???, but not IE.
							 | 
						|
									# print "<p style=\"page-break-before: always\"></p>\n" ;
							 | 
						|
									# print "<P CLASS=\"breakhere\"> </p>\n" ;
							 | 
						|
									print "<p style=\"page-break-after: always\">\n" ;
							 | 
						|
									print "<!–[if IE 4]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									print "<!–[if IE 5]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									print "<!–[if IE 6]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									print "<!–[if IE 7]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									print "<!–[if IE 8]><br style=\”height:0; line-height:0\″><![endif]–>" ;
							 | 
						|
									print "</p>" ;
							 | 
						|
									# print "</pageit>\n" ;
							 | 
						|
									# print "<pageit>\n" ;
							 | 
						|
								  print "<table border>\n" ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>3. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Be an Insider</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>3a. My immediate manager or supervisor values my contribution and cares about my well-being.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need to be an Insider Me", "Man Need to be an Insider Org.") ;
							 | 
						|
									print "<td>3b. My organization is open with employees about information and organizational performance to help us understand the decisions that are being made.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need to be an Insider Me", "Org Need to be an Insider Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>4. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need for Meaning</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>4a. The mission or purpose of my organization makes me feel proud to work here.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Need for Meaning Me", "Man Need for Meaning Org.") ;
							 | 
						|
									print "<td>4b. The work I do is meaningful because it helps my organization fulfill our mission.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Need for Meaning Me", "Org Need for Meaning Org.") ;
							 | 
						|
								
							 | 
						|
								# Print one Category.
							 | 
						|
									print "<tr>" ;
							 | 
						|
									print "<td>5. <font color=#3333FF><b>" ;
							 | 
						|
									print "The Need to Be Part of a Winning Team</b></font></td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
									print "</tr>\n" ;
							 | 
						|
									print "<td>5a. My team is making a significant contribution to our organization.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Man Winning Team Me", "Man Winning Team Org.") ;
							 | 
						|
									print "<td>5b. My team is focused on continually improving our performance.</td>" ;
							 | 
						|
									print "<td> </td>" ;
							 | 
						|
								  print "</tr>\n" ;
							 | 
						|
									&TwoBarCharts($data, "Org Winning Team Me", "Org Winning Team Org.") ;
							 | 
						|
								
							 | 
						|
								# Closing values.
							 | 
						|
								  print "<tr><th>Total Employee Passion Gap</th>";
							 | 
						|
								  printf "<td align=center>%.1f</td>", $Gap;
							 | 
						|
								  # print "<td align=center>13.8</td>\n" ;  # International Average
							 | 
						|
									print "</tr>\n";
							 | 
						|
								  # print "</table></b></font>\n";
							 | 
						|
								  print "</table>\n";
							 | 
						|
								  print HTMLFooter();
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								
							 |