summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-06-30 12:14:19 -0700
committerMark Wells <mark@freeside.biz>2015-06-30 12:14:19 -0700
commit39501b4ff6c6cd9ac3cfe7ad313affe049e18994 (patch)
treeec152a661a88cd199a296ec0677b248e0947a4b5 /httemplate/search
parenta8bdd6bf5d005af9dff6b53047ba378ef6912302 (diff)
include discounts in gross sales reports, #25943
Diffstat (limited to 'httemplate/search')
-rwxr-xr-xhttemplate/search/cust_bill.html135
-rw-r--r--httemplate/search/elements/search-html.html18
-rw-r--r--httemplate/search/report_cust_bill.html3
3 files changed, 93 insertions, 63 deletions
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 082073339..662673676 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -1,61 +1,82 @@
<& elements/search.html,
- 'title' => emt('Invoice Search Results'),
- 'html_init' => $html_init,
- 'menubar' => $menubar,
- 'name' => 'invoices',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- 'count_addl' => $count_addl,
- 'redirect' => $link,
- 'header' => [ emt('Invoice #'),
- emt('Balance'),
- emt('Net Amount'),
- emt('Gross Amount'),
- emt('Date'),
- FS::UI::Web::cust_header(),
- ],
- 'fields' => [
- 'display_invnum',
- sub { sprintf($money_char.'%.2f', shift->get('owed') ) },
- sub { sprintf($money_char.'%.2f', shift->get('net') ) },
- sub { sprintf($money_char.'%.2f', shift->charged ) },
- sub { time2str('%b %d %Y', shift->_date ) },
- \&FS::UI::Web::cust_fields,
- ],
- 'sort_fields' => [
- 'COALESCE( agent_invid, invnum )',
- FS::cust_bill->owed_sql,
- FS::cust_bill->net_sql,
- 'charged',
- '_date',
- ],
- 'align' => 'rrrrl'.FS::UI::Web::cust_aligns(),
- 'links' => [
- $link,
- $link,
- $link,
- $link,
- $link,
- ( map { $_ ne 'Cust. Status' ? $clink : '' }
- FS::UI::Web::cust_header()
- ),
- ],
- 'color' => [
- '',
- '',
- '',
- '',
- '',
- FS::UI::Web::cust_colors(),
- ],
- 'style' => [
- '',
- '',
- '',
- '',
- '',
- FS::UI::Web::cust_styles(),
- ],
+ 'title' => emt('Invoice Search Results'),
+ 'html_init' => $html_init,
+ 'menubar' => $menubar,
+ 'name' => 'invoices',
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'count_addl' => $count_addl,
+ 'redirect' => $link,
+ 'header' => [ emt('Invoice #'),
+ emt('Gross Amount'),
+ emt('Discount'),
+ emt('Credits'),
+ emt('Net Amount'),
+ emt('Balance'),
+ emt('Date'),
+ FS::UI::Web::cust_header(),
+ ],
+ 'fields' => [
+ 'display_invnum',
+ 'gross',
+ 'discounted',
+ 'credited',
+ 'net',
+ 'owed',
+ sub { time2str('%b %d %Y', shift->_date ) },
+ \&FS::UI::Web::cust_fields,
+ ],
+ 'sort_fields' => [
+ 'COALESCE( agent_invid, invnum )',
+ 'gross',
+ 'discounted',
+ 'credited',
+ 'net',
+ 'owed',
+ '_date',
+ ],
+ 'format' => [
+ '',
+ $money_char.'%.2f',
+ $money_char.'%.2f',
+ $money_char.'%.2f',
+ $money_char.'%.2f',
+ $money_char.'%.2f',
+ '',
+ ],
+ 'align' => 'rrrrrrl'.FS::UI::Web::cust_aligns(),
+ 'links' => [
+ $link,
+ $link,
+ $link,
+ $link,
+ $link,
+ $link,
+ $link,
+ ( map { $_ ne 'Cust. Status' ? $clink : '' }
+ FS::UI::Web::cust_header()
+ ),
+ ],
+ 'color' => [
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ FS::UI::Web::cust_colors(),
+ ],
+ 'style' => [
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ FS::UI::Web::cust_styles(),
+ ],
&>
<%init>
diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html
index d8ab30a32..6121aea94 100644
--- a/httemplate/search/elements/search-html.html
+++ b/httemplate/search/elements/search-html.html
@@ -377,9 +377,16 @@ $rows => []
% my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
% my $styles = $opt{'style'} ? [ @{$opt{'style'}} ] : [];
% my $cstyles = $opt{'cell_style'} ? [ @{$opt{'cell_style'}} ] : [];
+% my $formats = $opt{'format'} ? [ @{$opt{'format'}} ] : [];
%
% foreach my $field (
%
+% # if the value of the field is an arrayref, then construct a table in
+% # the cell.
+% # if it's a (non-empty) scalar, and a format has been specified, then
+% # format the scalar with that.
+% # otherwise, just output the value.
+% # XXX we should also do date formats like this
% map {
% if ( ref($_) eq 'ARRAY' ) {
%
@@ -443,10 +450,17 @@ $rows => []
% '</table>';
%
% } else {
+% if ( length($_) > 0 and my $format = shift @$formats ) {
+% $_ = sprintf($format, $_);
+% }
% $_;
% }
% }
%
+% # get the value of the field spec:
+% # - if the spec is a coderef, evaluate the coderef
+% # - if the spec is a string, call that string as a method
+% # - if the spec is an integer, get the field in that position
% map {
% if ( ref($_) eq 'CODE' ) {
% &{$_}($row);
@@ -491,10 +505,6 @@ $rows => []
% $tooltip = &{$tooltip}($row)
% if ref($tooltip) eq 'CODE';
% $tooltip = qq! title="<% $tooltip |h %>"!;
-%# qq! onmouseover="return overlib(!.
-%# $m->interp->apply_escapes($tooltip, 'h', 'js_string').
-%# qq!, FGCLASS, 'tooltip', REF, 'a$id', !.
-%# qq!REFC, 'LL', REFP, 'UL')"! if $tooltip;
%
% if ( $link ) {
% my( $url, $method ) = @{$link};
diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html
index 3efe830e3..e80c6e895 100644
--- a/httemplate/search/report_cust_bill.html
+++ b/httemplate/search/report_cust_bill.html
@@ -29,8 +29,7 @@
label => mt('Customer Class'),
field => 'cust_classnum',
multiple => 1,
- 'pre_options' => [ '' => emt('(none)') ],
- 'all_selected' => 1,
+ 'pre_options' => [ 0 => emt('(none)') ],
&>
</TABLE>