diff options
author | Mark Wells <mark@freeside.biz> | 2015-06-30 12:14:19 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-06-30 12:14:19 -0700 |
commit | 39501b4ff6c6cd9ac3cfe7ad313affe049e18994 (patch) | |
tree | ec152a661a88cd199a296ec0677b248e0947a4b5 /FS/FS/Report | |
parent | a8bdd6bf5d005af9dff6b53047ba378ef6912302 (diff) |
include discounts in gross sales reports, #25943
Diffstat (limited to 'FS/FS/Report')
-rw-r--r-- | FS/FS/Report/Table.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/FS/FS/Report/Table.pm b/FS/FS/Report/Table.pm index 4797473..eef983d 100644 --- a/FS/FS/Report/Table.pm +++ b/FS/FS/Report/Table.pm @@ -266,6 +266,36 @@ sub netrefunds { ); } +=item discounted: The sum of discounts on invoices in the period. + +=cut + +sub discounted { + my( $self, $speriod, $eperiod, $agentnum, %opt) = @_; + $self->scalar_sql('SELECT SUM(cust_bill_pkg_discount.amount) + FROM cust_bill_pkg_discount + JOIN cust_bill_pkg USING ( billpkgnum ) + JOIN cust_bill USING ( invnum ) + JOIN cust_main USING ( custnum ) + WHERE '. $self->in_time_period_and_agent( $speriod, + $eperiod, + $agentnum, + 'cust_bill._date' + ). + $self->for_opts(%opt) + ); +} + +=item gross: invoiced + discounted + +=cut + +sub gross { + my( $self, $speriod, $eperiod, $agentnum, %opt) = @_; + $self->invoiced( $speriod, $eperiod, $agentnum, %opt) + + $self->discounted( $speriod, $eperiod, $agentnum, %opt); +} + #XXX docs #these should be auto-generated or $AUTOLOADed or something |