summaryrefslogtreecommitdiff
path: root/FS/FS/agent.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-08-18 02:01:19 -0700
committerIvan Kohler <ivan@freeside.biz>2013-08-18 02:01:19 -0700
commit5c0cfcb8dec7c4f3a7aecea4c550ffb4bfb774c3 (patch)
tree552c633c19398d8658dbe7c2a23a4ac06948fe2e /FS/FS/agent.pm
parent5f2093d63b321716766535a0ff3e7420882a8888 (diff)
continue sales person work: customer and package selection, commissions, reporting. RT#23402
Diffstat (limited to 'FS/FS/agent.pm')
-rw-r--r--FS/FS/agent.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm
index 57093e3..0cd07ef 100644
--- a/FS/FS/agent.pm
+++ b/FS/FS/agent.pm
@@ -626,6 +626,21 @@ sub num_prepay_credit {
$sth->fetchrow_arrayref->[0];
}
+=item num_sales
+
+Returns the number of non-disabled sales people for this agent.
+
+=cut
+
+sub num_sales {
+ my $self = shift;
+ my $sth = dbh->prepare(
+ "SELECT COUNT(*) FROM sales WHERE agentnum = ?
+ AND ( disabled = '' OR disabled IS NULL )"
+ ) or die dbh->errstr;
+ $sth->execute($self->agentnum) or die $sth->errstr;
+ $sth->fetchrow_arrayref->[0];
+}
=back