+ if ( $opt{y} ) {
+ print "\n\tApplying outstanding payments and credits" unless $opt{q};
+ $cust_main->apply_payments;
+ $cust_main->apply_credits;
+ }
+
+ if ( $opt{o} ) {
+ print "\n\tCollecting" unless $opt{q};
+ my $error = $cust_main->collect(
+ 'invoice_time' => $now,
+ 'batch_card' => $opt{i} ? 'no' : 'yes',
+ 'force_print' => 'yes',
+ );
+ warn "Error collecting from customer #" . $cust_main->custnum. ":$error"
+ if $error;