freeside/httemplate/search report_cust_pay.html,1.5,1.6 cust_pay.cgi,1.12,1.13 report_cust_credit.html,1.3,1.4 cust_credit.html,1.2,1.3
ivan
ivan at pouncequick.420.am
Fri Mar 4 04:34:59 PST 2005
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory pouncequick:/tmp/cvs-serv14575/httemplate/search
Modified Files:
report_cust_pay.html cust_pay.cgi report_cust_credit.html
cust_credit.html
Log Message:
add agent selection to payment and credit reports, add link to agent browse, closes: Bug#1105
Index: report_cust_pay.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_pay.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- report_cust_pay.html 22 Sep 2004 11:28:13 -0000 1.5
+++ report_cust_pay.html 4 Mar 2005 12:34:55 -0000 1.6
@@ -25,6 +25,16 @@
</TD>
</TR>
<TR>
+ <TD ALIGN="right">for agent: </TD>
+ <TD><SELECT NAME="agentnum">
+ <OPTION VALUE="">all</OPTION>
+ <% foreach my $agent ( qsearch('agent', { disabled=>'' } ) ) { %>
+ <OPTION VALUE="<%= $agent->agentnum %>"<%= $cgi->param('agentnum') == $agent->agentnum ? ' SELECTED' : '' %>><%= $agent->agent %>
+ <% } %>
+ </SELECT>
+ </TD>
+ </TR>
+ <TR>
<TD ALIGN="right">From: </TD>
<TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
<SCRIPT TYPE="text/javascript">
Index: cust_pay.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_pay.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cust_pay.cgi 19 Aug 2004 00:22:29 -0000 1.12
+++ cust_pay.cgi 4 Mar 2005 12:34:55 -0000 1.13
@@ -1,9 +1,17 @@
<%
+ my $title = 'Payment Search Results';
my( $count_query, $sql_query );
if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) {
- my %search;
- my @search;
+ my %search = ();
+ my @search = ();
+
+ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ push @search, "agentnum = $1"; # $search{'agentnum'} = $1;
+ my $agent = qsearchs('agent', { 'agentnum' => $1 } );
+ die "unknown agentnum $1" unless $agent;
+ $title = $agent->agent. " $title";
+ }
if ( $cgi->param('payby') ) {
$cgi->param('payby') =~ /^(CARD|CHEK|BILL)(-(VisaMC|Amex|Discover))?$/
@@ -59,14 +67,17 @@
}
my $hsearch = join(' AND ', map { "$_ = '$search{$_}'" } keys %search );
- $count_query = "SELECT COUNT(*), SUM(paid) FROM cust_pay ".
+ $count_query = "SELECT COUNT(*), SUM(paid) ".
+ "FROM cust_pay JOIN cust_main USING ( custnum )".
( $hsearch ? " WHERE $hsearch " : '' ).
$search;
+ warn join('-', keys %search);
$sql_query = {
'table' => 'cust_pay',
'hashref' => \%search,
'extra_sql' => "$search ORDER BY _date",
+ 'addl_from' => 'JOIN cust_main USING ( custnum )',
};
} else {
@@ -93,7 +104,7 @@
%>
<%= include( 'elements/search.html',
- 'title' => 'Payment Search Results',
+ 'title' => $title,
'name' => 'payments',
'query' => $sql_query,
'count_query' => $count_query,
@@ -117,12 +128,8 @@
sub { sprintf('$%.2f', shift->paid ) },
sub { time2str('%b %d %Y', shift->_date ) },
'custnum',
- sub { my $cust_main = shift->cust_main;
- $cust_main->get('last'). ', '. $cust_main->first;
- },
- sub { my $cust_main = shift->cust_main;
- $cust_main->company;
- },
+ sub { $_[0]->get('last'). ', '. $_[0]->first; },
+ 'company',
],
'align' => 'lrrrll',
'links' => [
Index: report_cust_credit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_credit.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- report_cust_credit.html 22 Sep 2004 11:28:13 -0000 1.3
+++ report_cust_credit.html 4 Mar 2005 12:34:55 -0000 1.4
@@ -28,6 +28,16 @@
</TD>
</TR>
<TR>
+ <TD ALIGN="right">for agent: </TD>
+ <TD><SELECT NAME="agentnum">
+ <OPTION VALUE="">all</OPTION>
+ <% foreach my $agent ( qsearch('agent', { disabled=>'' } ) ) { %>
+ <OPTION VALUE="<%= $agent->agentnum %>"<%= $cgi->param('agentnum') == $agent->agentnum ? ' SELECTED' : '' %>><%= $agent->agent %>
+ <% } %>
+ </SELECT>
+ </TD>
+ </TR>
+ <TR>
<TD ALIGN="right">From: </TD>
<TD><INPUT TYPE="text" NAME="beginning" ID="beginning_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="beginning_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
<SCRIPT TYPE="text/javascript">
Index: cust_credit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_credit.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cust_credit.html 19 Aug 2004 16:35:17 -0000 1.2
+++ cust_credit.html 4 Mar 2005 12:34:55 -0000 1.3
@@ -1,4 +1,5 @@
<%
+ my $title = 'Credit Search Results';
#my( $count_query, $sql_query );
my @search = ();
@@ -7,6 +8,13 @@
push @search, "otaker = '$1'";
}
+ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+ push @search, "agentnum = $1"; # $search{'agentnum'} = $1;
+ my $agent = qsearchs('agent', { 'agentnum' => $1 } );
+ die "unknown agentnum $1" unless $agent;
+ $title = $agent->agent. " $title";
+ }
+
#false laziness with cust_pkg.cgi and cust_pay.cgi
if ( $cgi->param('beginning')
&& $cgi->param('beginning') =~ /^([ 0-9\-\/]{1,10})$/ ) {
@@ -32,18 +40,22 @@
? 'WHERE '. join(' AND ', @search)
: '';
- my $count_query = "SELECT COUNT(*), SUM(amount) FROM cust_credit $where";
+ my $count_query = 'SELECT COUNT(*), SUM(amount) '.
+ 'FROM cust_credit JOIN cust_main USING ( custnum ) '.
+ $where;
+
my $sql_query = {
'table' => 'cust_credit',
'hashref' => {},
'extra_sql' => $where,
+ 'addl_from' => 'JOIN cust_main USING ( custnum )',
};
my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
%>
<%= include( 'elements/search.html',
- 'title' => 'Credit Search Results',
+ 'title' => $title,
'name' => 'credits',
'query' => $sql_query,
'count_query' => $count_query,
@@ -57,12 +69,8 @@
sub { sprintf('$%.2f', shift->amount ) },
sub { time2str('%b %d %Y', shift->_date ) },
'custnum',
- sub { my $cust_main = shift->cust_main;
- $cust_main->get('last'). ', '. $cust_main->first;
- },
- sub { my $cust_main = shift->cust_main;
- $cust_main->company;
- },
+ sub { $_[0]->get('last'). ', '. $_[0]->first; },
+ 'company',
'otaker',
'reason',
],
More information about the freeside-commits
mailing list