[freeside-commits] freeside/FS/FS cust_bill.pm, 1.163.2.32, 1.163.2.33
Jeff Finucane,420,,
jeff at wavetail.420.am
Thu Jun 19 22:47:22 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv9120
Modified Files:
Tag: FREESIDE_1_7_BRANCH
cust_bill.pm
Log Message:
extra values for invoices
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.163.2.32
retrieving revision 1.163.2.33
diff -u -d -r1.163.2.32 -r1.163.2.33
--- cust_bill.pm 4 Jun 2008 18:51:43 -0000 1.163.2.32
+++ cust_bill.pm 20 Jun 2008 05:47:19 -0000 1.163.2.33
@@ -1216,11 +1216,7 @@
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 @@
'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 @@
}
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 @@
#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 @@
$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:
More information about the freeside-commits
mailing list