push @links, ''; #link to employee edit w/ACL?
$align .= 'c';
- push @order_by, 'otaker';
+ push @order_by, 'username';
$title = 'Employee';
}
my $from_cust_bill_pkg_where = "FROM cust_bill_pkg
- LEFT JOIN ( cust_bill ) USING ( invnum )
- LEFT JOIN ( cust_pkg ) USING ( pkgnum )
+ LEFT JOIN cust_bill USING ( invnum )
+ LEFT JOIN cust_pkg USING ( pkgnum )
WHERE cust_bill_pkg.pkgnum > 0
AND cust_bill._date >= $beginning
AND cust_bill._date <= $ending ";
push @fields, sub {
my $part_pkg = shift;
my $sql = "SELECT SUM(amount) FROM cust_credit
- INNER JOIN cust_event USING ( eventnum )
- LEFT JOIN part_event USING ( eventpart )
- LEFT JOIN cust_pkg ON ( cust_event.tablenum = cust_pkg.pkgnum )
- WHERE action IN ( 'pkg_employee_credit',
+ LEFT JOIN cust_event USING ( eventnum )
+ LEFT JOIN part_event USING ( eventpart )
+ LEFT JOIN cust_pkg ON ( cust_event.tablenum = cust_pkg.pkgnum )
+ WHERE eventnum IS NOT NULL
+ AND action IN ( 'pkg_employee_credit',
'pkg_employee_credit_pkg'
)
AND cust_credit._date >= $beginning
my $access_user = qsearchs('access_user', { 'username' => $part_pkg->get('username') })
or die "unknown usernum";
- push @arg, $access_user->user_custnum or return 0;
+ return 0 unless $access_user->user_custnum;
+ push @arg, $access_user->user_custnum;
} elsif (0) { #agent commission reports
push @arg, 'XXXagent_custnum'; #$agent->agent_custnum