X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fpart_pkg.html;h=915dbf4482f56509aead0c5ee874c09f2c70a7d3;hb=7353f670ef61e617a9dfb6c258907eb70e0345f6;hp=384db7288368741e64ebfa042fede08ea27066c0;hpb=0e0512c9ede1e4042887e764f1909cadf12bbfb4;p=freeside.git diff --git a/httemplate/search/part_pkg.html b/httemplate/search/part_pkg.html index 384db7288..915dbf448 100644 --- a/httemplate/search/part_pkg.html +++ b/httemplate/search/part_pkg.html @@ -114,8 +114,8 @@ if (1) { #commission reports } 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 "; @@ -169,10 +169,11 @@ if (1) { #commission reports 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 @@ -187,7 +188,8 @@ if (1) { #commission reports my $access_user = qsearchs('access_user', { 'usernum' => $part_pkg->get('usernum'), }) 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