summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorlevinse <levinse>2010-12-30 23:03:50 +0000
committerlevinse <levinse>2010-12-30 23:03:50 +0000
commit807f0570749e9093cbc82f6b11b3fa743b86b1db (patch)
tree6250b5ecc5b13da221afb266a4d467daa6397982 /httemplate/search
parent062179900d1fbdfd6831d07cb5e5f290a6512f4c (diff)
add customer accounting summary report, RT10911
Diffstat (limited to 'httemplate/search')
-rw-r--r--httemplate/search/customer_accounting_summary.html59
-rwxr-xr-xhttemplate/search/report_customer_accounting_summary.html33
2 files changed, 92 insertions, 0 deletions
diff --git a/httemplate/search/customer_accounting_summary.html b/httemplate/search/customer_accounting_summary.html
new file mode 100644
index 000000000..8da8914c8
--- /dev/null
+++ b/httemplate/search/customer_accounting_summary.html
@@ -0,0 +1,59 @@
+<% include('/graph/elements/monthly.html',
+ #Dumper(
+ 'title' => $title,
+ 'graph_type' => 'none',
+ 'items' => \@items,
+ 'params' => \@params,
+ 'labels' => \@labels,
+ 'graph_labels' => \@labels,
+ 'remove_empty' => 1,
+ 'bottom_total' => 1,
+ 'agentnum' => $agentnum,
+ 'doublemonths' => \@doublemonths,
+ 'nototal' => 1,
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
+my @doublemonths = ( 'Billed', 'Paid' );
+
+my ($agentnum,$sel_agent);
+if ( $cgi->param('agentnum') eq 'all' ) {
+ $agentnum = 0;
+}
+elsif ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ $agentnum = $1;
+ $sel_agent = qsearchs('agent', { 'agentnum' => $agentnum } );
+ die "agentnum $agentnum not found!" unless $sel_agent;
+}
+my $title = $sel_agent ? $sel_agent->agent.' ' : '';
+$title .= 'Customer Accounting Summary Report';
+
+my @custs = ();
+@custs = qsearch('cust_main', {} );
+
+my @items = ();
+my @params = ();
+my @labels = ();
+
+my $status = $cgi->param('status');
+die "invalid status" unless $status =~ /^\w+|$/;
+
+foreach my $cust_main ( @custs ) {
+ next unless ($status eq '' || $status eq $cust_main->status);
+ next unless ($agentnum == 0 || $cust_main->agentnum eq $agentnum);
+
+ push @items, 'netsales', 'cashflow';
+
+ push @labels, $cust_main->name;
+
+ push @params, [ ('custnum' => $cust_main->custnum),
+ ],
+ [ ('custnum' => $cust_main->custnum),
+ ];
+}
+
+</%init>
diff --git a/httemplate/search/report_customer_accounting_summary.html b/httemplate/search/report_customer_accounting_summary.html
new file mode 100755
index 000000000..d20f756c8
--- /dev/null
+++ b/httemplate/search/report_customer_accounting_summary.html
@@ -0,0 +1,33 @@
+<% include('/elements/header.html', 'Customer Accounting Summary Report' ) %>
+
+<FORM ACTION="customer_accounting_summary.html" METHOD="GET">
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <% include( '/elements/tr-select-agent.html',
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'label' => 'Agent ',
+ 'disable_empty' => 0,
+ )
+ %>
+
+ <% include('/elements/tr-select-from_to.html' ) %>
+
+ <% include( '/elements/tr-select-cust_main-status.html',
+ 'label' => 'Customer Status'
+ ) %>
+
+ </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
+</%init>