use strict;return sub{my $this = shift;my $C = $this->{C};$this->out("<workbook>\n	<worksheet name=\"report\">\n\n		<row></row>\n\n		<format bold=\"bold\">\n			<row>\n				<cell>Program Name: $C->{INPUT}{title} (#$C->{INPUT}{id})</cell>\n			</row>\n		</format>\n\n		<format>\n			<row>\n				<cell>Trial Length:");my $var = do { ' ' .($C->{INPUT}{trial} || 'none') };\$this->out($var);$this->out("</cell>\n			</row>\n			<row></row>\n			<row>\n				<cell>Total # of Subscriptions Sold: $C->{INPUT}{sales}</cell>\n			</row>\n			<row>\n				<cell>Total # of Rebills: $C->{INPUT}{billings}</cell>\n			</row>\n			<row>\n				<cell>Overall Retention Rate: $C->{INPUT}{avgret}</cell>\n			</row>\n		</format>\n\n		<row></row>\n	\n		<format align=\"center\" valign=\"vcenter\" bold=\"bold\" border=\"2\">\n			<row>\n				<cell>Joined In</cell>\n				<cell>Total Joined</cell>\n				<cell>Still Members</cell>\n				<cell>Retention</cell>\n				<cell>Avg Retention</cell>\n");my $in = [1..$C->{MaxBillings}];my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{b} = -1;for my $f (@$loop) {$C->{ITERATION}{b}++;$C->{b} = $f;$this->out("				<cell>Rebilled $C->{b}</cell>\n				<cell>\%</cell>\n");}$this->out("			</row>\n		</format>\n		<format align=\"center\" valign=\"vcenter\" border=\"1\">\n			<row>\n				<cell width=\"10\">TOTAL</cell>\n				<cell width=\"10\">$C->{Total}{total_joined}</cell>\n				<cell width=\"15\">$C->{Total}{still_members}</cell>\n				<cell width=\"15\">$C->{Total}{retention}</cell>\n				<cell width=\"15\">$C->{Total}{avg_retention}</cell>\n");my $in = [1..$C->{MaxBillings}];my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{b} = -1;for my $f (@$loop) {$C->{ITERATION}{b}++;$C->{b} = $f;$this->out("");if ( $C->{Total}{billings}{$C->{b}} ) {$this->out("					<cell>$C->{Total}{billings}{$C->{b}}</cell>\n					<cell>$C->{Total}{billings_pc}{$C->{b}}</cell>\n");} else {$this->out("					<cell></cell>\n					<cell></cell>\n");}$this->out("");}$this->out("			</row>\n");my $in = $C->{Data};my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{m} = -1;for my $f (@$loop) {$C->{ITERATION}{m}++;$C->{m} = $f;$this->out("			<row>\n				<cell width=\"10\">$C->{m}{month}</cell>\n				<cell width=\"10\">$C->{m}{total_joined}</cell>\n				<cell width=\"15\">$C->{m}{still_members}</cell>\n				<cell width=\"15\">$C->{m}{retention}</cell>\n				<cell width=\"15\">$C->{m}{avg_retention}</cell>\n");my $in = [1..$C->{MaxBillings}];my $loop = ref($in) eq "ARRAY" ? $in : ref($in) eq "CODE" ? &{$in} : [];$C->{ITERATION}{b} = -1;for my $f (@$loop) {$C->{ITERATION}{b}++;$C->{b} = $f;$this->out("");if ( $C->{m}{billings}{$C->{b}} ) {$this->out("					<cell>$C->{m}{billings}{$C->{b}}</cell>\n					<cell>$C->{m}{billings_pc}{$C->{b}}</cell>\n");} else {$this->out("					<cell></cell>\n					<cell></cell>\n");}$this->out("");}$this->out("			</row>\n");}$this->out("		</format>\n\n	</worksheet>\n</workbook>\n");}