diff options
author | ivan <ivan> | 2009-08-20 04:03:35 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-08-20 04:03:35 +0000 |
commit | 5c35f5323f1cdcf7eabe6632d0352ea417d3047e (patch) | |
tree | c830e60e5648cd1f16454c6bff19f5a3c133a10a /httemplate | |
parent | ed7d3ad7e00fb57f8ded643de5d5217ee64061ad (diff) |
Emailing statements of accounts, RT#4860
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/view/cust_main/payment_history.html | 9 | ||||
-rw-r--r-- | httemplate/view/cust_main/payment_history/statement.html | 34 | ||||
-rwxr-xr-x | httemplate/view/cust_statement.html | 75 |
3 files changed, 118 insertions, 0 deletions
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 24af5c9a5..0050daf9d 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -392,6 +392,15 @@ foreach my $cust_bill ($cust_main->cust_bill) { }; } +#statements +foreach my $cust_statement ($cust_main->cust_statement) { + push @history, { + 'date' => $cust_statement->_date, + 'desc' => include('payment_history/statement.html', $cust_statement, %opt ), + #'charge' => $cust_bill->charged, + }; +} + #payments (some false laziness w/credits) foreach my $cust_pay ($cust_main->cust_pay) { push @history, { diff --git a/httemplate/view/cust_main/payment_history/statement.html b/httemplate/view/cust_main/payment_history/statement.html new file mode 100644 index 000000000..dedec9bda --- /dev/null +++ b/httemplate/view/cust_main/payment_history/statement.html @@ -0,0 +1,34 @@ +<% $link %><% $pre %>Statement #<% $statementnum %> +%# (Balance $ <% $cust_statement->owed %>) +<% $post %><% $link ? '</A>' : '' %><% $events %> +<%init> + +my( $cust_statement, %opt ) = @_; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my($pre, $post) = ('', ''); +#if ( $cust_statement->owed > 0 ) { +# $pre = '<B><FONT SIZE="+1" COLOR="#FF0000">Open '; +# $post = '</FONT></B>'; +#} + +my $statementnum = $cust_statement->statementnum; + +my $link = $curuser->access_right('View invoices') + ? qq!<A HREF="${p}view/cust_statement.html?$statementnum">! + : ''; + +my $events = ''; + +#if ( $cust_statement->num_cust_event +# && ( $curuser->access_right('Billing event reports') +# || $curuser->access_right('View customer billing events') +# ) +# ) { +# $events = +# qq!<BR><FONT SIZE="-1"><A HREF="${p}search/cust_event.html?statementnum=!. +# $cust_statement->statementnum. '">( View statement events )</A></FONT>'; +#} + +</%init> diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html new file mode 100755 index 000000000..ec4ee9ebd --- /dev/null +++ b/httemplate/view/cust_statement.html @@ -0,0 +1,75 @@ +<% include("/elements/header.html",'Statement View', menubar( + "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", +)) %> + +% if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { + + <A HREF="<% $p %>misc/print-invoice.cgi?<% $link %>">Re-print this statement</A> + +% if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) { + | <A HREF="<% $p %>misc/email-invoice.cgi?<% $link %>">Re-email this statement</A> +% } + +% if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { + | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $link %>">Re-fax this statement</A> +% } + + <BR><BR> + +% } + + +% if ( $conf->exists('invoice_latex') ) { + + <A HREF="<% $p %>view/cust_statement-pdf.cgi?<% $link %>.pdf">View typeset statement</A> + <BR><BR> +% } + +% #if ( $cust_statement->num_cust_event ) { +% if ( 0 ) { +<A HREF="<%$p%>search/cust_event.html?statementnum=<% $cust_statement->statementnum %>">( View statement events )</A><BR><BR> +% } + +% if ( $conf->exists('invoice_html') ) { + + <% join('', $cust_statement->print_html('', $templatename) ) %> +% } else { + + <PRE><% join('', $cust_statement->print_text('', $templatename) ) %></PRE> +% } + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint statement +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)$/; +my $templatename = $2; +my $statementnum = $3; + +my $conf = new FS::Conf; + +my @payby = grep /\w/, $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless @payby; +my %payby = map { $_=>1 } @payby; + +my $cust_statement = qsearchs({ + 'select' => 'cust_statement.*', + 'table' => 'cust_statement', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'statementnum' => $statementnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Statement #$statementnum not found!" unless $cust_statement; + +my $custnum = $cust_statement->custnum; +my $display_custnum = $cust_statement->cust_main->display_custnum; + +my $link = $templatename ? "$templatename-$statementnum" : $statementnum; + +</%init> |