X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-bill;h=1dce9a19bf8f127a6633d286c3b2e9709e624797;hp=3462fa149e63c3edc911fa63c5fa7d1249476c02;hb=fbcb45dfe5a1bce7981fe4527176b9fdf2ec54b7;hpb=33204e66fb11e9e551b95e8656d088506745e361 diff --git a/FS/bin/freeside-bill b/FS/bin/freeside-bill index 3462fa149..1dce9a19b 100755 --- a/FS/bin/freeside-bill +++ b/FS/bin/freeside-bill @@ -55,15 +55,19 @@ foreach $cust_main ( warn "Error billing, customer #" . $cust_main->getfield('custnum') . ":" . $error if $error; + if ($main::opt_p) { + $cust_main->apply_payments; + $error=$cust_main->apply_credits; + } + if ($main::opt_c) { $error=$cust_main->collect('invoice_time'=>$time, 'batch_card' => $main::opt_i ? 'no' : 'yes', ); - warn "Error collecting customer #" . $cust_main->getfield('custnum') . - ":" . $error if $error; - - #sleep 1; + warn "Error collecting from customer #" . $cust_main->gcustnum. ":$error" + if $error; + #sleep 1; } } @@ -89,7 +93,7 @@ freeside-bill - Command line (crontab, script) interface to customer billing. =head1 SYNOPSIS - freeside-bill [ -c [ -a ] [ -i ] ] [ -d 'date' ] user [ custnum custnum ... ] + freeside-bill [ -c [ -p ] [ -a ] [ -i ] ] [ -d 'date' ] user [ custnum custnum ... ] =head1 DESCRIPTION @@ -98,6 +102,9 @@ the bill and collect methods of a cust_main object. See L. -c: Turn on collecting (you probably want this). + -p: Apply unapplied payments and credits before collecting (you probably want + this too) + -a: Call collect even if there isn't a new invoice (probably a bad idea for daily use) @@ -114,7 +121,7 @@ customers. Otherwise, bills all customers. =head1 VERSION -$Id: freeside-bill,v 1.7 2001-08-21 09:34:13 ivan Exp $ +$Id: freeside-bill,v 1.8 2001-09-03 22:07:39 ivan Exp $ =head1 BUGS