diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-08-18 02:01:19 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-08-18 02:01:19 -0700 |
commit | 5c0cfcb8dec7c4f3a7aecea4c550ffb4bfb774c3 (patch) | |
tree | 552c633c19398d8658dbe7c2a23a4ac06948fe2e /FS/FS/agent.pm | |
parent | 5f2093d63b321716766535a0ff3e7420882a8888 (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.pm | 15 |
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 |