diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-10-23 16:17:51 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-10-23 16:17:51 -0700 |
commit | 80c2d997c5c983344c530ecbb46f94f1c299b35f (patch) | |
tree | 28bafc1d55836acb5455e6554941c06f0912ef98 /FS/FS/Template_Mixin.pm | |
parent | 3b1a5e8789d76f0581079d07190664f57bd773a3 (diff) | |
parent | 0806f9fdbf2086671c151b3bcb078dc008e96f6c (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS/FS/Template_Mixin.pm')
-rw-r--r-- | FS/FS/Template_Mixin.pm | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 1a3217c44..ffaef9707 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -3050,6 +3050,9 @@ sub _items_cust_bill_pkg { # if the current line item is waiting to go out, and the one we're about # to start is not bundled, then push out the current one and start a new # one. + if ( $d ) { + $d->{amount} = $d->{setup_amount} + $d->{recur_amount}; + } foreach ( $s, $r, ($opt{skip_usage} ? () : $u ), $d ) { if ( $_ && !$cust_bill_pkg->hidden ) { $_->{amount} = sprintf( "%.2f", $_->{amount} ); @@ -3485,7 +3488,8 @@ sub _items_cust_bill_pkg { # $item_discount->{amount} is negative if ( $d and $cust_bill_pkg->hidden ) { - $d->{amount} += $item_discount->{amount}; + $d->{setup_amount} += $item_discount->{setup_amount}; + $d->{recur_amount} += $item_discount->{recur_amount}; } else { $d = $item_discount; $_ = &{$escape_function}($_) foreach @{ $d->{ext_description} }; @@ -3493,27 +3497,9 @@ sub _items_cust_bill_pkg { # update the active line (before the discount) to show the # original price (whether this is a hidden line or not) - # - # quotation discounts keep track of setup and recur; invoice - # discounts currently don't - if ( exists $item_discount->{setup_amount} ) { - - $s->{amount} -= $item_discount->{setup_amount} if $s; - $r->{amount} -= $item_discount->{recur_amount} if $r; - } else { - - # $active_line is the line item hashref for the line that will - # show the original price - # (use the recur or single line for the package, unless we're - # showing a setup line for a package with no recurring fee) - my $active_line = $r; - if ( $type eq 'S' ) { - $active_line = $s; - } - $active_line->{amount} -= $item_discount->{amount}; - - } + $s->{amount} -= $item_discount->{setup_amount} if $s; + $r->{amount} -= $item_discount->{recur_amount} if $r; } # if there are any discounts } # if this is an appropriate place to show discounts @@ -3522,6 +3508,11 @@ sub _items_cust_bill_pkg { } + # discount amount is internally split up + if ( $d ) { + $d->{amount} = $d->{setup_amount} + $d->{recur_amount}; + } + foreach ( $s, $r, ($opt{skip_usage} ? () : $u ), $d ) { if ( $_ ) { $_->{amount} = sprintf( "%.2f", $_->{amount} ), |