X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=3c3016ba2a225f3dcef0af2859ac6a37af3f7f54;hp=c6cbb81a3ea263dadb58f76b4178928d165e4e2f;hb=74a3083375ccc3a0dc8b74f9b39392989d088656;hpb=04a69f9d197efee6fa396bd35d04ae553e669978 diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index c6cbb81a3..3c3016ba2 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -84,11 +84,11 @@ my $extra_sql = scalar(@where) join( 'AND ', @where) : ''; -my $agentnums = join(',', $curuser->agentnums); +my $agentnums_sql = $curuser->agentnums_sql( 'table'=>'cust_main' ); my $count_cust_pkg = " SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum ) WHERE cust_pkg.pkgpart = part_pkg.pkgpart - AND cust_main.agentnum IN ($agentnums) + AND $agentnums_sql "; $select = " @@ -177,6 +177,12 @@ unless ( 0 ) { #already showing only one class or something? $align .= 'l'; } +if ( $conf->exists('pkg-addon_classnum') ) { + push @header, "Add'l order class"; + push @fields, sub { shift->addon_classname || '(none)'; }; + $align .= 'l'; +} + tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() }; tie my %plan_labels, 'Tie::IxHash', @@ -189,6 +195,9 @@ push @fields, sub { my $part_pkg = shift; (my $plan = $plan_labels{$part_pkg->plan} ) =~ s/ / /g; my $is_recur = ( $part_pkg->freq ne '0' ); + my @discounts = sort { $a->months <=> $b->months } + map { $_->discount } + $part_pkg->part_pkg_discount; [ [ @@ -232,6 +241,28 @@ push @fields, sub { } $part_pkg->bill_part_pkg_link ), + ( scalar(@discounts) + ? [ + { data => 'Discounts', + align=>'center', #? + colspan=>2, + } + ] + : () + ), + ( scalar(@discounts) + ? map { + [ + { data => $_->months. ':', + align => 'right', + }, + { data => $_->amount ? '$'. $_->amount : $_->percent. '%' + } + ] + } + @discounts + : () + ), ]; # $plan_labels{$part_pkg->plan}.'
'.