[freeside-commits] freeside/FS/FS cust_bill.pm,1.200,1.201
Jeff Finucane,420,,
jeff at wavetail.420.am
Sat May 31 07:49:05 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12276/FS/FS
Modified Files:
cust_bill.pm
Log Message:
invoice cosmetic improvements
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- cust_bill.pm 30 May 2008 03:55:49 -0000 1.200
+++ cust_bill.pm 31 May 2008 14:49:02 -0000 1.201
@@ -1951,6 +1951,14 @@
sprintf('%.2f', $pr_total),
};
+ my $taxtotal = 0;
+ my $tax_section = { 'description' => 'Taxes, Surcharges, and Fees',
+ 'subtotal' => $taxtotal }; # adjusted below
+
+ my $adjusttotal = 0;
+ my $adjust_section = { 'description' => 'Credits, Payments, and Adjustments',
+ 'subtotal' => 0 }; # adjusted below
+
my $multisection = $conf->exists('invoice_sections', $cust_main->agentnum);
if ( $multisection ) {
push @sections, $self->_items_sections;
@@ -2048,16 +2056,28 @@
}
if ( $multisection && !$conf->exists('disable_previous_balance') ) {
- unshift @sections, $previous_section;
+ unshift @sections, $previous_section if $pr_total;
}
- my $taxtotal = 0;
foreach my $tax ( $self->_items_tax ) {
my $total = {};
$total->{'total_item'} = &$escape_function($tax->{'description'});
$taxtotal += $tax->{'amount'};
$total->{'total_amount'} = $other_money_char. $tax->{'amount'};
- push @total_items, $total;
+ if ( $multisection ) {
+ my $money = $old_latex ? '' : $money_char;
+ push @detail_items, {
+ ext_description => [],
+ ref => '',
+ quantity => '',
+ description => &$escape_function($tax->{'description'}),
+ amount => $money. $tax->{'amount'},
+ product_code => '',
+ section => $tax_section,
+ };
+ }else{
+ push @total_items, $total;
+ }
push @buf,[ $total->{'total_item'},
$money_char. sprintf("%10.2f", $total->{'total_amount'}),
];
@@ -2066,14 +2086,19 @@
if ( $taxtotal ) {
my $total = {};
+ $total->{'total_item'} = 'Sub-total';
+ $total->{'total_amount'} =
+ $other_money_char. sprintf('%.2f', $self->charged - $taxtotal );
+
if ( $multisection ) {
- $total->{'total_item'} = 'New charges sub-total';
+ $tax_section->{'subtotal'} = $other_money_char.
+ sprintf('%.2f', $taxtotal);
+ $tax_section->{'pretotal'} = 'New charges sub-total '.
+ $total->{'total_amount'};
+ push @sections, $tax_section if $taxtotal;
}else{
- $total->{'total_item'} = 'Sub-total';
+ unshift @total_items, $total;
}
- $total->{'total_amount'} =
- $other_money_char. sprintf('%.2f', $self->charged - $taxtotal );
- unshift @total_items, $total;
}
push @buf,['','-----------'];
@@ -2097,7 +2122,12 @@
)
)
);
- push @total_items, $total;
+ if ( $multisection ) {
+ $adjust_section->{'pretotal'} = 'New charges total '.
+ $total->{'total_amount'};
+ }else{
+ push @total_items, $total;
+ }
push @buf,['','-----------'];
push @buf,['Total Charges',
$money_char.
@@ -2120,7 +2150,21 @@
$total->{'total_item'} = &$escape_function($credit->{'description'});
#$credittotal
$total->{'total_amount'} = '-'. $other_money_char. $credit->{'amount'};
- push @total_items, $total;
+ $adjusttotal += $credit->{'amount'};
+ if ( $multisection ) {
+ my $money = $old_latex ? '' : $money_char;
+ push @detail_items, {
+ ext_description => [],
+ ref => '',
+ quantity => '',
+ description => &$escape_function($credit->{'description'}),
+ amount => $money. $credit->{'amount'},
+ product_code => '',
+ section => $adjust_section,
+ };
+ }else{
+ push @total_items, $total;
+ }
}
# credits (again)
@@ -2143,12 +2187,32 @@
$total->{'total_item'} = &$escape_function($payment->{'description'});
#$paymenttotal
$total->{'total_amount'} = '-'. $other_money_char. $payment->{'amount'};
- push @total_items, $total;
+ $adjusttotal += $payment->{'amount'};
+ if ( $multisection ) {
+ my $money = $old_latex ? '' : $money_char;
+ push @detail_items, {
+ ext_description => [],
+ ref => '',
+ quantity => '',
+ description => &$escape_function($payment->{'description'}),
+ amount => $money. $payment->{'amount'},
+ product_code => '',
+ section => $adjust_section,
+ };
+ }else{
+ push @total_items, $total;
+ }
push @buf, [ $payment->{'description'},
$money_char. sprintf("%10.2f", $payment->{'amount'}),
];
}
+ if ( $multisection ) {
+ $adjust_section->{'subtotal'} = $other_money_char.
+ sprintf('%.2f', $adjusttotal);
+ push @sections, $adjust_section;
+ }
+
{
my $total;
$total->{'total_item'} = &$embolden_function($self->balance_due_msg);
@@ -2156,7 +2220,12 @@
&$embolden_function(
$other_money_char. sprintf('%.2f', $self->owed + $pr_total )
);
- push @total_items, $total;
+ if ( $multisection ) {
+ $adjust_section->{'posttotal'} = $total->{'total_item'}. ' '.
+ $total->{'total_amount'};
+ }else{
+ push @total_items, $total;
+ }
push @buf,['','-----------'];
push @buf,[$self->balance_due_msg, $money_char.
sprintf("%10.2f", $balance_due ) ];
More information about the freeside-commits
mailing list