X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_credit.pm;h=e07461d58884937ef77fdee1cdf7a46c0a6cbc4a;hp=84ca79dbfb7bca07e345e4496c7d1c443ecf2eab;hb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;hpb=32b5d3a31f112a381f0a15ac5e3a2204242f3405 diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index 84ca79dbf..e07461d58 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -333,10 +333,43 @@ sub cust_main { =back +=head1 CLASS METHODS + +=over 4 + +=item credited_sql + +Returns an SQL fragment to retreive the unapplied amount. + +=cut + +sub credited_sql { + #my $class = shift; + + "amount + - COALESCE( + ( SELECT SUM(amount) FROM cust_credit_refund + WHERE cust_credit.crednum = cust_credit_refund.crednum ) + ,0 + ) + - COALESCE( + ( SELECT SUM(amount) FROM cust_credit_bill + WHERE cust_credit.crednum = cust_credit_bill.crednum ) + ,0 + ) + "; + +} + +=back + =head1 BUGS The delete method. The replace method. +B and B should probably be called B and +B. + =head1 SEE ALSO L, L, L,