X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=3c3016ba2a225f3dcef0af2859ac6a37af3f7f54;hb=9a98d39e3ce40c1f2c324991e8ad469271093fb5;hp=e226ce13e9560b853e04ae51c2d35a41bacb737d;hpb=09d3b99715ac707d64b1a06d8a2432b76ddb173d;p=freeside.git diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index e226ce13e..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 = " @@ -195,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; [ [ @@ -238,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}.'
'.