summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search')
-rwxr-xr-xhttemplate/search/477.html7
-rwxr-xr-xhttemplate/search/477partV.html2
-rwxr-xr-xhttemplate/search/477partVI.html2
-rwxr-xr-xhttemplate/search/bill_batch.cgi65
-rw-r--r--httemplate/search/cdr.html2
-rw-r--r--httemplate/search/cust_bill_pkg.cgi3
-rw-r--r--httemplate/search/cust_credit_bill_pkg.html3
-rwxr-xr-xhttemplate/search/cust_pay_batch.cgi38
-rwxr-xr-xhttemplate/search/cust_pkg.cgi17
-rw-r--r--httemplate/search/elements/cust_main_dayranges.html23
-rw-r--r--httemplate/search/elements/search-html.html13
-rw-r--r--httemplate/search/elements/search.html2
-rw-r--r--httemplate/search/h_inventory_item.html135
-rw-r--r--httemplate/search/report_h_inventory_item.html26
-rwxr-xr-xhttemplate/search/report_newtax.html11
-rw-r--r--httemplate/search/report_prepaid_income.cgi4
-rwxr-xr-xhttemplate/search/report_queued_newtax.cgi12
-rwxr-xr-xhttemplate/search/report_receivables.cgi22
-rw-r--r--httemplate/search/report_rt_transaction.html32
-rw-r--r--httemplate/search/rt_transaction.html34
-rw-r--r--httemplate/search/sql.html8
-rwxr-xr-xhttemplate/search/unapplied_cust_pay.html15
22 files changed, 93 insertions, 383 deletions
diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index 63eab7ac8..bd7fb2d8b 100755
--- a/httemplate/search/477.html
+++ b/httemplate/search/477.html
@@ -43,7 +43,7 @@
% if ( $part eq 'IA' ) {
% for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) {
% next unless $technology_option[$tech];
-% my $url = &{$url_mangler}($part);
+% my $url = &{$url_mangler}($cgi->self_url, $part);
% if ( $type eq 'xml' ) {
<<% 'Part_IA_'. chr(65 + $tech) %>>
% }
@@ -57,7 +57,7 @@
% if ( $type eq 'xml' ) {
<<% 'Part_'. uc($part) %>>
% }
-% my $url = &{$url_mangler}($part);
+% my $url = &{$url_mangler}($cgi->self_url, $part);
<% include( "477part${part}.html", 'url' => $url ) %>
% if ( $type eq 'xml' ) {
</<% 'Part_'. uc($part) %>>
@@ -83,8 +83,7 @@ my $type = $cgi->param('_type') || 'html';
my $xlsname = '477report';
my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi);
my $url_mangler = sub {
- my $part = shift;
- my $url = $cgi->url('-path_info' => 1, '-full' => 1);
+ my ($url, $part) = (shift, shift);
$url =~ s/477\./477part$part./;
$url;
};
diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html
index 885294d28..c6ceac4db 100755
--- a/httemplate/search/477partV.html
+++ b/httemplate/search/477partV.html
@@ -9,7 +9,7 @@
'xml_elements' => [ 'zip codes' ],
'no_field_elements' => 1,
'fields' => [ 'zip' ],
- 'url' => $opt{url} || '',
+ 'url' => $opt{url} || $cgi->self_url,
)
%>
diff --git a/httemplate/search/477partVI.html b/httemplate/search/477partVI.html
index db572bcde..dbd17032c 100755
--- a/httemplate/search/477partVI.html
+++ b/httemplate/search/477partVI.html
@@ -47,7 +47,7 @@
[ $link, $link_suffix ],
[ $link, $link_suffix ],
],
- 'url' => $opt{url} || '',
+ 'url' => $opt{url} || $cgi->self_url,
'xml_row_element' => 'Datarow',
)
%>
diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi
deleted file mode 100755
index e5abc8955..000000000
--- a/httemplate/search/bill_batch.cgi
+++ /dev/null
@@ -1,65 +0,0 @@
-<% include( 'elements/search.html',
- 'title' => 'Invoice Batches',
- 'name_singular' => 'batch',
- 'query' => { 'table' => 'bill_batch',
- 'hashref' => $hashref,
- 'extra_sql' => $extra_sql.
- 'ORDER BY batchnum DESC',
- },
- 'count_query' => "$count_query $extra_sql",
- 'header' => [ 'Batch',
- 'Item Count',
- 'Status',
- '',
- ],
- 'align' => 'rrcc',
- 'fields' => [ 'batchnum',
- sub {
- my $st = "SELECT COUNT(*) from cust_bill_batch WHERE batchnum=" . shift->batchnum;
- my $sth = dbh->prepare($st)
- or die dbh->errstr. "doing $st";
- $sth->execute
- or die "Error executing \"$st\": ". $sth->errstr;
- $sth->fetchrow_arrayref->[0];
- },
- sub {
- $statusmap{shift->status};
- },
- sub { shift->status eq 'O' ?
- 'Download and close' : 'Download'
- },
- ],
- 'links' => [
- $link,
- $link,
- $link,
- $dlink,
- ],
- 'style' => [
- '',
- '',
- '',
- sub { shift->status eq 'O' ? "b" : '' },
- ],
- 'really_disable_download' => 1,
- )
-
-%>
-<%init>
-
-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
-
-my %statusmap = ('O'=>'Open', 'R'=>'Closed');
-my $hashref = {};
-my $count_query = 'SELECT COUNT(*) FROM bill_batch';
-
-my $extra_sql = ''; # may add something here later
-my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ];
-my $dlink = sub {
- [ "${p}view/bill_batch.cgi?magic=print;".
- (shift->status eq 'O' ? 'close=1;' : '').
- 'batchnum=',
- 'batchnum']
-};
-</%init>
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html
index a5575967c..6b38d3ba7 100644
--- a/httemplate/search/cdr.html
+++ b/httemplate/search/cdr.html
@@ -126,7 +126,7 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) {
$search =
"NOT EXISTS ( SELECT 1 FROM cdr_termination WHERE $where_term )";
- } elsif ( $status =~ /^([\w ]+)$/ ) {
+ } elsif ( $cgi->param('freesidestatus') =~ /^([\w ]+)$/ ) {
#false lazienss w/cdr_termination.pm (i should be a part_termination method)
my $where_term =
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index 98a1da9d9..77901de87 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -139,6 +139,9 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @where, "_date >= $beginning",
"_date <= $ending";
+push @where , " payby != 'COMP' "
+ unless $cgi->param('include_comp_cust');
+
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
diff --git a/httemplate/search/cust_credit_bill_pkg.html b/httemplate/search/cust_credit_bill_pkg.html
index 0f7834446..52e0ac6fe 100644
--- a/httemplate/search/cust_credit_bill_pkg.html
+++ b/httemplate/search/cust_credit_bill_pkg.html
@@ -92,6 +92,9 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @where, "cust_bill._date >= $beginning",
"cust_bill._date <= $ending";
+push @where , " payby != 'COMP' "
+ unless $cgi->param('include_comp_cust');
+
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi
index 825d21c8a..7376e9dcb 100755
--- a/httemplate/search/cust_pay_batch.cgi
+++ b/httemplate/search/cust_pay_batch.cgi
@@ -124,7 +124,7 @@ $sql_query = "SELECT paybatchnum,invnum,custnum,cpb.last,cpb.first," .
'LEFT JOIN pay_batch USING ( batchnum ) ' .
"$search ORDER BY $orderby";
-my $html_init = '<TABLE>';
+my $html_init = '';
if ( $pay_batch ) {
my $fixed = $conf->config('batch-fixed_format-'. $pay_batch->payby);
if (
@@ -136,12 +136,11 @@ if ( $pay_batch ) {
&& $FS::CurrentUser::CurrentUser->access_right('Redownload resolved batches')
)
) {
- $html_init .= qq!<TR><FORM ACTION="$p/misc/download-batch.cgi" METHOD="POST">!;
+ $html_init .= qq!<FORM ACTION="$p/misc/download-batch.cgi" METHOD="POST">!;
if ( $fixed ) {
$html_init .= qq!<INPUT TYPE="hidden" NAME="format" VALUE="$fixed">!;
} else {
- $html_init .= qq!Download batch in format !.
- qq!<SELECT NAME="format">!.
+ $html_init .= qq!Download batch in format <SELECT NAME="format">!.
qq!<OPTION VALUE="">Default batch mode</OPTION>!.
qq!<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV file for TD Canada Trust Merchant PC Batch</OPTION>!.
qq!<OPTION VALUE="csv-chase_canada-E-xactBatch">CSV file for Chase Canada E-xactBatch</OPTION>!.
@@ -152,7 +151,7 @@ if ( $pay_batch ) {
qq!<OPTION VALUE="RBC">Royal Bank of Canada PDS</OPTION>!.
qq!</SELECT>!;
}
- $html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum"><INPUT TYPE="submit" VALUE="Download"></FORM><BR><BR></TR>!;
+ $html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum"><INPUT TYPE="submit" VALUE="Download"></FORM><BR>!;
}
if (
@@ -161,28 +160,13 @@ if ( $pay_batch ) {
&& $FS::CurrentUser::CurrentUser->access_right('Reprocess batches')
)
) {
- $html_init .= '<TR>'.
- include('/elements/form-file_upload.html',
- 'name' => 'FileUpload',
- 'action' => "$p/misc/upload-batch.cgi",
- 'num_files' => 1,
- 'fields' => [ 'batchnum', 'format' ],
- 'message' => 'Batch results uploaded.',
- ) .
- 'Upload results<BR></TR><TR>'.
- include('/elements/file-upload.html',
- 'field' => 'file',
- 'label' => 'Filename',
- 'no_table'=> 1
- ).
- '<BR></TR>'
- ;
+ $html_init .= qq!<FORM ACTION="$p/misc/upload-batch.cgi" METHOD="POST" ENCTYPE="multipart/form-data">!.
+ qq!Upload results<BR>!.
+ qq!Filename <INPUT TYPE="file" NAME="batch_results"><BR>!;
if ( $fixed ) {
$html_init .= qq!<INPUT TYPE="hidden" NAME="format" VALUE="$fixed">!;
} else {
- # should pull this from %import_info
- $html_init .= qq!<TR>Format !.
- qq!<SELECT NAME="format">!.
+ $html_init .= qq!Format <SELECT NAME="format">!.
qq!<OPTION VALUE="">Default batch mode</OPTION>!.
qq!<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV results from TD Canada Trust Merchant PC Batch</OPTION>!.
qq!<OPTION VALUE="csv-chase_canada-E-xactBatch">CSV file for Chase Canada E-xactBatch</OPTION>!.
@@ -191,12 +175,12 @@ if ( $pay_batch ) {
qq!<OPTION VALUE="ach-spiritone">Spiritone ACH batch</OPTION>!.
qq!<OPTION VALUE="paymentech">Chase Paymentech XML</OPTION>!.
qq!<OPTION VALUE="RBC">Royal Bank of Canada PDS</OPTION>!.
- qq!</SELECT><BR></TR>!;
+ qq!</SELECT><BR>!;
}
$html_init .= qq!<INPUT TYPE="hidden" NAME="batchnum" VALUE="$batchnum">!;
- $html_init .= '<TR> <INPUT TYPE="submit" VALUE="Upload"></FORM><BR> </TR>';
+ $html_init .= '<INPUT TYPE="submit" VALUE="Upload"></FORM><BR>';
}
- $html_init .= '</TABLE>'
+
}
if ($pay_batch) {
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 74a3a6d1e..adbec7a74 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -80,18 +80,6 @@
# '</table>';
# },
sub {
- my $cust_pkg = shift;
- my $type = $cgi->param('_type') || '';
- if ($type =~ /xls|csv/) {
- my $cust_svc = $cust_pkg->primary_cust_svc;
- if($cust_svc) {
- return join ": ",($cust_svc->label)[0,1];
- }
- else {
- return '';
- }
- }
- else {
[ map {
[
{ 'data' => $_->[0]. ':',
@@ -103,10 +91,9 @@
$_->[2]. '.cgi?'. $_->[3],
},
];
- } $cust_pkg->labels
+ } shift->labels
];
- }
- }
+ },
],
'color' => [
'',
diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html
index 9b8b08f47..c53e68016 100644
--- a/httemplate/search/elements/cust_main_dayranges.html
+++ b/httemplate/search/elements/cust_main_dayranges.html
@@ -11,7 +11,6 @@ Example:
my( $start, $end ) = @_;
"SQL EXPRESSION BASED ON $start AND $end";
- # where $start and $end are unix timestamps
};
</%doc>
@@ -146,7 +145,7 @@ unless ( $cgi->param('all_customers') ) {
}
push @where,
- call_range_sub($range_sub, $days, 0, 'offset' => $offset, 'no_as'=>1). ' > 0'; # != 0';
+ call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0';
}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -249,25 +248,11 @@ my $money_char = $conf->config('money_char') || '$';
# )
sub call_range_sub {
- my($range_sub, $startdays, $enddays, %opt) = @_;
+ my($range_sub, $start, $end, %opt) = @_;
- my $as = $opt{'no_as'} ? '' : " AS rangecol_${startdays}_$enddays";
+ my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end";
- my $offset = $opt{'offset'} || 0;
- # Always use $offset - 1day + 1sec = the last second of that day
- my $cutoff = DateTime->now->set(hour => 23, minute => 59, second => 59);
- $cutoff->subtract(days => $offset);
-
- my $start = $cutoff->clone;
- $start->subtract(days => $startdays);
-
- my $end = $cutoff->clone;
- $end->subtract(days => $enddays);
-
- #warn "offset $offset (".$cutoff->epoch."), range $startdays-$enddays (".$start->epoch . '-' . ($enddays ? $end->epoch : '').")\n";
- my $sql = &{$range_sub}( $start->epoch,
- $enddays ? $end->epoch : '',
- $cutoff->epoch ); #%opt?
+ my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt?
$sql = "SUM($sql)" if $opt{'sum'};
diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html
index 98f9c4476..e5e6ca954 100644
--- a/httemplate/search/elements/search-html.html
+++ b/httemplate/search/elements/search-html.html
@@ -1,3 +1,4 @@
+%
% if ( exists($opt{'redirect'}) && $opt{'redirect'}
% && scalar(@$rows) == 1 && $total == 1
% && $type ne 'html-print'
@@ -102,7 +103,7 @@
% $cgi->delete('maxrecords');
% $cgi->param('_dummy', 1);
- ( show <SELECT NAME="maxrecords" onChange="window.location = '<% "$self_url?". $cgi->query_string %>;maxrecords=' + this.options[this.selectedIndex].value;">
+ ( show <SELECT NAME="maxrecords" onChange="window.location = '<% $self_url %>;maxrecords=' + this.options[this.selectedIndex].value;">
% foreach my $max ( map { $_ * $confmax } qw( 1 5 10 25 ) ) {
<OPTION VALUE="<% $max %>" <% ( $maxrecords == $max ) ? 'SELECTED' : '' %>><% $max %></OPTION>
@@ -143,18 +144,18 @@
Download full results<BR>
% $cgi->param('_type', "$xlsname.xls" );
- as <A HREF="<% "$self_url?". $cgi->query_string %>">Excel spreadsheet</A><BR>
+ as <A HREF="<% $self_url %>">Excel spreadsheet</A><BR>
% $cgi->param('_type', 'csv');
- as <A HREF="<% "$self_url?". $cgi->query_string %>">CSV file</A><BR>
+ as <A HREF="<% $self_url %>">CSV file</A><BR>
% if ( defined($opt{xml_elements}) ) {
% $cgi->param('_type', 'xml');
- as <A HREF="<% "$self_url?". $cgi->query_string %>">XML file</A><BR>
+ as <A HREF="<% $self_url %>">XML file</A><BR>
% }
% $cgi->param('_type', 'html-print');
- as <A HREF="<% "$self_url?". $cgi->query_string %>">printable copy</A>
+ as <A HREF="<% $self_url %>">printable copy</A>
</TD>
% $cgi->param('_type', "html" );
@@ -464,7 +465,7 @@ my $confmax = $args{'confmax'};
my $maxrecords = $args{'maxrecords'};
my $offset = $args{'offset'};
my %opt = %{ $args{'opt'} };
-my $self_url = $opt{'url'} || $cgi->url('-path_info' => 1, '-full' =>1);
+my $self_url = $opt{'url'} || $cgi->self_url;
my $count_sth = dbh->prepare($opt{'count_query'})
or die "Error preparing $opt{'count_query'}: ". dbh->errstr;
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index 218816938..a258f1721 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -335,7 +335,7 @@ if ( $opt{'disableable'} ) {
my $limit = '';
my($confmax, $maxrecords, $offset );
-unless ( $type =~ /^(csv|\w*.xls)$/) {
+if ( !$type =~ /^(csv|\w*.xls)$/) {
# html mode
unless (exists($opt{count_query}) && length($opt{count_query})) {
( $opt{count_query} = $opt{query} ) =~
diff --git a/httemplate/search/h_inventory_item.html b/httemplate/search/h_inventory_item.html
deleted file mode 100644
index b0f9b8aa8..000000000
--- a/httemplate/search/h_inventory_item.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<% include('/elements/header.html', "$classname Inventory Activity Report") %>
-<% include('/elements/table-grid.html') %>
- <TR>
-% my $TH = 'TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=1';
- <<%$TH%> WIDTH="10%" ALIGN="left">Day (<% time2str("%B %Y", $sdate) %>)</TH>
-% foreach my $day (0..$numdays-1) {
- <<%$TH%> WIDTH="2%" ALIGN="right"><% $day+1 %></TH>
-% }
- </TR>
-% for (my $r=0; $r < scalar(@rows); $r++) {
- <TR>
-% my $TD = 'TD CLASS="grid" BGCOLOR="'.($r % 2 ? '#ffffff' : '#eeeeee').'"';
- <<%$TD%>><% $labels[$r] %></TD>
-% for my $day (0..$numdays-1) {
- <<%$TD%> ALIGN="right"><% $rows[$r][$day] %></TD>
-% }
- </TR>
-% }
-</TABLE>
-
-<%init>
-use Date::Parse 'str2time';
-use Date::Format 'time2str';
-use Data::Dumper 'Dumper';
-
-my ($agentnum, $classnum, $month, $year, $sdate, $edate);
-$classnum = $cgi->param('classnum'); # may be empty
-$agentnum = $cgi->param('agentnum'); # may also be empty
-my $classname = '';
-if($classnum) {
- my $class = qsearchs('inventory_class', { classnum => $classnum });
- die "classnum $classnum not found!" if !$class;
- $classname = $class->classname . ' ';
-}
-
-$month = $cgi->param('_month') || time2str('%m', time);
-$year = $cgi->param('_year') || time2str('%Y', time);
-
-$sdate = str2time("$year-$month-01");
-$edate = str2time($year + ($month == 12 ? 1 : 0) .
- '-' .
- (($month + 1) % 12 || 12) .
- '-01');
-my $numdays = sprintf("%.0f",($edate-$sdate)/86400);
-my @days = (0..$numdays - 1);
-# Initialize each row with zeroes.
-my @labels = (
- 'Opening Balance',
- 'Quantity Received',
- 'Quantity Sold',
- 'Quantity Returned',
-);
-
-if($agentnum) {
- push @labels, 'Transfer In', 'Transfer Out';
-}
-push @labels, 'Closing Balance';
-
-my %agent = ('agentnum' => $agentnum) if $agentnum;
-my %class = ('classnum' => $classnum) if $classnum;
-
-my @rows = ( map {[ (0) x $numdays ]} @labels);
-my $opening_balance = scalar(
- qsearch('h_inventory_item',
- { 'svcnum' => '',
- %agent,
- %class },
- FS::h_inventory_item->sql_h_search($sdate) )
- ) || 0;
-
-foreach my $day (0..$numdays-1) {
- $rows[0][$day] = ($day == 0) ?
- $opening_balance :
- $rows[-1][$day-1];
-
- my %history;
- foreach my $action (qw(insert replace_new replace_old)) {
- $history{$action} = [
- qsearch({
- 'table' => 'h_inventory_item',
- 'hashref' => { 'history_action' => $action,
- %class },
- 'order_by' => 'ORDER BY itemnum, history_date',
- 'extra_sql' =>
- ' AND history_date >= '.($sdate + 86400*$day).
- ' AND history_date < ' .($sdate + 86400*($day+1)),
- } )
- ];
- }
- # Incoming items: simple, just count the inserts
- $rows[1][$day] = scalar(grep {!$agentnum or $_->agentnum == $agentnum}
- @{ $history{'insert'} });
-
- # Other item changes: trickier.
- # Notice the order_by parameter above.
- # Both lists are sorted by itemnum, then by date, so unless some villain has
- # been rapidly replacing the same record several times per second, the
- # replace_old and replace_new from the same operation will be in the same
- # position.
- while(my $h_new = shift @{ $history{'replace_new'} }) {
- my $h_old = shift @{ $history{'replace_old'} };
- die "history error" if !defined($h_old)
- or $h_old->itemnum != $h_new->itemnum;
- if(!$agentnum or $h_new->agentnum == $agentnum) {
- if(!$h_old->svcnum and $h_new->svcnum) {
- # item was put into service.
- $rows[2][$day]++;
- }
- elsif($h_old->svcnum and !$h_new->svcnum) {
- # item was taken out of service.
- $rows[3][$day]++;
- }
- }
- if($agentnum and $h_old->agentnum != $agentnum and $h_new->agentnum == $agentnum) {
- # item was transferred from another agent
- $rows[4][$day]++;
- }
- elsif($agentnum and $h_old->agentnum == $agentnum and $h_new->agentnum != $agentnum) {
- # item was transferred to another agent
- $rows[5][$day]++;
- }
- # Add other cases here.
- }
- # Closing balance
- $rows[-1][$day] = $rows[0][$day]
- + $rows[1][$day]
- - $rows[2][$day]
- + $rows[3][$day];
- if($agentnum) {
- $rows[-1][$day] += $rows[4][$day] - $rows[5][$day];
- }
-}
-
-</%init>
-
diff --git a/httemplate/search/report_h_inventory_item.html b/httemplate/search/report_h_inventory_item.html
deleted file mode 100644
index d0b3667c8..000000000
--- a/httemplate/search/report_h_inventory_item.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<% include('/elements/header.html', 'Inventory Activity Report') %>
-
-<FORM ACTION="h_inventory_item.html" METHOD="GET">
-<TABLE BGCOLOR="#cccccc" CELLSPACING="0">
- <TR>
- <TD ALIGN="right">Inventory class: </TD>
- <TD><% include('/elements/select-table.html',
- 'element_name' => 'classnum',
- 'table' => 'inventory_class',
- 'name_col' => 'classname',
- 'value' => '',
- 'empty_label' => '(all)') %></TD>
- </TR>
- <TR>
- <TD ALIGN="right">Time period: </TD>
- <TD><% include('/elements/select-month_year.html') %></TD>
- </TR>
- <% include('/elements/tr-select-agent.html') %>
-</TABLE>
-
-<BR>
-<INPUT TYPE="submit" VALUE="Get Report">
-</FORM>
-
-<%init>
-</%init>
diff --git a/httemplate/search/report_newtax.html b/httemplate/search/report_newtax.html
index 739652675..2588b48d3 100755
--- a/httemplate/search/report_newtax.html
+++ b/httemplate/search/report_newtax.html
@@ -1,6 +1,6 @@
<% include('/elements/header.html', 'Tax Report' ) %>
-<FORM NAME="newtax">
+<FORM ACTION="report_queued_newtax.cgi" METHOD="GET">
<TABLE>
@@ -10,17 +10,10 @@
</TABLE>
-<BR><INPUT TYPE="button" NAME='fetch' VALUE="Get Report" onClick="document.newtax.fetch.disabled=true; process();">
+<BR><INPUT TYPE="submit" VALUE="Get Report">
</FORM>
-<% include( '/elements/progress-init.html',
- 'newtax',
- [ qw( agentnum beginning ending ) ],
- 'report_queued_newtax.cgi',
- )
-%>
-
<% include('/elements/footer.html') %>
<%init>
diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi
index 2fe5b6f10..bfb699b54 100644
--- a/httemplate/search/report_prepaid_income.cgi
+++ b/httemplate/search/report_prepaid_income.cgi
@@ -108,6 +108,10 @@ my @where = ();
#here is the agent virtualization
push @where, $curuser->agentnums_sql( 'table'=>'cust_main' );
+#well, because cust_bill_pkg.cgi has it and without it the numbers don't match..
+push @where , " payby != 'COMP' "
+ unless $cgi->param('include_comp_cust');
+
my %total = ();
my %total_legacy = ();
foreach my $agentnum (@agentnums) {
diff --git a/httemplate/search/report_queued_newtax.cgi b/httemplate/search/report_queued_newtax.cgi
index a375fce62..1d5813ece 100755
--- a/httemplate/search/report_queued_newtax.cgi
+++ b/httemplate/search/report_queued_newtax.cgi
@@ -1,10 +1,16 @@
-<% $server->process %>
+<% include("/elements/header.html", "Queue Tax Report") %>
+<% include("/elements/error.html") %>
+% unless ($error) {
+ <CENTER>
+ Report queued. Check the job queue for status.
+ </CENTER>
+% }
+<% include("/elements/footer.html") %>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $server =
- new FS::UI::Web::JSRPC 'FS::tax_rate::queue_liability_report', $cgi;
+my $error = FS::tax_rate::queue_liability_report($cgi);
</%init>
diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
index 57228a501..3696ed40d 100755
--- a/httemplate/search/report_receivables.cgi
+++ b/httemplate/search/report_receivables.cgi
@@ -29,12 +29,24 @@ die "access denied"
# )
sub balance {
- my($start, $end, $cutoff) = @_; #, %opt ?
+ my($start, $end, $offset) = @_; #, %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 . ' )'
+ : '';
+
+ #$opt{'unapplied_date'} = 1;
+
+ FS::cust_main->balance_date_sql( $start, $end, 'unapplied_date'=>1,
+ 'cutoff' => "( $str2time now() $closing - ".$offset * 86400 . ')' );
- FS::cust_main->balance_date_sql( $start, $end,
- 'cutoff' => $cutoff,
- 'unapplied_date'=>1,
- );
}
</%once>
diff --git a/httemplate/search/report_rt_transaction.html b/httemplate/search/report_rt_transaction.html
index 61445bd1e..9b7b7cbbb 100644
--- a/httemplate/search/report_rt_transaction.html
+++ b/httemplate/search/report_rt_transaction.html
@@ -8,24 +8,6 @@
<% include ( '/elements/tr-select-otaker.html' ) %>
- <% include ( '/elements/tr-input-text.html',
- 'label' => 'Ticket #',
- 'field' => 'ticketid',
- )
- %>
-
- <TR>
- <TD>Account</TD>
- <TD>
- <SELECT NAME="svcnum">
- <OPTION VALUE="">(all)
-% foreach my $svc_acct (@svc_acct) {
- <OPTION VALUE="<% $svc_acct->svcnum %>"><% $svc_acct->username %></OPTION>
-% }
- </SELECT>
- </TD>
- </TR>
-
</TABLE>
<BR>
@@ -39,18 +21,4 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
-my $conf = new FS::Conf;
-
-my @pkgparts = $conf->config('support_packages');
-
-my @svc_acct = ();
-if ( @pkgparts ) {
- @svc_acct = qsearch({
- 'table' => 'svc_acct',
- 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
- ' LEFT JOIN cust_pkg USING ( pkgnum ) ',
- 'extra_sql' => 'WHERE pkgpart IN ('. join(',', @pkgparts). ')',
- });
-}
-
</%init>
diff --git a/httemplate/search/rt_transaction.html b/httemplate/search/rt_transaction.html
index 8dda4baea..651f2896d 100644
--- a/httemplate/search/rt_transaction.html
+++ b/httemplate/search/rt_transaction.html
@@ -3,12 +3,11 @@
'name_singular' => 'transaction',
'query' => $query,
'count_query' => $count_query,
- 'count_addl' => [ $format_seconds_sub, $format_seconds_sub, ],
+ 'count_addl' => [ $format_seconds_sub, ],
'header' => [ 'Ticket #',
'Ticket',
'Date',
'Time',
- 'Applied',
],
'fields' => [ 'ticketid',
sub { encode_entities(shift->get('subject')) },
@@ -16,16 +15,12 @@
sub { my $seconds = shift->get('transaction_time');
&{ $format_seconds_sub }( $seconds );
},
- sub { my $seconds = shift->get('support');
- &{ $format_seconds_sub }( $seconds );
- },
],
'links' => [
$link,
$link,
'',
'',
- '',
],
)
%>
@@ -33,9 +28,7 @@
my $format_seconds_sub = sub {
my $seconds = shift;
- #(($seconds < 0) ? '-' : '') . concise(duration($seconds));
- (($seconds < 0) ? '-' : '' ). int(abs($seconds)/3600)."h".sprintf("%02d",(abs(
-$seconds)%3600)/60)."m";
+ (($seconds < 0) ? '-' : '') . concise(duration($seconds));
};
</%once>
@@ -54,9 +47,8 @@ my $transactiontime = "
";
my $join = 'JOIN Tickets ON Transactions.ObjectId = Tickets.Id '.
- 'JOIN Users ON Transactions.Creator = Users.Id '.
- 'LEFT JOIN acct_rt_transaction '.
- ' ON Transactions.Id = acct_rt_transaction.transaction_id';
+ 'JOIN Users ON Transactions.Creator = Users.Id ';
+
my $where = "
WHERE objecttype='RT::Ticket'
AND ( ( Transactions.Type = 'Set'
@@ -85,26 +77,20 @@ if ( $cgi->param('otaker') && $cgi->param('otaker') =~ /^([\w\.\-]+)$/ ) {
$where .= " AND Users.name = '$1' ";
}
-if ( $cgi->param('ticketid') =~ /^\s*(\d+)\s*$/ ) {
- $where .= " AND Tickets.ID = $1";
-}
-
-if ( $cgi->param('svcnum') =~ /^\s*(\d+)\s*$/ ) {
- $where .= " AND acct_rt_transaction.svcnum = $1";
-}
-
my $query = {
- 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time, acct_rt_transaction.support",
+ 'select' => "Transactions.*, Tickets.Id AS ticketid, Tickets.Subject, Users.name as otaker, $transactiontime AS transaction_time",
#'table' => 'Transactions',
'table' => 'transactions',
- 'addl_from' => $join,
+ 'addl_from' => $join.
+ 'LEFT JOIN acct_rt_transaction '.
+ ' ON Transactions.Id = acct_rt_transaction.transaction_id',
'extra_sql' => $where,
'order by' => 'ORDER BY Created',
};
my $count_query =
- "SELECT COUNT(*), SUM($transactiontime), SUM(acct_rt_transaction.support) FROM Transactions $join $where";
+ "SELECT COUNT(*), SUM($transactiontime) FROM Transactions $join $where";
-my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('ticketid'); } ];
+my $link = [ "${p}rt/Ticket/Display.html?id=", sub { shift->get('id'); } ];
</%init>
diff --git a/httemplate/search/sql.html b/httemplate/search/sql.html
index bf5446975..df9b8cddb 100644
--- a/httemplate/search/sql.html
+++ b/httemplate/search/sql.html
@@ -1,15 +1,13 @@
<% include( 'elements/search.html',
'title' => 'Query Results',
'name' => 'rows',
- 'query' => "SELECT $sql",
- )
+ 'query' => 'SELECT '. ( $cgi->param('sql')
+ || errorpage('Empty query') ),
+ )
%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Raw SQL');
-my $sql = $cgi->param('sql') or errorpage('Empty query');
-$sql =~ s/;+\s*$//; #remove trailing ;
-
</%init>
diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html
index e232291fe..73361c00b 100755
--- a/httemplate/search/unapplied_cust_pay.html
+++ b/httemplate/search/unapplied_cust_pay.html
@@ -13,11 +13,18 @@ die "access denied"
<%once>
sub unapplied_payments {
- my($start, $end, $cutoff) = @_;
+ my($start, $end, $offset) = @_;
+
+ #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 . ' )'
+ : '';
+
+ FS::cust_main->unapplied_payments_date_sql( $start, $end );
- FS::cust_main->unapplied_payments_date_sql( $start, $end,
- 'cutoff' => $cutoff,
- );
}
</%once>