[freeside-commits] branch FREESIDE_3_BRANCH updated. c41cfabd265b8a26024187119535f8bf789d0e3d
Mark Wells
mark at 420.am
Tue May 20 22:52:24 PDT 2014
The branch, FREESIDE_3_BRANCH has been updated
via c41cfabd265b8a26024187119535f8bf789d0e3d (commit)
from 8b1320ce3eca72830fe8b138f07b22968e349f96 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c41cfabd265b8a26024187119535f8bf789d0e3d
Author: Mark Wells <mark at freeside.biz>
Date: Tue May 20 22:52:01 2014 -0700
search voided invoices, missing files, #28684
diff --git a/httemplate/search/cust_bill_void.html b/httemplate/search/cust_bill_void.html
new file mode 100755
index 0000000..d99f759
--- /dev/null
+++ b/httemplate/search/cust_bill_void.html
@@ -0,0 +1,169 @@
+<& elements/search.html,
+ 'title' => emt('Voided Invoice Search Results'),
+ 'name' => 'voided invoices',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => $count_addl,
+ 'redirect' => $link,
+ 'header' => [ emt('Invoice #'),
+ emt('Amount'),
+ emt('Date'),
+ FS::UI::Web::cust_header(),
+ emt('Voided by'),
+ emt('Date'),
+ emt('Reason'),
+ ],
+ 'fields' => [
+ 'display_invnum',
+ sub { sprintf($money_char.'%.2f', shift->charged ) },
+ sub { time2str('%b %d %Y', shift->_date ) },
+ \&FS::UI::Web::cust_fields,
+ 'username',
+ sub { time2str('%b %d %Y', shift->void_date) },
+ 'reason',
+ ],
+ 'sort_fields' => [
+ 'COALESCE( agent_invid, invnum )',
+ 'charged',
+ '_date',
+ FS::UI::Web::cust_sort_fields(),
+ 'username',
+ 'void_date',
+ 'reason',
+ ],
+ 'align' => 'rrl'.FS::UI::Web::cust_aligns().'lll',
+ 'links' => [
+ $link,
+ $link,
+ $link,
+ ( map { $_ ne 'Cust. Status' ? $clink : '' }
+ FS::UI::Web::cust_header()
+ ),
+ $link,
+ $link,
+ ],
+ 'color' => [
+ '',
+ '',
+ '',
+ FS::UI::Web::cust_colors(),
+ ],
+ 'style' => [
+ '',
+ '',
+ '',
+ FS::UI::Web::cust_styles(),
+ ],
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List invoices');
+ # or something else?
+
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
+
+my $addl_from =
+ ' LEFT JOIN access_user ON (cust_bill_void.void_usernum = access_user.usernum) '.
+ FS::UI::Web::join_cust_main('cust_bill_void');
+#here is the agent virtualization
+my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql;
+
+my( $count_query, $sql_query );
+my $count_addl = '';
+my %search;
+
+if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
+
+ my $invnum_or_invid = "( invnum = $2 OR agent_invid = $2 )";
+ my $where = "WHERE $invnum_or_invid AND $agentnums_sql";
+
+ $count_query = "SELECT COUNT(*) FROM cust_bill_void $addl_from $where";
+
+ $sql_query = {
+ 'table' => 'cust_bill_void',
+ 'addl_from' => $addl_from,
+ 'hashref' => {},
+ 'extra_sql' => $where,
+ };
+
+} else {
+
+ #some false laziness w/cust_bill::re_X
+ my $orderby = 'ORDER BY cust_bill_void._date';
+
+ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ $search{'agentnum'} = $1;
+ }
+
+ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ $search{'refnum'} = $1;
+ }
+
+if ( grep { $_ eq 'cust_classnum' } $cgi->param ) {
+ $search{'cust_classnum'} = [ $cgi->param('cust_classnum') ];
+ }
+
+ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ $search{'custnum'} = $1;
+ }
+
+ # begin/end/beginning/ending
+ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, '');
+ $search{'_date'} = [ $beginning, $ending ]
+ unless $beginning == 0 && $ending == 4294967295;
+
+ ($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, 'void_');
+ $search{'void_date'} = [ $beginning, $ending ]
+ unless $beginning == 0 && $ending == 4294967295;
+
+ if ( $cgi->param('invnum_min') =~ /^\s*(\d+)\s*$/ ) {
+ $search{'invnum_min'} = $1;
+ }
+ if ( $cgi->param('invnum_max') =~ /^\s*(\d+)\s*$/ ) {
+ $search{'invnum_max'} = $1;
+ }
+ #payby
+ if ( $cgi->param('payby') ) {
+ $search{'payby'} = [ $cgi->param('payby') ];
+ }
+
+ #amounts
+ $search{'charged'} = [ FS::UI::Web::parse_lt_gt($cgi, 'charged') ];
+
+ my $extra_sql = FS::cust_bill_void->search_sql_where( \%search );
+ $extra_sql = "WHERE $extra_sql" if $extra_sql;
+
+ unless ( $count_query ) {
+ $count_query = 'SELECT COUNT(*), SUM(charged)';
+ $count_addl = [ $money_char . '%.2f voided' ];
+ }
+ $count_query .= " FROM cust_bill_void $addl_from $extra_sql";
+
+ $sql_query = {
+ 'table' => 'cust_bill_void',
+ 'addl_from' => $addl_from,
+ 'hashref' => {},
+ 'select' => join(', ',
+ 'cust_bill_void.*',
+ #( map "cust_main.$_", qw(custnum last first company) ),
+ 'cust_main.custnum as cust_main_custnum',
+ FS::UI::Web::cust_sql_fields(),
+ 'access_user.username',
+ ),
+ 'extra_sql' => $extra_sql,
+ 'order_by' => $orderby,
+ };
+
+}
+my $link = [ "${p}view/cust_bill_void.html?", 'invnum', ];
+my $clink = sub {
+ my $cust_bill = shift;
+ $cust_bill->cust_main_custnum
+ ? [ "${p}view/cust_main.cgi?", 'custnum' ]
+ : '';
+};
+
+# really don't want the ability to print/spool/email voided invoices
+</%init>
diff --git a/httemplate/search/report_cust_bill_void.html b/httemplate/search/report_cust_bill_void.html
new file mode 100644
index 0000000..cb13b78
--- /dev/null
+++ b/httemplate/search/report_cust_bill_void.html
@@ -0,0 +1,102 @@
+<& /elements/header.html, mt($title, @title_arg) &>
+
+<FORM ACTION="cust_bill_void.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
+
+% unless ( $custnum ) {
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left">
+ <FONT SIZE="+1">Customer search options</FONT>
+ </TH>
+ </TR>
+
+ <& /elements/tr-select-agent.html,
+ 'curr_value' => scalar( $cgi->param('agentnum') ),
+ 'label' => emt('Agent'),
+ 'disable_empty' => 0,
+ &>
+
+ <& /elements/tr-select-cust_class.html,
+ label => mt('Customer Class'),
+ field => 'cust_classnum',
+ multiple => 1,
+ 'pre_options' => [ '' => emt('(none)') ],
+ 'all_selected' => 1,
+ &>
+
+% if ( $cust_main ) {
+ <INPUT TYPE="hidden" NAME="payby" VALUE="<% $cust_main->payby %>">
+% } else {
+ <& /elements/tr-select-payby.html,
+ label => emt('Payment method:'),
+ payby_type => 'cust',
+ multiple => 1,
+ all_selected => 1,
+ &>
+% }
+
+ </TABLE>
+ <BR>
+
+% }
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left">
+ <FONT SIZE="+1">Invoice search options</FONT>
+ </TH>
+ </TR>
+
+ <& /elements/tr-input-beginning_ending.html &>
+
+ <& /elements/tr-input-lessthan_greaterthan.html,
+ label => emt('Charged'),
+ field => 'charged',
+ &>
+
+ <& /elements/tablebreak-tr-title.html,
+ value => 'Void circumstances'
+ &>
+ <& /elements/tr-select-user.html,
+ field => 'void_usernum',
+ label => 'Voided by: ',
+ &>
+ <& /elements/tr-input-beginning_ending.html, prefix => 'void_' &>
+
+ </TABLE>
+<BR>
+<INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
+
+</FORM>
+
+<& /elements/footer.html &>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List invoices');
+
+my $conf = new FS::Conf;
+
+my $title = 'Voided Invoice Report';
+#false laziness w/report_cust_pkg.html
+my @title_arg = ();
+
+my $custnum = '';
+my $cust_main = '';
+if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+ $custnum = $1;
+ $cust_main = qsearchs({
+ 'table' => 'cust_main',
+ 'hashref' => { 'custnum' => $custnum },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+ }) or die "unknown custnum $custnum";
+ $title .= ': [_1]';
+ push @title_arg, $cust_main->name;
+}
+
+</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/search/cust_bill_void.html | 169 ++++++++++++++++++++
...t_cust_bill.html => report_cust_bill_void.html} | 57 ++------
2 files changed, 179 insertions(+), 47 deletions(-)
create mode 100755 httemplate/search/cust_bill_void.html
copy httemplate/search/{report_cust_bill.html => report_cust_bill_void.html} (63%)
More information about the freeside-commits
mailing list