summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-07-03 03:05:10 -0700
committerIvan Kohler <ivan@freeside.biz>2012-07-03 03:05:10 -0700
commit64948ee373a03fa156ebc89cb39adfa6d4d2c3d5 (patch)
tree73083b24d7ad9a8fe8de404ef071ea5a3b6fc5f6 /httemplate
parentf619b706a2b375b5ef29fa3664eb3da90bb90ef5 (diff)
add advertising source to sales/credits/receipts summary, RT#18349
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/graph/money_time.cgi31
-rw-r--r--httemplate/graph/report_money_time.html7
-rwxr-xr-xhttemplate/search/cust_bill.html4
-rw-r--r--httemplate/search/cust_bill_pay.html7
-rwxr-xr-xhttemplate/search/cust_credit.html7
-rw-r--r--httemplate/search/cust_credit_bill.html7
-rw-r--r--httemplate/search/cust_credit_refund.html7
-rwxr-xr-xhttemplate/search/elements/cust_pay_or_refund.html7
8 files changed, 67 insertions, 10 deletions
diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi
index cde71be76..166735fc6 100644
--- a/httemplate/graph/money_time.cgi
+++ b/httemplate/graph/money_time.cgi
@@ -1,5 +1,5 @@
<% include('elements/monthly.html',
- 'title' => $agentname.
+ 'title' => $agentname. $referralname.
'Sales, Credits and Receipts Summary',
'items' => \@items,
'labels' => \%label,
@@ -7,6 +7,7 @@
'colors' => \%color,
'links' => \%link,
'agentnum' => $agentnum,
+ 'refnum' => $refnum,
'nototal' => scalar($cgi->param('12mo')),
)
%>
@@ -22,9 +23,17 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$agent = qsearchs('agent', { 'agentnum' => $agentnum } );
die "agentnum $agentnum not found!" unless $agent;
}
-
my $agentname = $agent ? $agent->agent.' ' : '';
+my( $refnum, $part_referral ) = ('', '');
+if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ $refnum = $1;
+ $part_referral = qsearchs('part_referral', { 'refnum' => $refnum } );
+ die "refnum $refnum not found!" unless $part_referral;
+}
+my $referralname = $part_referral ? $part_referral->referral.' ' : '';
+
+
my @items = qw( invoiced netsales
credits netcredits
payments receipts
@@ -83,15 +92,17 @@ my %color = (
$color{$_.'_12mo'} = $color{$_}
foreach keys %color;
+my $ar = "agentnum=$agentnum;refnum=$refnum";
+
my %link = (
- 'invoiced' => "${p}search/cust_bill.html?agentnum=$agentnum;",
- 'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
- 'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
- 'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
- 'payments' => "${p}search/cust_pay.html?magic=_date;agentnum=$agentnum;",
- 'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
- 'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
- 'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",
+ 'invoiced' => "${p}search/cust_bill.html?$ar;",
+ 'netsales' => "${p}search/cust_bill.html?$ar;net=1;",
+ 'credits' => "${p}search/cust_credit.html?$ar;",
+ 'netcredits' => "${p}search/cust_credit_bill.html?$ar;",
+ 'payments' => "${p}search/cust_pay.html?magic=_date;$ar;",
+ 'receipts' => "${p}search/cust_bill_pay.html?$ar;",
+ 'refunds' => "${p}search/cust_refund.html?magic=_date;$ar;",
+ 'netrefunds' => "${p}search/cust_credit_refund.html?$ar;",
);
# XXX link 12mo?
diff --git a/httemplate/graph/report_money_time.html b/httemplate/graph/report_money_time.html
index b85bb6552..97876c996 100644
--- a/httemplate/graph/report_money_time.html
+++ b/httemplate/graph/report_money_time.html
@@ -24,6 +24,13 @@
)
%>
+<% include('/elements/tr-select-part_referral.html',
+ 'label' => 'Advertising source ',
+ 'disable_empty' => 0,
+ 'empty_label' => 'all',
+ )
+%>
+
<TR>
<TD ALIGN="right"><INPUT TYPE="checkbox" NAME="12mo" VALUE="1"></TD>
<TD>Show 12 month totals instead of monthly values</TD>
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 813f9b843..406486a85 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -93,6 +93,10 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
$search{'agentnum'} = $1;
}
+ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ $search{'refnum'} = $1;
+ }
+
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 1fc8ffd78..22e9a6795 100644
--- a/httemplate/search/cust_bill_pay.html
+++ b/httemplate/search/cust_bill_pay.html
@@ -92,6 +92,13 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$title = $agent->agent. " $title";
}
+if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+}
+
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_credit.html b/httemplate/search/cust_credit.html
index 917257034..38f03491d 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -96,6 +96,13 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$title = $agent->agent. " $title";
}
+if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+}
+
if ( $unapplied ) {
push @search, FS::cust_credit->unapplied_sql . ' > 0';
}
diff --git a/httemplate/search/cust_credit_bill.html b/httemplate/search/cust_credit_bill.html
index 7f9eb7887..9fd6a987a 100644
--- a/httemplate/search/cust_credit_bill.html
+++ b/httemplate/search/cust_credit_bill.html
@@ -85,6 +85,13 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$title = $agent->agent. " $title";
}
+if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+}
+
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_credit_refund.html b/httemplate/search/cust_credit_refund.html
index fd87aa575..361c8ad2f 100644
--- a/httemplate/search/cust_credit_refund.html
+++ b/httemplate/search/cust_credit_refund.html
@@ -78,6 +78,13 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$title = $agent->agent. " $title";
}
+if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+}
+
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/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index 002b1a4c2..dc3cb2a99 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -232,6 +232,13 @@ if ( $cgi->param('magic') ) {
$title = $agent->agent. " $title";
}
+ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+ }
+
if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
push @search, "custnum = $1";
}