summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-08-30 12:24:36 -0700
committerMark Wells <mark@freeside.biz>2016-08-30 12:25:50 -0700
commit92be841652923a8817bbadb37f26847764d923dd (patch)
treede72deaba5b60dec47b012beaab9b5634b85bb1b /httemplate/search
parent72e8c3cf0a7289402708742a82d7aff74f93055d (diff)
add agent and cust-fields selection to package contract end date report, #71964
Diffstat (limited to 'httemplate/search')
-rw-r--r--httemplate/search/cust_pkg-date.html34
-rwxr-xr-xhttemplate/search/report_cust_pkg-date.html38
2 files changed, 59 insertions, 13 deletions
diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html
index 5bb772bf6..231bbac16 100644
--- a/httemplate/search/cust_pkg-date.html
+++ b/httemplate/search/cust_pkg-date.html
@@ -1,3 +1,16 @@
+<& elements/search.html,
+ 'title' => $title,
+ 'name' => 'packages',
+ 'query' => $query,
+ 'count_query' => $count_query,
+ 'header' => \@header,
+ 'fields' => \@fields,
+ 'align' => 'rrrl'. FS::UI::Web::cust_aligns(),
+ 'color' => \@color,
+ 'style' => \@style,
+ 'links' => \@links,
+ 'cell_style' => [ $date_color_sub ],
+&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
die 'access denied' unless $curuser->access_right('List packages');
@@ -18,8 +31,7 @@ my $col = $cgi->param('date');
die "invalid date column" unless $cols{$col};
my $title = 'Packages by ' . lc($cols{$col}) . ' date';
-# second option on the cust_fields_avail list, plus email
-my $cust_fields = 'Cust# | Customer | Day phone | Night phone | Mobile phone | Invoicing email(s)';
+my $cust_fields = $cgi->param('cust_fields');
my @header = ( $cols{$col},
emt('#'),
emt('Quan.'),
@@ -32,11 +44,18 @@ my @fields = ( sub { time2str('%b %d %Y', $_[0]->$col) },
'pkg_label',
);
my @sort_fields = ( map '', @fields ); # should only ever sort by $col
+my @color = ( map '', @fields );
+my @style = ( map '', @fields );
push @header, FS::UI::Web::cust_header($cust_fields);
push @fields, \&FS::UI::Web::cust_fields;
+push @color, FS::UI::Web::cust_colors();
+push @style, FS::UI::Web::cust_styles();
my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main');
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
+ $agentnums_sql .= " AND agentnum = $1";
+}
my $query = {
'table' => 'cust_pkg',
@@ -80,15 +99,4 @@ my $date_color_sub = sub {
};
</%init>
-<& elements/search.html,
- 'title' => $title,
- 'name' => 'packages',
- 'query' => $query,
- 'count_query' => $count_query,
- 'header' => \@header,
- 'fields' => \@fields,
- 'align' => 'rrrl'. FS::UI::Web::cust_aligns(),
- 'links' => \@links,
- 'cell_style' => [ $date_color_sub ],
-&>
diff --git a/httemplate/search/report_cust_pkg-date.html b/httemplate/search/report_cust_pkg-date.html
new file mode 100755
index 000000000..ceb9a9c75
--- /dev/null
+++ b/httemplate/search/report_cust_pkg-date.html
@@ -0,0 +1,38 @@
+<& /elements/header.html, mt($title) &>
+
+<FORM ACTION="cust_pkg-date.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="date" VALUE="<% $col %>">
+
+<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <& /elements/tr-select-agent.html,
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'disable_empty' => 0,
+ &>
+
+ <& /elements/tr-select-cust-fields.html &>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+
+# for the page title
+my %cols = (
+ 'contract_end' => 'Contract end'
+);
+
+# or let the column be selected here?
+my $col = $cgi->param('date');
+die "invalid date column" unless $cols{$col};
+my $title = 'Packages by ' . lc($cols{$col}) . ' date';
+
+</%init>