X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FReport%2FTable.pm;h=63e5318c31368702524bffd6acdc04cef92f2a3b;hp=ffa11724041c56e92cf370bad9bd12bd39f9b9e0;hb=86b44a7897af8265bcd87603fbf2632489ca10b8;hpb=f97cd91298d3cbfd380741cf4a64d402d3628ecd diff --git a/FS/FS/Report/Table.pm b/FS/FS/Report/Table.pm index ffa117240..63e5318c3 100644 --- a/FS/FS/Report/Table.pm +++ b/FS/FS/Report/Table.pm @@ -229,7 +229,8 @@ sub receipts { #net payments my $sql = 'SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay'; if ( $opt{'setuprecur'} ) { $sql = 'SELECT SUM('. - FS::cust_bill_pkg->paid_sql($speriod, $eperiod, %opt). + #in practice, but not appearance, paid_sql accepts end before start + FS::cust_bill_pkg->paid_sql($eperiod, $speriod, %opt). ') FROM cust_bill_pkg'; } @@ -275,6 +276,11 @@ sub discounted { my $sql = 'SELECT SUM('; if ($opt{'setuprecur'}) { + # (This isn't exact but it works in most cases.) + # When splitting into setup/recur values, + # if the discount is allowed to apply to setup fees (discount.setup = 'Y') + # then split it between the "setup" and "recurring" rows in proportion to + # the "unitsetup" and "unitrecur" fields of the line item. $sql .= <