summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-12-31 14:03:43 -0800
committerMark Wells <mark@freeside.biz>2012-12-31 14:03:43 -0800
commitc7286ce9036d71665c2bfed9de93f87309b72d35 (patch)
tree59ef48f8fd7688cf7039a0d2e5500b84ae076543 /httemplate
parenta14db43cc4ec18badd0aff4fbc3e6738f4f63f6c (diff)
filter by customer class on all financial reports, #20573
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/graph/cust_bill_pkg.cgi8
-rw-r--r--httemplate/graph/elements/monthly.html2
-rw-r--r--httemplate/graph/money_time.cgi7
-rw-r--r--httemplate/graph/money_time_daily.cgi6
-rw-r--r--httemplate/graph/report_cust_bill_pkg.html6
-rw-r--r--httemplate/graph/report_money_time.html5
-rw-r--r--httemplate/graph/report_money_time_daily.html5
-rwxr-xr-xhttemplate/search/cust_bill.html4
-rw-r--r--httemplate/search/cust_bill_pay.html7
-rw-r--r--httemplate/search/cust_bill_pkg.cgi9
-rw-r--r--httemplate/search/cust_bill_pkg_referral.html5
-rwxr-xr-xhttemplate/search/cust_credit.html6
-rw-r--r--httemplate/search/cust_credit_refund.html7
-rw-r--r--httemplate/search/customer_accounting_summary.html15
-rwxr-xr-xhttemplate/search/elements/cust_pay_or_refund.html6
-rw-r--r--httemplate/search/prepaid_income.html7
-rw-r--r--httemplate/search/report_cust_bill_pkg.html5
-rw-r--r--httemplate/search/report_cust_bill_pkg_referral.html5
-rwxr-xr-xhttemplate/search/report_customer_accounting_summary.html6
-rw-r--r--httemplate/search/report_prepaid_income.html2
-rw-r--r--httemplate/search/unearned_detail.html9
21 files changed, 126 insertions, 6 deletions
diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi
index c334ae9e7..91bedf3fe 100644
--- a/httemplate/graph/cust_bill_pkg.cgi
+++ b/httemplate/graph/cust_bill_pkg.cgi
@@ -13,6 +13,7 @@
'bottom_total' => 1,
'bottom_link' => $bottom_link,
'agentnum' => $agentnum,
+ 'cust_classnum'=> \@cust_classnums,
)
%>
<%init>
@@ -68,6 +69,9 @@ $title .= $sel_part_referral->referral.' '
$title .= 'Sales Report (Gross)';
$title .= ', average per customer package' if $average_per_cust_pkg;
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+$bottom_link .= "cust_classnum=$_;" foreach @cust_classnums;
+
#classnum (here)
# 0: all classes
# not specified: empty class
@@ -188,6 +192,7 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
push @links, "$link;".
($all_agent ? '' : "agentnum=$row_agentnum;").
($all_part_referral ? '' : "refnum=$row_refnum;").
+ (join('',map {"cust_classnum=$_;"} @cust_classnums)).
($all_class ? '' : "classnum=$row_classnum;").
"distribute=$distribute;".
"use_override=$use_override;charges=$component;";
@@ -209,6 +214,7 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
my $component = join('', @components);
my @row_params = ( 'agentnum' => $row_agentnum,
+ 'cust_classnum' => \@cust_classnums,
'use_override' => $use_override,
'average_per_cust_pkg' => $average_per_cust_pkg,
'distribute' => $distribute,
@@ -231,6 +237,8 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
$row_link .= ";refnum=".$sel_part_referral->refnum;
}
+ $row_link .= ";cust_classnum=$_" foreach @cust_classnums;
+
push @items, 'cust_bill_pkg';
push @labels, mt('[_1] - Subtotal', $agent->agent);
push @params, \@row_params;
diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html
index c736de696..939f18a35 100644
--- a/httemplate/graph/elements/monthly.html
+++ b/httemplate/graph/elements/monthly.html
@@ -37,6 +37,7 @@ Example:
#optional
'agentnum' => $agentnum,
'refnum' => $refnum,
+ 'cust_classnum' => \@classnums,
'nototal' => 1,
'graph_type' => 'LinesPoints',
'remove_empty' => 1,
@@ -121,6 +122,7 @@ my %reportopts = (
'projection' => $opt{'projection'},
'agentnum' => $opt{'agentnum'},
'refnum' => $opt{'refnum'},
+ 'cust_classnum'=> $opt{'cust_classnum'},
'remove_empty' => $opt{'remove_empty'},
'doublemonths' => $opt{'doublemonths'},
);
diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi
index 166735fc6..9071fc7b9 100644
--- a/httemplate/graph/money_time.cgi
+++ b/httemplate/graph/money_time.cgi
@@ -8,6 +8,7 @@
'links' => \%link,
'agentnum' => $agentnum,
'refnum' => $refnum,
+ 'cust_classnum'=> \@classnums,
'nototal' => scalar($cgi->param('12mo')),
)
%>
@@ -25,6 +26,11 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
}
my $agentname = $agent ? $agent->agent.' ' : '';
+my @classnums;
+if ( $cgi->param('cust_classnum') ) {
+ @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+}
+
my( $refnum, $part_referral ) = ('', '');
if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
$refnum = $1;
@@ -93,6 +99,7 @@ $color{$_.'_12mo'} = $color{$_}
foreach keys %color;
my $ar = "agentnum=$agentnum;refnum=$refnum";
+$ar .= ";cust_classnum=$_" foreach @classnums;
my %link = (
'invoiced' => "${p}search/cust_bill.html?$ar;",
diff --git a/httemplate/graph/money_time_daily.cgi b/httemplate/graph/money_time_daily.cgi
index 4d16ff871..0fdbd895e 100644
--- a/httemplate/graph/money_time_daily.cgi
+++ b/httemplate/graph/money_time_daily.cgi
@@ -7,6 +7,7 @@
'colors' => \%color,
'links' => \%link,
'agentnum' => $agentnum,
+ 'cust_classnum'=> \@classnums,
'nototal' => scalar($cgi->param('12mo')),
'daily' => 1,
'start_day' => $smday,
@@ -32,6 +33,11 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
my $agentname = $agent ? $agent->agent.' ' : '';
+my @classnums;
+if ( $cgi->param('cust_classnum') ) {
+ @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+}
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
my ($ssec,$smin,$shour,$smday,$smon,$syear,$swday,$syday,$sisdst)
= localtime($beginning);
diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html
index 31792e8dd..251e7d36e 100644
--- a/httemplate/graph/report_cust_bill_pkg.html
+++ b/httemplate/graph/report_cust_bill_pkg.html
@@ -34,6 +34,12 @@ function enable_agent_totals(obj) {
'onchange' => 'enable_agent_totals',
&>
+<& /elements/tr-select-cust_class.html,
+ 'field' => 'cust_classnum',
+ 'label' => 'Customer class',
+ 'multiple' => 1,
+&>
+
<& /elements/tr-select-part_referral.html,
'field' => 'refnum',
'label' => 'Advertising source ',
diff --git a/httemplate/graph/report_money_time.html b/httemplate/graph/report_money_time.html
index 97876c996..315d31bc5 100644
--- a/httemplate/graph/report_money_time.html
+++ b/httemplate/graph/report_money_time.html
@@ -24,6 +24,11 @@
)
%>
+<& /elements/tr-select-cust_class.html,
+ 'field' => 'cust_classnum', # to avoid ambiguity in FS::Report::Table
+ 'multiple' => 1
+&>
+
<% include('/elements/tr-select-part_referral.html',
'label' => 'Advertising source ',
'disable_empty' => 0,
diff --git a/httemplate/graph/report_money_time_daily.html b/httemplate/graph/report_money_time_daily.html
index 8328199c7..a436d0879 100644
--- a/httemplate/graph/report_money_time_daily.html
+++ b/httemplate/graph/report_money_time_daily.html
@@ -17,6 +17,11 @@
)
%>
+<& /elements/tr-select-cust_class.html,
+ 'field' => 'cust_classnum',
+ 'multiple' => 1,
+&>
+
</TABLE>
<BR><INPUT TYPE="submit" VALUE="Display">
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 406486a85..3c0530e4f 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -97,6 +97,10 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
$search{'refnum'} = $1;
}
+ if ( $cgi->param('cust_classnum') ) {
+ $search{'cust_classnum'} = [ $cgi->param('cust_classnum') ];
+ }
+
if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
$search{'custnum'} = $1;
}
diff --git a/httemplate/search/cust_bill_pay.html b/httemplate/search/cust_bill_pay.html
index 22e9a6795..79de74985 100644
--- a/httemplate/search/cust_bill_pay.html
+++ b/httemplate/search/cust_bill_pay.html
@@ -99,6 +99,13 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
$title = $part_referral->referral. " $title";
}
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @search, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @search, "cust_bill._date >= $beginning ",
"cust_bill._date <= $ending";
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index 11a5095b4..42722b1a7 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -120,6 +120,8 @@ Filtering parameters:
- refnum: Filter on customer reference source.
+- cust_classnum: Filter on customer class.
+
- classnum: Filter on package class.
- use_override: Apply "classnum" and "taxclass" filtering based on the
@@ -258,6 +260,13 @@ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.refnum = $1";
}
+# cust_classnum
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @where, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
# custnum
if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.custnum = $1";
diff --git a/httemplate/search/cust_bill_pkg_referral.html b/httemplate/search/cust_bill_pkg_referral.html
index 77b486021..1289ff7ee 100644
--- a/httemplate/search/cust_bill_pkg_referral.html
+++ b/httemplate/search/cust_bill_pkg_referral.html
@@ -156,6 +156,11 @@ if ( @refnum ) {
push @where, 'cust_main.refnum IN ('.join(',', @refnum).')';
}
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+if ( @cust_classnums ) {
+ push @where, 'cust_main.classnum IN ('.join(',', @cust_classnums).')';
+}
+
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 38f03491d..f5d8fa19f 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -103,6 +103,12 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
$title = $part_referral->referral. " $title";
}
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @search, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
if ( $unapplied ) {
push @search, FS::cust_credit->unapplied_sql . ' > 0';
}
diff --git a/httemplate/search/cust_credit_refund.html b/httemplate/search/cust_credit_refund.html
index 361c8ad2f..75138e99d 100644
--- a/httemplate/search/cust_credit_refund.html
+++ b/httemplate/search/cust_credit_refund.html
@@ -85,6 +85,13 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
$title = $part_referral->referral. " $title";
}
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @search, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @search, "cust_credit._date >= $beginning ",
"cust_credit._date <= $ending";
diff --git a/httemplate/search/customer_accounting_summary.html b/httemplate/search/customer_accounting_summary.html
index 0e9e24fa6..12c896276 100644
--- a/httemplate/search/customer_accounting_summary.html
+++ b/httemplate/search/customer_accounting_summary.html
@@ -142,8 +142,7 @@ $title .= $sel_part_referral->referral.' '
$title .= 'Customer Accounting Summary Report';
-my @custs = ();
-@custs = qsearch('cust_main', {} );
+my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
my @items = ('netsales', 'cashflow');
my @params = ( [], [] );
@@ -167,6 +166,18 @@ my @custnames = ();
my $status = $cgi->param('status');
die "invalid status" unless $status =~ /^\w+|$/;
+my %search_hash;
+foreach (qw(agentnum refnum status)) {
+ if ( defined $cgi->param($_) ) {
+ $search_hash{$_} = $cgi->param($_);
+ }
+}
+$search_hash{'classnum'} = [ $cgi->param('cust_classnum') ]
+ if $cgi->param('cust_classnum');
+
+my $query = FS::cust_main::Search->search(\%search_hash);
+my @custs = qsearch($query);
+
foreach my $cust_main ( @custs ) {
# XXX should do this in the qsearch
next unless ($status eq '' || $status eq $cust_main->status);
diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index c60411107..b0524913a 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -239,6 +239,12 @@ if ( $cgi->param('magic') ) {
$title = $part_referral->referral. " $title";
}
+ if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @search, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+ }
+
if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
push @search, "custnum = $1";
}
diff --git a/httemplate/search/prepaid_income.html b/httemplate/search/prepaid_income.html
index ebac5a2a9..03d121d70 100644
--- a/httemplate/search/prepaid_income.html
+++ b/httemplate/search/prepaid_income.html
@@ -129,6 +129,13 @@ if ( $cgi->param('status') =~ /^([a-z]+)$/ ) {
push @where, FS::cust_main->cust_status_sql . " = '$status'";
}
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ $link .= ";cust_classnum=$_" foreach @classnums;
+ push @where, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
my %total = ();
my %total_legacy = ();
foreach my $agentnum (@agentnums) {
diff --git a/httemplate/search/report_cust_bill_pkg.html b/httemplate/search/report_cust_bill_pkg.html
index 4f6ee78db..f121ef49f 100644
--- a/httemplate/search/report_cust_bill_pkg.html
+++ b/httemplate/search/report_cust_bill_pkg.html
@@ -15,14 +15,13 @@
label => emt('Customer status'),
&>
-<!-- customer
<& /elements/tr-select-cust_class.html,
- 'label' => emt('Class'),
+ 'label' => emt('Customer class'),
+ 'field' => 'cust_classnum',
'multiple' => 1,
'pre_options' => [ '' => emt('(none)') ],
'all_selected' => 1,
&>
--->
<& /elements/tr-input-beginning_ending.html &>
diff --git a/httemplate/search/report_cust_bill_pkg_referral.html b/httemplate/search/report_cust_bill_pkg_referral.html
index b4716d4fc..47478aa42 100644
--- a/httemplate/search/report_cust_bill_pkg_referral.html
+++ b/httemplate/search/report_cust_bill_pkg_referral.html
@@ -23,6 +23,11 @@
'disable_empty' => 1,
&>
+<& /elements/tr-select-cust_class.html,
+ 'field' => 'cust_classnum',
+ 'multiple' => 1,
+&>
+
<& /elements/tr-select-pkg_class.html,
'pre_options' => [ '' => 'all', '0' => '(empty class)' ],
'disable_empty' => 1,
diff --git a/httemplate/search/report_customer_accounting_summary.html b/httemplate/search/report_customer_accounting_summary.html
index 537abffeb..8206f34ca 100755
--- a/httemplate/search/report_customer_accounting_summary.html
+++ b/httemplate/search/report_customer_accounting_summary.html
@@ -25,6 +25,12 @@
'label' => 'Customer Status'
) %>
+ <& /elements/tr-select-cust_class.html,
+ 'label' => 'Customer Class',
+ 'field' => 'cust_classnum',
+ 'multiple' => 1,
+ &>
+
<& /elements/tr-checkbox.html,
'label' => 'Separate setup fees',
'field' => 'setuprecur',
diff --git a/httemplate/search/report_prepaid_income.html b/httemplate/search/report_prepaid_income.html
index 4743e2d21..dfb2ea249 100644
--- a/httemplate/search/report_prepaid_income.html
+++ b/httemplate/search/report_prepaid_income.html
@@ -33,6 +33,8 @@
<& /elements/tr-select-cust_main-status.html,
label => mt('Customer Status') &>
+ <& /elements/tr-select-cust_class.html,
+ label => mt('Customer Class'), field => 'cust_classnum', multiple => 1 &>
<& /elements/tr-select.html,
label => 'Invoice Status',
field => 'mode',
diff --git a/httemplate/search/unearned_detail.html b/httemplate/search/unearned_detail.html
index 02d514cbe..f61de052e 100644
--- a/httemplate/search/unearned_detail.html
+++ b/httemplate/search/unearned_detail.html
@@ -118,6 +118,12 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @where, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
# no pkgclass, no taxclass, no tax location...
# unearned revenue mode
@@ -235,7 +241,8 @@ my $query = {
my $ilink = [ "${p}view/cust_bill.cgi?", 'invnum' ];
my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
-my $money_char;
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
sub money_sub {
$conf ||= new FS::Conf;