X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=63822c7c9b30c48bdb1abcdbb9f5547f2b7d791d;hb=61a098f3c2902a046a585d2b02f7e2c8494e7a83;hp=b07386618ab1f70265252760485e6f4702cd887c;hpb=4427ad71b12bf27eac2a05d88141a82f9372d03f;p=freeside.git
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index b07386618..63822c7c9 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -10,7 +10,7 @@
'agent_virt' => 1,
'agent_null_right' => [ $edit, $edit_global ],
'agent_null_right_link' => $edit_global,
- 'agent_pos' => 6,
+ 'agent_pos' => 7, #5?
'query' => { 'select' => $select,
'table' => 'part_pkg',
'hashref' => \%hash,
@@ -128,8 +128,15 @@ $select = "
( $count_cust_pkg
AND ( cancel IS NULL OR cancel = 0 )
AND susp IS NOT NULL AND susp != 0
+ AND setup IS NOT NULL AND setup != 0
) AS num_suspended,
+ ( $count_cust_pkg
+ AND ( cancel IS NULL OR cancel = 0 )
+ AND susp IS NOT NULL AND susp != 0
+ AND ( setup IS NULL OR setup = 0 )
+ ) AS num_on_hold,
+
( $count_cust_pkg
AND cancel IS NOT NULL AND cancel != 0
) AS num_cancelled
@@ -278,9 +285,8 @@ push @fields, sub {
),
],
(
- map { my $amount = $_->amount
- / (FS::part_pkg_usageprice->targets->{$_->target}{multiplier}||1);
- my $label = FS::part_pkg_usageprice->targets->{$_->target}{label};
+ map { my $amount = $_->amount / ($_->target_info->{multiplier} || 1);
+ my $label = $_->target_info->{label};
[
{ data => "Plus $money_char". $_->price. ' '.
( $_->action eq 'increment' ? 'per' : 'for' ).
@@ -348,6 +354,51 @@ push @fields, sub {
# $part_pkg->freq_pretty; #.'
'
};
+push @header, 'Cost tracking';
+$align .= 'r'; #?
+push @fields, sub {
+ my $part_pkg = shift;
+ #(my $plan = $plan_labels{$part_pkg->plan} ) =~ s/ / /g;
+ my $is_recur = ( $part_pkg->freq ne '0' );
+
+ [
+ [
+ { data => ' ', # $plan,
+ align=>'center',
+ colspan=>2,
+ },
+ ],
+ [
+ { data =>$money_char.
+ sprintf('%.2f ', $part_pkg->setup_cost ),
+ align=>'right'
+ },
+ { data => ( $is_recur ? ' setup' : ' one-time' ),
+ align=>'left',
+ },
+ ],
+ [
+ { data=>(
+ $is_recur
+ ? $money_char. sprintf('%.2f', $part_pkg->recur_cost)
+ : '(no recurring)' #$part_pkg->freq_pretty
+ ),
+ align=> ( $is_recur ? 'right' : 'center' ),
+ colspan=> ( $is_recur ? 1 : 2 ),
+ },
+ ( $is_recur
+ ? { data => ( $is_recur
+ ? ' '. $part_pkg->freq_pretty
+ : ''
+ ),
+ align=>'left',
+ }
+ : ()
+ ),
+ ],
+ ];
+};
+
###
# Agent goes here if displayed
###
@@ -383,6 +434,7 @@ if ( $acl_edit_global ) {
#if ( $cgi->param('active') ) {
push @header, 'Customer
packages';
my %col = (
+ 'on hold' => '7E0079', #purple!
'not yet billed' => '009999', #teal? cyan?
'active' => '00CC00',
'suspended' => 'FF9900',
@@ -398,10 +450,11 @@ if ( $acl_edit_global ) {
my $label = $_;
if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
$magic = 'inactive';
- #$label = 'one-time charge',
- $label = 'charge',
+ #$label = 'one-time charge';
+ $label = 'charge';
}
$label= 'not yet billed' if $magic eq 'not_yet_billed';
+ $label= 'on hold' if $magic eq 'on_hold';
[
{
@@ -426,7 +479,7 @@ if ( $acl_edit_global ) {
),
},
],
- } (qw( not_yet_billed active suspended cancelled ))
+ } (qw( on_hold not_yet_billed active suspended cancelled ))
),
($acl_config ?
[ {},