diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/search/cust_main_credit_limit.html | 63 | ||||
-rw-r--r-- | httemplate/search/report_cust_main_credit_limit.html | 24 | ||||
-rw-r--r-- | httemplate/view/cust_main/billing.html | 3 |
3 files changed, 90 insertions, 0 deletions
diff --git a/httemplate/search/cust_main_credit_limit.html b/httemplate/search/cust_main_credit_limit.html new file mode 100644 index 000000000..b2a0c9bc4 --- /dev/null +++ b/httemplate/search/cust_main_credit_limit.html @@ -0,0 +1,63 @@ +<& elements/search.html, + 'title' => 'Credit limit incidents', + 'name_singular' => 'incident', + 'query' => { table => 'cust_main_credit_limit', + hashref => \%hash, + extra_sql => " AND $dates_sql ", + order_by => 'ORDER BY _date ASC', + }, + 'count_query' => "SELECT COUNT(*) FROM cust_main_credit_limit", + 'header' => [ 'Date', + + #XXX should use cust_fields etc. + '#', + 'Customer', + + 'Amount', + 'Limit', + ], + 'fields' => [ sub { time2str($date_format, shift->_date); }, + + #XXX should use cust_fields etc. + sub { shift->cust_main->display_custnum }, + sub { shift->cust_main->name }, + + sub { $money_char. shift->amount }, + sub { $money_char. shift->credit_limit }, + ], + + 'links' => [ '', + + #XXX should use cust_fields etc. + $cust_link, + $cust_link, + + '', + '', + ], +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List rating data'); + +my $conf = new FS::Conf; + +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my $money_char = $conf->config('money_char') || '$'; + +my $cust_link = [ "${p}view/cust_main.cgi?", 'custnum' ]; + +my ($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi); +my $dates_sql = "_date >= $begin AND _date < $end"; + +my $count_query= "SELECT COUNT(*) FROM cust_main_credit_limit WHERE $dates_sql"; + +my %hash = (); +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $hash{custnum} = $1; + $count_query .= " AND custnum = $1"; +} + +</%init> diff --git a/httemplate/search/report_cust_main_credit_limit.html b/httemplate/search/report_cust_main_credit_limit.html new file mode 100644 index 000000000..8503fb396 --- /dev/null +++ b/httemplate/search/report_cust_main_credit_limit.html @@ -0,0 +1,24 @@ +<& /elements/header.html, 'Credit limit incidents' &> + +<FORM ACTION="cust_main_credit_limit.html" METHOD="GET"> + +<TABLE BGCOLOR="#cccccc" CELLSPACING=0> + +<& /elements/tr-search-cust_main.html, 'label' => 'Customer' &> + +<TR><TD></TD><TD><FONT SIZE="-1">(leave blank for all customers)</FONT></TD></TR> + +<& /elements/tr-input-beginning_ending.html &> + +</TABLE> + +<BR> +<INPUT TYPE="submit" VALUE="Get Report"> + +<& /elements/footer.html &> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List rating data'); + +</%init> diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 749004d84..debc7a947 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -273,6 +273,9 @@ ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). ")" : emt('Unlimited') %> +% if ( $cust_main->num_cust_main_credit_limit ) { + <A HREF="<% $p %>search/cust_main_credit_limit.html?custnum=<% $cust_main->custnum %>">(incidents)</A> +% } </TD> </TR> |