diff options
author | jeff <jeff> | 2008-06-20 05:47:19 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-06-20 05:47:19 +0000 |
commit | 3e884d20d062eb6f15aff6f10e0f08c0659a530c (patch) | |
tree | 64e5e0aee0dd8ed92aaef6d903e953716bbafc78 /FS | |
parent | ffebbc9abcc975e385cf1e0e4e5dcefcacc211c5 (diff) |
extra values for invoices
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_bill.pm | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index b84b310bb..006892c2d 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1216,11 +1216,7 @@ sub print_csv { my $taxtotal = 0; $taxtotal += $_->{'amount'} foreach $self->_items_tax; - 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) ); - } + my $duedate = $self->balance_due_date; my( $previous_balance, @unused ) = $self->previous; #previous balance @@ -1816,7 +1812,10 @@ sub print_latex { 'terms' => $conf->config('invoice_default_terms') || 'Payable upon receipt', #'notes' => join("\n", $conf->config('invoice_latexnotes') ), 'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc", - 'balance' => $balance_due, + 'current_charges' => sprintf('%.2f', $self->charged ), + 'previous_balance' => sprintf("%.2f", $pr_total), + 'balance' => sprintf("%.2f", $balance_due), + 'duedate' => $self->balance_due_date, 'ship_enable' => $conf->exists('invoice-ship_address'), 'unitprices' => $conf->exists('invoice-unitprice'), ); @@ -2025,11 +2024,14 @@ sub print_latex { } if ( $taxtotal ) { + $invoice_data{'taxtotal'} = sprintf('%.2f', $taxtotal); my $total = {}; $total->{'total_item'} = 'Sub-total'; $total->{'total_amount'} = '\dollar '. sprintf('%.2f', $self->charged - $taxtotal ); unshift @total_items, $total; + }else{ + $invoice_data{'taxtotal'} = '0.00'; } { @@ -2051,22 +2053,26 @@ sub print_latex { #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'} = _latex_escape($credit->{'description'}); - #$credittotal + $credittotal += $credit->{'amount'}; $total->{'total_amount'} = '-\dollar '. $credit->{'amount'}; push @total_items, $total; } + $invoice_data{'credittotal'} = sprintf('%.2f', $credittotal); # payments + my $paymenttotal = 0; foreach my $payment ( $self->_items_payments ) { my $total = {}; $total->{'total_item'} = _latex_escape($payment->{'description'}); - #$paymenttotal + $paymenttotal += $payment->{'amount'}; $total->{'total_amount'} = '-\dollar '. $payment->{'amount'}; push @total_items, $total; } + $invoice_data{'paymenttotal'} = sprintf('%.2f', $paymenttotal); { my $total; @@ -2402,6 +2408,16 @@ sub balance_due_msg { $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: |