=item charged - amount of this invoice
+=item invoice_terms - optional terms override for this specific invoice
+
+=back
+
+Customer info at invoice generation time
+
+=over 4
+
+=item previous_balance
+
+=item billing_balance
+
=back
Deprecated
sub cust_bill_pay {
my $self = shift;
+ map { $_ } #return $self->num_cust_bill_pay unless wantarray;
sort { $a->_date <=> $b->_date }
qsearch( 'cust_bill_pay', { 'invnum' => $self->invnum } );
}
sub cust_credited {
my $self = shift;
+ map { $_ } #return $self->num_cust_credit_bill unless wantarray;
sort { $a->_date <=> $b->_date }
qsearch( 'cust_credit_bill', { 'invnum' => $self->invnum } )
;
sub cust_bill_pay_pkgnum {
my( $self, $pkgnum ) = @_;
+ map { $_ } #return $self->num_cust_bill_pay_pkgnum($pkgnum) unless wantarray;
sort { $a->_date <=> $b->_date }
qsearch( 'cust_bill_pay', { 'invnum' => $self->invnum,
'pkgnum' => $pkgnum,
=item cust_credited_pkgnum PKGNUM
+=item cust_credit_bill_pkgnum PKGNUM
+
Returns all applied credits (see L<FS::cust_credit_bill>) for this invoice
with matching pkgnum.
sub cust_credited_pkgnum {
my( $self, $pkgnum ) = @_;
+ map { $_ } #return $self->num_cust_credit_bill_pkgnum($pkgnum) unless wantarray;
sort { $a->_date <=> $b->_date }
qsearch( 'cust_credit_bill', { 'invnum' => $self->invnum,
'pkgnum' => $pkgnum,
);
}
+sub cust_credit_bill_pkgnum {
+ shift->cust_credited_pkgnum(@_);
+}
+
=item tax
Returns the tax amount (see L<FS::cust_bill_pkg>) for this invoice.
}
$invoice_from = $opt->{'invoice_from'};
$balance_over = $opt->{'balance_over'} if $opt->{'balance_over'};
- $notice_name = $opt=>{'notice_name'};
+ $notice_name = $opt->{'notice_name'};
} else {
$template = scalar(@_) ? shift : '';
if ( scalar(@_) && $_[0] ) {
# my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
#my $balance_due = $self->owed + $pr_total - $cr_total;
my $balance_due = $self->owed + $pr_total;
- $invoice_data{'true_previous_balance'} = sprintf("%.2f", $self->previous_balance);
- $invoice_data{'balance_adjustments'} = sprintf("%.2f", $self->previous_balance - $self->billing_balance);
+ $invoice_data{'true_previous_balance'} = sprintf("%.2f", ($self->previous_balance || 0) );
+ $invoice_data{'balance_adjustments'} = sprintf("%.2f", ($self->previous_balance || 0) - ($self->billing_balance || 0) );
$invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total);
$invoice_data{'balance'} = sprintf("%.2f", $balance_due);
$line_item_line =~ s/\$(\w+)/'. \$_tr_line->{$1}. '/g;
push @template, " \$OUT .= '$line_item_line';";
}
-
+
push @template, '}',
'--@]';
-
+ #' doh, gvim
} elsif ( $line =~ /^%%TotalDetails\s*$/ ) {
push @template, '[@--',
sub terms {
my $self = shift;
- #check for an invoice- specific override (eventually)
+ #check for an invoice-specific override
+ return $self->invoice_terms if $self->invoice_terms;
#check for a customer- specific override
- return $self->cust_main->invoice_terms
- if $self->cust_main->invoice_terms;
+ my $cust_main = $self->cust_main;
+ return $cust_main->invoice_terms if $cust_main->invoice_terms;
#use configured default
$conf->config('invoice_default_terms') || '';