'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
'page' => 1,
'total_pages' => 1,
+ 'current_charges' => sprintf("%.2f", $self->charged),
+ 'duedate' => $self->due_date2str('%m/%d/%Y'), #date_format?
'ship_enable' => $conf->exists('invoice-ship_address'),
'unitprices' => $conf->exists('invoice-unitprice'),
);
# 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{'balance'} = $balance_due;
+ $invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total);
+ $invoice_data{'balance'} = sprintf("%.2f", $balance_due);
#do variable substitution in notes, footer, smallfooter
foreach my $include (qw( notes footer smallfooter coupon )) {
unshift @total_items, $total;
}
}
+ $invoice_data{'taxtotal'} = sprintf('%.2f', $taxtotal);
push @buf,['','-----------'];
push @buf,[( $conf->exists('disable_previous_balance')
#foreach my $thing ( sort { $a->_date <=> $b->_date } $self->_items_credits, $self->_items_payments
# credits
+ my $credittotal = 0;
foreach my $credit ( $self->_items_credits ) {
my $total;
$total->{'total_item'} = &$escape_function($credit->{'description'});
- #$credittotal
+ $credittotal += $credit->{'amount'};
$total->{'total_amount'} = '-'. $other_money_char. $credit->{'amount'};
$adjusttotal += $credit->{'amount'};
if ( $multisection ) {
push @total_items, $total;
}
}
+ $invoice_data{'credittotal'} = sprintf('%.2f', $credittotal);
# credits (again)
foreach ( $self->cust_credited ) {
}
# payments
+ my $paymenttotal = 0;
foreach my $payment ( $self->_items_payments ) {
my $total = {};
$total->{'total_item'} = &$escape_function($payment->{'description'});
- #$paymenttotal
+ $paymenttotal += $payment->{'amount'};
$total->{'total_amount'} = '-'. $other_money_char. $payment->{'amount'};
$adjusttotal += $payment->{'amount'};
if ( $multisection ) {
$money_char. sprintf("%10.2f", $payment->{'amount'}),
];
}
+ $invoice_data{'paymenttotal'} = sprintf('%.2f', $paymenttotal);
if ( $multisection ) {
$adjust_section->{'subtotal'} = $other_money_char.
$msg;
}
+sub balance_due_date {
+ my $self = shift;
+ my $duedate = '';
+ if ( $conf->exists('invoice_default_terms')
+ && $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) {
+ $duedate = time2str("%m/%d/%Y", $self->_date + ($1*86400) );
+ }
+ $duedate;
+}
+
=item invnum_date_pretty
Returns a string with the invoice number and date, for example: