summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search')
-rw-r--r--httemplate/search/elements/cust_main_dayranges.html52
-rw-r--r--httemplate/search/elements/search-html.html6
-rw-r--r--httemplate/search/elements/search.html30
-rwxr-xr-xhttemplate/search/report_receivables.cgi14
-rwxr-xr-xhttemplate/search/report_receivables.html6
-rwxr-xr-xhttemplate/search/report_unapplied_cust_pay.html6
-rwxr-xr-xhttemplate/search/unapplied_cust_pay.html8
7 files changed, 24 insertions, 98 deletions
diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html
index 9e4e86f9c..cc014923f 100644
--- a/httemplate/search/elements/cust_main_dayranges.html
+++ b/httemplate/search/elements/cust_main_dayranges.html
@@ -18,9 +18,8 @@ Example:
'name' => 'customers',
'query' => $sql_query,
'count_query' => $count_sql,
- 'header' => [
+ 'header' => [
FS::UI::Web::cust_header(),
- @pay_head,
'0-30',
'30-60',
'60-90',
@@ -32,9 +31,8 @@ Example:
( map '',
( 1 ..
scalar(FS::UI::Web::cust_header()-1)
- ), @pay_labels
+ )
),
-
sprintf( $money_char.'%.2f',
$row->{'rangecol_0_30'} ),
sprintf( $money_char.'%.2f',
@@ -47,8 +45,7 @@ Example:
$row->{'rangecol_0_0'} ),
],
'fields' => [
- FS::UI::Web::cust_fields_subs(),
- @pay_labels,
+ \&FS::UI::Web::cust_fields,
format_rangecol('0_30'),
format_rangecol('30_60'),
format_rangecol('60_90'),
@@ -59,7 +56,6 @@ Example:
( map { $_ ne 'Cust. Status' ? $clink : '' }
FS::UI::Web::cust_header()
),
- @pay_links,
'',
'',
'',
@@ -67,23 +63,17 @@ Example:
'',
],
#'align' => 'rlccrrrrr',
- 'align' => FS::UI::Web::cust_aligns().
- ('c' x @pay_labels).
- 'rrrrr',
+ 'align' => FS::UI::Web::cust_aligns(). 'rrrrr',
#'size' => [ '', '', '-1', '-1', '', '', '', '', '', ],
#'style' => [ '', '', 'b', 'b', '', '', '', '', 'b', ],
'size' => [ ( map '', FS::UI::Web::cust_header() ),
- ( map '', @pay_labels ),
#'-1', '', '', '', '', '', ],
- '', '', '', '', '', '', ],
+ '', '', '', '', '', ],
'style' => [ FS::UI::Web::cust_styles(),
- ( map '', @pay_labels ),
#'b', '', '', '', '', 'b', ],
'', '', '', '', 'b', ],
'color' => [
FS::UI::Web::cust_colors(),
- ( map '', @pay_labels ),
- '',
'',
'',
'',
@@ -108,14 +98,8 @@ my $ranges = $opt{'ranges'} ? delete($opt{'ranges'}) : [
my $range_sub = delete($opt{'range_sub'}); #or die
-my $offset = 0;
-if($cgi->param('as_of')) {
- $offset = int((time - str2time($cgi->param('as_of'))) / 86400);
- $opt{'title'} .= ' ('.$cgi->param('as_of').')' if $offset > 0;
-}
-
#my $range_cols = join(',', map &{$range_sub}( @$_ ), @ranges );
-my $range_cols = join(',', map call_range_sub($range_sub, @$_, 'offset' => $offset ), @$ranges );
+my $range_cols = join(',', map call_range_sub($range_sub, @$_ ), @$ranges );
my $select_count_pkgs = FS::cust_main->select_count_pkgs_sql;
@@ -135,14 +119,14 @@ END
my @where = ();
unless ( $cgi->param('all_customers') ) {
-# Exclude entire cust_main records where the balance is >0
+
my $days = 0;
if ( $cgi->param('days') =~ /^\s*(\d+)\s*$/ ) {
$days = $1;
}
push @where,
- call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0';
+ call_range_sub($range_sub, $days, 0, 'no_as'=>1). ' > 0'; # != 0';
}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -176,7 +160,6 @@ my $sql_query = {
$range_cols,
$packages_cols,
FS::UI::Web::cust_sql_fields(),
- 'payby',
),
'extra_sql' => $where,
'order_by' => "order by coalesce(lower(company), ''), lower(last)",
@@ -184,7 +167,7 @@ my $sql_query = {
my $total_sql =
"SELECT ".
- join(',', map call_range_sub( $range_sub, @$_, 'offset' => $offset, 'sum'=>1 ), @$ranges).
+ join(',', map call_range_sub( $range_sub, @$_, 'sum'=>1 ), @$ranges).
" FROM cust_main $where";
my $total_sth = dbh->prepare($total_sql) or die dbh->errstr;
@@ -193,25 +176,10 @@ my $row = $total_sth->fetchrow_hashref();
my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
-my (@pay_head, @pay_labels, @pay_links);
-
-if($opt{'payment_links'} && $curuser->access_right('Process payment')) {
- @pay_head = ({ label => 'Process', nodownload => 1, colspan => 2 },
- { nodownload => 1 });
-
- @pay_labels = (map { my ($payby,$label) = @$_;
- sub {($payby eq $_[0]->payby) ? "<b>$label</b>" : $label}
- } ([CARD => 'Card'], [CHEK => 'ACH']) );
-
- @pay_links = (map { [ "${p}misc/payment.cgi?payby=$_;custnum=", 'custnum' ] }
- 'CARD', 'CHEK' );
-}
-
</%init>
<%once>
my $conf = new FS::Conf;
-my $curuser = $FS::CurrentUser::CurrentUser;
my $money_char = $conf->config('money_char') || '$';
@@ -235,7 +203,7 @@ sub call_range_sub {
my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end";
- my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt?
+ my $sql = &{$range_sub}( $start, $end ); #%opt?
$sql = "SUM($sql)" if $opt{'sum'};
diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html
index 3d4a4b039..6b915a617 100644
--- a/httemplate/search/elements/search-html.html
+++ b/httemplate/search/elements/search-html.html
@@ -177,13 +177,8 @@
<TR>
% my $h2 = 0;
-% my $colspan = 0;
% foreach my $header ( @{ $opt{header} } ) {
-% $colspan-- if $colspan > 0;
-% next if $colspan;
-%
% my $label = ref($header) ? $header->{label} : $header;
-% $colspan = ref($header) ? $header->{colspan} : 0;
% my $rowspan = 1;
% my $style = '';
% if ( $opt{header2} ) {
@@ -198,7 +193,6 @@
<TH CLASS = "grid"
BGCOLOR = "#cccccc"
ROWSPAN = "<% $rowspan %>"
- <% $colspan ? 'COLSPAN = "'.$colspan.'"' : '' %>
<% $style %>
>
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index 1312cac41..4bfe8b091 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -194,9 +194,6 @@ my(%opt) = @_;
my $curuser = $FS::CurrentUser::CurrentUser;
-my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|select|html(-print)?)$/
- ? $1 : 'html' ;
-
my %align = (
'l' => 'left',
'r' => 'right',
@@ -207,22 +204,6 @@ my %align = (
$opt{align} = [ map $align{$_}, split(//, $opt{align}) ],
unless !$opt{align} || ref($opt{align});
-if($type =~ /csv|xls/) {
- my $h = $opt{'header'};
- my @del;
- my $i = 0;
- do {
- if( ref($h->[$i]) and exists($h->[$i]->{'nodownload'}) ) {
- splice(@{$opt{$_}}, $i, 1) foreach
- qw(header footer fields links link_onclicks
- align color size style cell_style xls_format);
- }
- else {
- $i++;
- }
- } while ( exists($h->[$i]) );
-}
-
$opt{disable_download} = 0
if $opt{disable_download} && $curuser->access_right('Configuration download');
@@ -310,22 +291,25 @@ if ( $opt{'disableable'} ) {
if ( $cgi->param('showdisabled') ) {
$cgi->param('showdisabled', 0);
$opt{'html_posttotal'} .=
- '( <a href="'. $cgi->self_url. qq!">hide disabled $items</a> )!; #"
+ '( <a href="'. $cgi->self_url. qq!">hide disabled $items</a> )!;
$cgi->param('showdisabled', 1);
} else {
$cgi->param('showdisabled', 1);
$opt{'html_posttotal'} .=
- '( <a href="'. $cgi->self_url. qq!">show disabled $items</a> )!; #"
+ '( <a href="'. $cgi->self_url. qq!">show disabled $items</a> )!;
$cgi->param('showdisabled', 0);
}
}
+my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|select|html(-print)?)$/
+ ? $1 : 'html';
+
my $limit = '';
my($confmax, $maxrecords, $offset );
-if ( !$type =~ /^(csv|\w*.xls)$/) {
-# html mode
+unless ( $type =~ /^(csv|\w*\.xls)$/ ) {
+
unless (exists($opt{count_query}) && length($opt{count_query})) {
( $opt{count_query} = $opt{query} ) =~
s/^\s*SELECT\s*(.*?)\s+FROM\s/SELECT COUNT(*) FROM /i; #silly vim:/
diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
index 73ebee49d..6df016134 100755
--- a/httemplate/search/report_receivables.cgi
+++ b/httemplate/search/report_receivables.cgi
@@ -1,7 +1,6 @@
<% include( 'elements/cust_main_dayranges.html',
'title' => 'Accounts Receivable Aging Summary',
'range_sub' => \&balance,
- 'payment_links' => 1,
)
%>
<%init>
@@ -29,18 +28,13 @@ die "access denied"
# )
sub balance {
- my($start, $end, $offset) = @_; #, %opt ?
+ my($start, $end) = @_; #, %opt ?
+
#handle start and end ranges (86400 = 24h * 60m * 60s)
my $str2time = str2time_sql;
my $closing = str2time_sql_closing;
-
- # $end == 0 means "+infinity", while $start == 0 really means 0
- # so we should always include a start condition
- $start = "( $str2time now() $closing - ". ($start + $offset) * 86400 . ' )';
- # but only include an end condition if $end != 0
- $end = $end ?
- "( $str2time now() $closing - ". ($end + $offset) * 86400 . ' )'
- : '';
+ $start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
+ $end = $end ? "( $str2time now() $closing - ".($end * 86400). ' )' : '';
#$opt{'unapplied_date'} = 1;
diff --git a/httemplate/search/report_receivables.html b/httemplate/search/report_receivables.html
index b7c84f0de..bfb016945 100755
--- a/httemplate/search/report_receivables.html
+++ b/httemplate/search/report_receivables.html
@@ -24,12 +24,6 @@
<INPUT TYPE="radio" NAME="all_customers" VALUE="0" CHECKED onClick="if ( ! this.checked ) { document.OneTrueForm.days.disabled=true; document.OneTrueForm.days.style.backgroundColor = '#dddddd'; } else { document.OneTrueForm.days.disabled=false; document.OneTrueForm.days.style.backgroundColor = '#ffffff'; }">Customers with a balance over <INPUT NAME="days" TYPE="text" SIZE=4 MAXLENGTH=3 VALUE="0"> days old
</TD>
</TR>
- <% include( '/elements/tr-input-date-field.html', {
- 'name' => 'as_of',
- 'value' => time,
- 'label' => 'As of date ',
- 'format' => FS::Conf->new->config('date_format') || '%m/%d/%Y',
- } ) %>
</TABLE>
diff --git a/httemplate/search/report_unapplied_cust_pay.html b/httemplate/search/report_unapplied_cust_pay.html
index 65e064ccb..10093e576 100755
--- a/httemplate/search/report_unapplied_cust_pay.html
+++ b/httemplate/search/report_unapplied_cust_pay.html
@@ -25,12 +25,6 @@
<INPUT TYPE="radio" NAME="all_customers" VALUE="0" CHECKED onClick="if ( ! this.checked ) { document.OneTrueForm.days.disabled=true; document.OneTrueForm.days.style.backgroundColor = '#dddddd'; } else { document.OneTrueForm.days.disabled=false; document.OneTrueForm.days.style.backgroundColor = '#ffffff'; }">Customers with unapplied payments over <INPUT NAME="days" TYPE="text" SIZE=4 MAXLENGTH=3 VALUE="0"> days old
</TD>
</TR>
- <% include( '/elements/tr-input-date-field.html', {
- 'name' => 'as_of',
- 'value' => time,
- 'label' => 'As of date ',
- 'format' => FS::Conf->new->config('date_format') || '%m/%d/%Y',
- } ) %>
</TABLE>
diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html
index 73361c00b..8d064d174 100755
--- a/httemplate/search/unapplied_cust_pay.html
+++ b/httemplate/search/unapplied_cust_pay.html
@@ -13,15 +13,13 @@ die "access denied"
<%once>
sub unapplied_payments {
- my($start, $end, $offset) = @_;
+ my($start, $end, %opt) = @_;
#handle start and end ranges (86400 = 24h * 60m * 60s)
my $str2time = str2time_sql;
my $closing = str2time_sql_closing;
- $start = "( $str2time now() $closing - ".($start + $offset) * 86400 . ' )';
- $end = $end ?
- "( $str2time now() $closing - ".($end + $offset) * 86400 . ' )'
- : '';
+ $start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
+ $end = $end ? "( $str2time now() $closing - ".($end * 86400). ' )' : '';
FS::cust_main->unapplied_payments_date_sql( $start, $end );