-<HTML>
- <HEAD>
- <TITLE>Credit report criteria</TITLE>
- <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
- <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
- <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
- <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
- </HEAD>
- <BODY BGCOLOR="#e8e8e8">
- <H1>Credit report criteria</H1>
- <FORM ACTION="cust_credit.html" METHOD="post">
- <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
- <TABLE>
- <TR>
- <TD ALIGN="right">Credits by employee: </TD>
-<%
- my $sth = dbh->prepare("SELECT DISTINCT otaker FROM cust_credit")
- or die dbh->errstr;
- $sth->execute or die $sth->errstr;
- my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
-%>
- <TD><SELECT NAME="otaker">
- <OPTION VALUE="">all</OPTION>
- <% foreach my $otaker ( @otakers ) { %>
- <OPTION VALUE="<%= $otaker %>"><%= $otaker %></OPTION>
- <% } %>
- </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">
- Calendar.setup({
- inputField: "beginning_text",
- ifFormat: "%m/%d/%Y",
- button: "beginning_button",
- align: "BR"
- });
-</SCRIPT>
- </TR>
- <TR>
- <TD ALIGN="right">To: </TD>
- <TD><INPUT TYPE="text" NAME="ending" ID="ending_text" VALUE="" SIZE=11 MAXLENGTH=10> <IMG SRC="../images/calendar.png" ID="ending_button" STYLE="cursor: pointer" TITLE="Select date"><BR><i>m/d/y</i></TD>
-<SCRIPT TYPE="text/javascript">
- Calendar.setup({
- inputField: "ending_text",
- ifFormat: "%m/%d/%Y",
- button: "ending_button",
- align: "BR"
- });
-</SCRIPT>
- </TR>
- </TABLE>
- <BR><INPUT TYPE="submit" VALUE="Get Report">
- </FORM>
- </BODY>
-</HTML>
+<% include('/elements/header.html', 'Credit report' ) %>
+
+<FORM ACTION="cust_credit.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="_date">
+
+<TABLE>
+ <TR>
+ <TD ALIGN="right">Credits by employee: </TD>
+
+ <TD>
+ <SELECT NAME="otaker">
+ <OPTION VALUE="">all</OPTION>
+% foreach my $otaker ( @otakers ) {
+ <OPTION VALUE="<% $otaker %>"><% $otaker %></OPTION>
+% }
+ </SELECT>
+ </TD>
+ </TR>
+
+ <% include( '/elements/tr-select-agent.html',
+ $cgi->param('agentnum'),
+ 'label' => 'for agent: ',
+ )
+ %>
+
+ <% include( '/elements/tr-input-beginning_ending.html' ) %>
+
+ <% include( '/elements/tr-input-lessthan_greaterthan.html',
+ 'label' => 'Amount',
+ 'field' => 'amount',
+ )
+ %>
+
+</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 $sth = dbh->prepare("SELECT DISTINCT otaker FROM cust_credit")
+ or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
+
+</%init>