X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fagent.pm;fp=FS%2FFS%2Fpart_pkg%2Fagent.pm;h=0e89f42396caa308f9f04cbd2ed1fb9e778a0456;hb=a81ff71c918e7a82ccd6646351734ce74e8e4dd3;hp=6391fc9159f54963b1c9e4c903f44fb771b4d7b6;hpb=a1c46091ebd0cc17bcbe19be266dc2efa9f2d92b;p=freeside.git diff --git a/FS/FS/part_pkg/agent.pm b/FS/FS/part_pkg/agent.pm index 6391fc915..0e89f4239 100644 --- a/FS/FS/part_pkg/agent.pm +++ b/FS/FS/part_pkg/agent.pm @@ -116,6 +116,8 @@ sub calc_recur { my $pkg_charge = 0; + my $quantity = $cust_pkg->quantity || 1; + #option to not fallback? via options above my $pkg_setup_fee = $part_pkg->setup_cost || $part_pkg->option('setup_fee'); @@ -126,14 +128,18 @@ sub calc_recur { if ( $pkg_start < $last_bill ) { $pkg_start = $last_bill; } elsif ( $pkg_setup_fee ) { - $pkg_charge += $pkg_setup_fee; - $pkg_details .= $money_char. sprintf('%.2f setup, ', $pkg_setup_fee ); + $pkg_charge += $quantity * $pkg_setup_fee; + $pkg_details .= $money_char. + sprintf('%.2f setup', $quantity * $pkg_setup_fee ); + $pkg_details .= sprintf(" ($quantity \@ $money_char". '%.2f)', + $pkg_setup_fee ) + if $quantity > 1; + $pkg_details .= ', '; } my $pkg_end = $cust_pkg->get('cancel'); $pkg_end = ( !$pkg_end || $pkg_end > $$sdate ) ? $$sdate : $pkg_end; - my $pkg_recur_charge = $prorate_ratio * $pkg_base_recur; $pkg_recur_charge *= ( $pkg_end - $pkg_start ) / ( $$sdate - $last_bill ) @@ -141,12 +147,17 @@ sub calc_recur { my $recur_charge += $pkg_recur_charge; - $pkg_details .= $money_char. sprintf('%.2f', $recur_charge ). - ' ('. time2str($date_format, $pkg_start). - ' - '. time2str($date_format, $pkg_end ). ')' - if $recur_charge; + if ( $recur_charge ) { + $pkg_details .= $money_char. + sprintf('%.2f', $quantity * $recur_charge ); + $pkg_details .= sprintf(" ($quantity \@ $money_char". '%.2f)', + $recur_charge ) + if $quantity > 1; + $pkg_details .= ' ('. time2str($date_format, $pkg_start). + ' - '. time2str($date_format, $pkg_end ). ')'; + } - $pkg_charge += $recur_charge; + $pkg_charge += $quantity * $recur_charge; push @$details, $pkg_details if $pkg_charge;