diff options
author | ivan <ivan> | 2007-07-13 23:58:55 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-07-13 23:58:55 +0000 |
commit | da14440c0ce55a29371064fd1cf34bd6e390865d (patch) | |
tree | 132372b889c4142f23be03d3b9011a84e8f6e3dd /bin/find-overapplied | |
parent | 9035034a53d60cb7a7687dfee899c1d0c775ea74 (diff) |
adding quick find-overapplied script
Diffstat (limited to 'bin/find-overapplied')
-rw-r--r-- | bin/find-overapplied | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/find-overapplied b/bin/find-overapplied new file mode 100644 index 000000000..6bcc31539 --- /dev/null +++ b/bin/find-overapplied @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + +use strict; +use Data::Dumper; +use FS::UID qw(adminsuidsetup); +use FS::Record qw(qsearch); +use FS::cust_credit; +use FS::cust_pay; + +my $user = shift or die &usage; +adminsuidsetup $user; + +my @credits = grep { $_->credited < 0 } qsearch('cust_credit', {}); +my @payments = grep { $_->unapplied < 0 } qsearch('cust_pay', {}); + +if ( @credits ) { + print scalar(@credits). " overapplied credits:\n". Dumper(@credits). "\n"; +} + +if ( @payments ) { + print scalar(@payments). " overapplied credits:\n". Dumper(@payments). "\n"; +} + +sub usage { + die "Usage:\n\n find-overapplied user\n"; +} + |