summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authormark <mark>2010-04-08 01:15:26 +0000
committermark <mark>2010-04-08 01:15:26 +0000
commit8a10cadd86e9c721fd6f81e2e28b4d0ccfd0d8da (patch)
tree4f4a082dd5bfa4badb9f5df98607fbd8affd9287 /httemplate
parent8b2b3f00e7c857de3a9bab764c415478acc83e27 (diff)
RT#1382: beginning of package cost report
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/menu.html1
-rw-r--r--httemplate/graph/cust_pkg_cost.cgi61
-rw-r--r--httemplate/graph/report_cust_pkg_cost.html26
-rwxr-xr-xhttemplate/search/cust_pkg.cgi2
4 files changed, 89 insertions, 1 deletions
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index db5befc8a..bb219bdd4 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -266,6 +266,7 @@ if($curuser->access_right('Financial reports')) {
'Employee Commission Report' => [ $fsurl.'search/report_employee_commission.html', '' ],
'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
'Refund Report' => [ $fsurl.'search/report_cust_refund.html', 'Refund report (by type and/or date range)' ],
+ 'Package Costs Report' => [ $fsurl.'graph/report_cust_pkg_cost.html', 'Package setup and recurring costs graph' ],
);
$report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ];
$report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ];
diff --git a/httemplate/graph/cust_pkg_cost.cgi b/httemplate/graph/cust_pkg_cost.cgi
new file mode 100644
index 000000000..0aa7e3262
--- /dev/null
+++ b/httemplate/graph/cust_pkg_cost.cgi
@@ -0,0 +1,61 @@
+<% include('elements/monthly.html',
+ 'title' => $agentname.
+ 'Package Costs Report',
+ 'graph_type' => 'Lines',
+ 'items' => \@items,
+ 'labels' => \%label,
+ 'graph_labels' => \%label,
+ 'colors' => \%color,
+ 'links' => \%link,
+ 'agentnum' => $agentnum,
+ 'nototal' => scalar($cgi->param('12mo')),
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
+#XXX or virtual
+my( $agentnum, $agent ) = ('', '');
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ $agentnum = $1;
+ $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+ die "agentnum $agentnum not found!" unless $agent;
+}
+
+my $agentname = $agent ? $agent->agent.' ' : '';
+
+my @items = qw( cust_pkg_setup_cost cust_pkg_recur_cost );
+if ( $cgi->param('12mo') == 1 ) {
+ @items = map $_.'_12mo', @items;
+}
+
+my %label = (
+ 'cust_pkg_setup_cost' => 'Setup Costs',
+ 'cust_pkg_recur_cost' => 'Recurring Costs',
+);
+
+$label{$_.'_12mo'} = $label{$_}. " (prev 12 months)"
+ foreach keys %label;
+
+my %color = (
+ 'cust_pkg_setup_cost' => '0000cc',
+ 'cust_pkg_recur_cost' => '00cc00',
+);
+$color{$_.'_12mo'} = $color{$_}
+ foreach keys %color;
+
+my %link = (
+ 'cust_pkg_setup_cost' => { 'link' => "${p}search/cust_pkg.cgi?agentnum=$agentnum;",
+ 'fromparam' => 'setup_begin',
+ 'toparam' => 'setup_end',
+ },
+ 'cust_pkg_recur_cost' => { 'link' => "${p}search/cust_pkg.cgi?agentnum=$agentnum;",
+ 'fromparam' => 'active_begin',
+ 'toparam' => 'active_end',
+ },
+);
+# XXX link 12mo?
+
+</%init>
diff --git a/httemplate/graph/report_cust_pkg_cost.html b/httemplate/graph/report_cust_pkg_cost.html
new file mode 100644
index 000000000..553db096b
--- /dev/null
+++ b/httemplate/graph/report_cust_pkg_cost.html
@@ -0,0 +1,26 @@
+<% include('/elements/header.html', 'Package Costs Report' ) %>
+
+<FORM ACTION="cust_pkg_cost.cgi" METHOD="GET">
+
+<TABLE>
+
+<% include('/elements/tr-select-from_to.html' ) %>
+
+<% include('/elements/tr-select-agent.html',
+ 'label' => 'For agent: ',
+ 'disable_empty' => 0,
+ )
+%>
+
+</TABLE>
+
+<BR><INPUT TYPE="submit" VALUE="Display">
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
+</%init>
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 83cd206cb..adbec7a74 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -192,7 +192,7 @@ my %disable = (
'' => {},
);
-foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
+foreach my $field (qw( setup last_bill bill adjourn susp expire cancel active )) {
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);