summaryrefslogtreecommitdiff
path: root/FS/FS/Report/Table
diff options
context:
space:
mode:
authorivan <ivan>2008-03-14 07:49:13 +0000
committerivan <ivan>2008-03-14 07:49:13 +0000
commit9d55204f876f52e314076f5fa9d1ae15a1639dae (patch)
tree6178fd93814c080679e26f4cbc66d1387f880f60 /FS/FS/Report/Table
parent65bfed89f6eff03f32ba6199e3a2e2debcd1a009 (diff)
add net credits to sales/credits/receipts report
Diffstat (limited to 'FS/FS/Report/Table')
-rw-r--r--FS/FS/Report/Table/Monthly.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm
index 33fdfd8..7463620 100644
--- a/FS/FS/Report/Table/Monthly.pm
+++ b/FS/FS/Report/Table/Monthly.pm
@@ -228,6 +228,21 @@ sub credits {
);
}
+sub netcredits {
+ my( $self, $speriod, $eperiod, $agentnum ) = @_;
+ $self->scalar_sql("
+ SELECT SUM(cust_credit_bill.amount)
+ FROM cust_credit_bill
+ LEFT JOIN cust_bill USING ( invnum )
+ LEFT JOIN cust_main USING ( custnum )
+ WHERE ". $self->in_time_period_and_agent( $speriod,
+ $eperiod,
+ $agentnum,
+ 'cust_bill._date'
+ )
+ );
+}
+
#these should be auto-generated or $AUTOLOADed or something
sub invoiced_12mo {
my( $self, $speriod, $eperiod, $agentnum ) = @_;