Commissions template
Jason Spence
thalakan at technologist.com
Wed Aug 23 21:23:41 PDT 2000
Hi -
Here's a template we added to Freeside to create commission reports for
different Freeside accounts. How's my code?
<snip>
#!/usr/bin/perl -Tw
# commissions.cgi -- view commission schedule for each freeside user
use strict;
use vars qw($cgi @customers $customer $i $tpl $page %vars $safe);
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::Record qw(qsearch);
use FS::CGI qw(header);
use FS::UID qw(cgisuidsetup);
use FS::cust_main;
$cgi = new CGI;
&cgisuidsetup($cgi);
print $cgi->header('-expires' => 'now'), header('View Commission Schedules');
print $cgi->a({-href => '/freeside'}, "Main Menu");
print $cgi->br;
print $cgi->br;
if(! $cgi->param()) {
print $cgi->startform(-method => 'post',
-action => 'commissions.cgi');
print $cgi->textfield(-name => 'otaker',
-default => 'mary',
-size => 20);
print $cgi->br;
print $cgi->submit;
print $cgi->reset;
print $cgi->endform();
}
else {
print "Commission schedule for agent: " . $cgi->param('otaker');
print $cgi->hr;
print $cgi->br;
print $cgi->br;
@customers = qsearch('cust_main', {'otaker' => $cgi->param('otaker')});
$i = 0;
for $customer (@customers) {
print "Customer ID: " . $customer->getfield('custnum');
print ": ";
print $customer->getfield('first');
print " ";
print $customer->getfield('last');
print $cgi->br();
$i++;
}
print $cgi->br();
print "Total customers: $i";
}
</snip>
More information about the freeside-devel
mailing list