<OPTION VALUE="">all</OPTION>
% }
-% foreach my $otaker ( @{ $opt{'otakers'} } ) {
- <OPTION VALUE="<% shift(@{$opt{'usernums'}}) %>"><% $otaker %></OPTION>
+% foreach my $usernum ( keys %{ $opt{'access_user'} } ) {
+ <OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION>
% }
</SELECT>
my %opt = @_;
-unless ( $opt{'otakers'} ) {
+unless ( $opt{'access_user'} ) {
- my $sth = dbh->prepare("SELECT username,usernum FROM access_user".
- " WHERE disabled = '' or disabled IS NULL")
- or die dbh->errstr;
+ tie %{ $opt{'access_user'} }, 'Tie::IxHash';
+
+ my $sth = dbh->prepare("
+ SELECT usernum, username FROM access_user
+ WHERE disabled = '' or disabled IS NULL
+ ORDER BY username
+ ") or die dbh->errstr;
$sth->execute or die $sth->errstr;
- for($sth->fetchall_arrayref) {
- $opt{'otakers'} = [ map { $_->[0] } @$_ ];
- $opt{'usernums'} = [ map { $_->[1] } @$_ ];
+ while ( my $row = $sth->fetchrow_arrayref ) {
+ $opt{'access_user'}->{$row->[0]} = $row->[1];
}
}
'netsales' => "${p}search/cust_bill.html?agentnum=$agentnum;net=1;",
'credits' => "${p}search/cust_credit.html?agentnum=$agentnum;",
'netcredits' => "${p}search/cust_credit_bill.html?agentnum=$agentnum;",
- 'payments' => "${p}search/cust_pay.cgi?magic=_date;agentnum=$agentnum;",
+ 'payments' => "${p}search/cust_pay.html?magic=_date;agentnum=$agentnum;",
'receipts' => "${p}search/cust_bill_pay.html?agentnum=$agentnum;",
'refunds' => "${p}search/cust_refund.html?magic=_date;agentnum=$agentnum;",
'netrefunds' => "${p}search/cust_credit_refund.html?agentnum=$agentnum;",
% } else {
%
%
-<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %>
% }
-<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %>
<%init>
my $fh = $cgi->upload('csvfile');
+++ /dev/null
-<% include( 'elements/cust_pay_or_refund.html',
- 'thing' => 'pay',
- 'amount_field' => 'paid',
- 'name_singular' => 'payment',
- 'name_verb' => 'paid',
- )
-%>
--- /dev/null
+<% include( 'elements/cust_pay_or_refund.html',
+ 'thing' => 'pay',
+ 'amount_field' => 'paid',
+ 'name_singular' => 'payment',
+ 'name_verb' => 'paid',
+ )
+%>
push @search, "$table.payinfo = '$1'";
}
- if ( $cgi->param('otaker') =~ /^(\w+)$/ ) {
- push @search, "$table.otaker = '$1'";
+ if ( $cgi->param('usernum') =~ /^(\d+)$/ ) {
+ push @search, "$table.usernum = $1";
}
#for cust_pay_pending... statusNOT=done
--- /dev/null
+<%doc>
+
+Examples:
+
+ include( 'elements/report_cust_pay_or_refund.html',
+ 'thing' => 'pay',
+ 'name_singular' => 'payment',
+ )
+
+ include( 'elements/report_cust_pay_or_refund.html',
+ 'thing' => 'refund',
+ 'name_singular' => 'refund',
+ )
+
+</%doc>
+<% include('/elements/header.html', $title ) %>
+
+<FORM ACTION="<% $table %>.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
+
+<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TH CLASS="background" COLSPAN=2 ALIGN="left">
+ <FONT SIZE="+1">Search options</FONT>
+ </TH>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right"><% ucfirst(PL($name_singular)) %> of type: </TD>
+ <TD>
+ <SELECT NAME="payby" onChange="payby_changed(this)">
+ <OPTION VALUE="">all</OPTION>
+ <OPTION VALUE="CARD">credit card (all)</OPTION>
+ <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
+ <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
+ <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
+ <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
+ <OPTION VALUE="CHEK">electronic check / ACH</OPTION>
+ <OPTION VALUE="BILL">check</OPTION>
+ <OPTION VALUE="PREP">prepaid card</OPTION>
+ <OPTION VALUE="CASH">cash</OPTION>
+ <OPTION VALUE="WEST">Western Union</OPTION>
+ <OPTION VALUE="MCRD">manual credit card</OPTION>
+ </SELECT>
+ </TD>
+ </TR>
+
+ <SCRIPT TYPE="text/javascript">
+
+ function payby_changed(what) {
+ if ( what.options[what.selectedIndex].value == 'BILL' ) {
+ document.getElementById('checkno_caption').style.color = '#000000';
+ what.form.payinfo.disabled = false;
+ what.form.payinfo.style.backgroundColor = '#ffffff';
+ } else {
+ document.getElementById('checkno_caption').style.color = '#bbbbbb';
+ what.form.payinfo.disabled = true;
+ what.form.payinfo.style.backgroundColor = '#dddddd';
+ }
+ }
+
+ </SCRIPT>
+
+ <TR>
+ <TD ALIGN="right"><FONT ID="checkno_caption" COLOR="#bbbbbb">Check #: </FONT></TD>
+ <TD>
+ <INPUT TYPE="text" NAME="payinfo" DISABLED STYLE="background-color: #dddddd">
+ </TD>
+ </TR>
+
+ <% include( '/elements/tr-select-agent.html',
+ 'curr_value' => scalar($cgi->param('agentnum')),
+ 'label' => 'for agent: ',
+ 'disable_empty' => 0,
+ )
+ %>
+
+ <% include( '/elements/tr-select-user.html' ) %>
+
+ <TR>
+ <TD ALIGN="right" VALIGN="center">Payment</TD>
+ <TD>
+ <TABLE>
+ <% include( '/elements/tr-input-beginning_ending.html',
+ layout => 'horiz',
+ )
+ %>
+ </TABLE>
+ </TD>
+ </TR>
+
+% if ( $void ) {
+ <TR>
+ <TD ALIGN="right" VALIGN="center">Voided</TD>
+ <TD>
+ <TABLE>
+ <% include( '/elements/tr-input-beginning_ending.html',
+ prefix => 'void',
+ layout => 'horiz',
+ )
+ %>
+ </TABLE>
+ </TD>
+ </TR>
+% }
+
+ <% include( '/elements/tr-input-lessthan_greaterthan.html',
+ 'label' => 'Amount',
+ 'field' => 'paid',
+ )
+ %>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+my %opt = @_;
+my $table = 'cust_'.$opt{'thing'};
+my $name_singular = $opt{'name_singular'};
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+
+my $void = $cgi->param('void') ? 1 : 0;
+
+my $title = $void ? "Voided $name_singular report" : "\u$name_singular report";
+$table .= '_void' if $void;
+
+</%init>
-<% include('/elements/header.html', $title ) %>
-
-<FORM ACTION="<% $void ? 'cust_pay_void.html' : 'cust_pay.cgi' %>" METHOD="GET">
-<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
-
-<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
-
- <TR>
- <TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1">Search options</FONT>
- </TH>
- </TR>
-
- <TR>
- <TD ALIGN="right">Payments of type: </TD>
- <TD>
- <SELECT NAME="payby" onChange="payby_changed(this)">
- <OPTION VALUE="">all</OPTION>
- <OPTION VALUE="CARD">credit card (all)</OPTION>
- <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
- <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
- <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
- <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
- <OPTION VALUE="CHEK">electronic check / ACH</OPTION>
- <OPTION VALUE="BILL">check</OPTION>
- <OPTION VALUE="PREP">prepaid card</OPTION>
- <OPTION VALUE="CASH">cash</OPTION>
- <OPTION VALUE="WEST">Western Union</OPTION>
- <OPTION VALUE="MCRD">manual credit card</OPTION>
- </SELECT>
- </TD>
- </TR>
-
- <SCRIPT TYPE="text/javascript">
-
- function payby_changed(what) {
- if ( what.options[what.selectedIndex].value == 'BILL' ) {
- document.getElementById('checkno_caption').style.color = '#000000';
- what.form.payinfo.disabled = false;
- what.form.payinfo.style.backgroundColor = '#ffffff';
- } else {
- document.getElementById('checkno_caption').style.color = '#bbbbbb';
- what.form.payinfo.disabled = true;
- what.form.payinfo.style.backgroundColor = '#dddddd';
- }
- }
-
- </SCRIPT>
-
- <TR>
- <TD ALIGN="right"><FONT ID="checkno_caption" COLOR="#bbbbbb">Check #: </FONT></TD>
- <TD>
- <INPUT TYPE="text" NAME="payinfo" DISABLED STYLE="background-color: #dddddd">
- </TD>
- </TR>
-
- <% include( '/elements/tr-select-agent.html',
- 'curr_value' => scalar($cgi->param('agentnum')),
- 'label' => 'for agent: ',
- 'disable_empty' => 0,
- )
- %>
-
- <% include( '/elements/tr-select-otaker.html' ) %>
-
- <TR>
- <TD ALIGN="right" VALIGN="center">Payment</TD>
- <TD>
- <TABLE>
- <% include( '/elements/tr-input-beginning_ending.html',
- layout => 'horiz',
- )
- %>
- </TABLE>
- </TD>
- </TR>
-
-% if ( $void ) {
- <TR>
- <TD ALIGN="right" VALIGN="center">Voided</TD>
- <TD>
- <TABLE>
- <% include( '/elements/tr-input-beginning_ending.html',
- prefix => 'void',
- layout => 'horiz',
- )
- %>
- </TABLE>
- </TD>
- </TR>
-% }
-
- <% include( '/elements/tr-input-lessthan_greaterthan.html',
- 'label' => 'Amount',
- 'field' => 'paid',
- )
- %>
-
-</TABLE>
-
-<BR>
-<INPUT TYPE="submit" VALUE="Get Report">
-
-</FORM>
-
-<% include('/elements/footer.html') %>
-<%init>
-
-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-
-my $void = $cgi->param('void') ? 1 : 0;
-
-my $title = $void ? 'Voided payment report' : 'Payment report';
-
-</%init>
+<% include( 'elements/report_cust_pay_or_refund.html',
+ 'thing' => 'pay',
+ 'name_singular' => 'payment',
+ )
+%>
-<% include('/elements/header.html', $title ) %>
-
-<FORM ACTION="<% $void ? 'cust_refund_void.html' : 'cust_refund.html' %>" METHOD="GET">
-<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
-
-<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
-
- <TR>
- <TH CLASS="background" COLSPAN=2 ALIGN="left">
- <FONT SIZE="+1">Search options</FONT>
- </TH>
- </TR>
-
- <TR>
- <TD ALIGN="right">Refunds of type: </TD>
- <TD>
- <SELECT NAME="payby" onChange="payby_changed(this)">
- <OPTION VALUE="">all</OPTION>
- <OPTION VALUE="CARD">credit card (all)</OPTION>
- <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION>
- <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION>
- <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION>
- <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION>
- <OPTION VALUE="CHEK">electronic check / ACH</OPTION>
- <OPTION VALUE="BILL">check</OPTION>
- <OPTION VALUE="PREP">prepaid card</OPTION>
- <OPTION VALUE="CASH">cash</OPTION>
- <OPTION VALUE="WEST">Western Union</OPTION>
- <OPTION VALUE="MCRD">manual credit card</OPTION>
- </SELECT>
- </TD>
- </TR>
-
- <SCRIPT TYPE="text/javascript">
-
- function payby_changed(what) {
- if ( what.options[what.selectedIndex].value == 'BILL' ) {
- document.getElementById('checkno_caption').style.color = '#000000';
- what.form.payinfo.disabled = false;
- what.form.payinfo.style.backgroundColor = '#ffffff';
- } else {
- document.getElementById('checkno_caption').style.color = '#bbbbbb';
- what.form.payinfo.disabled = true;
- what.form.payinfo.style.backgroundColor = '#dddddd';
- }
- }
-
- </SCRIPT>
-
- <TR>
- <TD ALIGN="right"><FONT ID="checkno_caption" COLOR="#bbbbbb">Check #: </FONT></TD>
- <TD>
- <INPUT TYPE="text" NAME="payinfo" DISABLED STYLE="background-color: #dddddd">
- </TD>
- </TR>
-
- <% include( '/elements/tr-select-agent.html',
- 'curr_value' => scalar($cgi->param('agentnum')),
- 'label' => 'for agent: ',
- 'disable_empty' => 0,
- )
- %>
-
- <% include( '/elements/tr-select-otaker.html' ) %>
-
- <TR>
- <TD ALIGN="right" VALIGN="center">Refund</TD>
- <TD>
- <TABLE>
- <% include( '/elements/tr-input-beginning_ending.html',
- layout => 'horiz',
- )
- %>
- </TABLE>
- </TD>
- </TR>
-
-% if ( $void ) {
- <TR>
- <TD ALIGN="right" VALIGN="center">Voided</TD>
- <TD>
- <TABLE>
- <% include( '/elements/tr-input-beginning_ending.html',
- prefix => 'void',
- layout => 'horiz',
- )
- %>
- </TABLE>
- </TD>
- </TR>
-% }
-
- <% include( '/elements/tr-input-lessthan_greaterthan.html',
- 'label' => 'Amount',
- 'field' => 'paid',
- )
- %>
-
-</TABLE>
-
-<BR>
-<INPUT TYPE="submit" VALUE="Get Report">
-
-</FORM>
-
-<% include('/elements/footer.html') %>
-<%init>
-
-die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-
-my $void = $cgi->param('void') ? 1 : 0;
-
-my $title = $void ? 'Voided refund report' : 'Refund report';
-
-</%init>
+<% include( 'elements/report_cust_pay_or_refund.html',
+ 'thing' => 'refund',
+ 'name_singular' => 'refund',
+ )
+%>