<td></td>
<td ><select name="status"><option value=""> </option><option value="debarred">debarred</option><option value="gonenoadress">gone no adress</option><option value="lost">lost</option></td>
</tr>
+ <tr>
+ <td>Patron activity</td>
+ <td></td>
+ <td></td>
+ <td ><select name="activity"><option value=""> </option><option value="active">active</option><option value="nonactive">no active</option></td>
+ </tr>
+
+ <tr class="hilighted">
+ <td> </td>
+ <td colspan="2"><select name="period">
+ <option value ="1">1</option>
+ <option value ="2">2</option>
+ <option value ="3">3</option>
+ </select>
+ years of activity
+ </td>
+ <td> </td>
+ </tr>
+
<tr class="hilighted">
<td>
Zip Code
</td>
<td> </td>
</tr>
+ <tr class="hilighted">
+ <td>
+ Branch
+ </td>
+ <td><input type="radio" name="Line" value="branchcode" /></td>
+ <td><input type="radio" name="Column" value="branchcode" /></td>
+ <td><!-- TMPL_VAR NAME="CGIBranch" --></td>
+ </tr>
+
+ <tr class="hilighted">
+ <td>Date of Birth</td>
+ <td></td>
+ <td></td>
+ <td > From <input type="text" readonly="readonly" size="10" id="from" name="Filter" />
+ <img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" border="0" hspace="0" vspace="0" id="openCalendarFrom" style="cursor: pointer;" valign="top">
+ <script language="JavaScript" type="text/javascript">
+ function validate1(date) {
+ var day = date.getDate();
+ var month = date.getMonth() + 1;
+ var year = date.getFullYear();
+ var weekDay = date.getDay();
+ var dayMonth = month + '-' + day;
+ var dateString = year + '-' + month + '-' + day;
+ var dateTo = document.getElementById('to').value.split("-");
+ var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
+ if (date > limitDate) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ Calendar.setup(
+ {
+ inputField : "from",
+ ifFormat : "%Y-%m-%d",
+ button : "openCalendarFrom",
+ disableFunc : validate1,
+ dateStatusFunc : validate1
+ }
+ );
+ </script>
+ To <input readonly="readonly" size="10" id="to" name="Filter" value="" type="text" />
+ <img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" valign="top" border="0" hspace="0" vspace="0">
+ <script type="text/javascript">
+ function validate2(date) {
+ var day = date.getDate();
+ var month = date.getMonth() + 1;
+ var year = date.getFullYear();
+ var weekDay = date.getDay();
+ var dayMonth = month + '-' + day;
+ var dateString = year + '-' + month + '-' + day;
+ var dateFrom = document.getElementById('from').value.split("-");
+ var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
+ if (limitDate > date) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ Calendar.setup(
+ {
+ inputField : "to",
+ ifFormat : "%Y-%m-%d",
+ button : "openCalendarTo",
+ disableFunc : validate2,
+ dateStatusFunc : validate2
+ }
+ );
+ </script>
+ </td>
+ </tr>
+
<!-- TMPL_IF name="hassort1" -->
<tr>
<td>Sort1</td>
use C4::Acquisition;
use C4::Output;
use C4::Circulation;
+use Date::Calc qw(
+ Today
+ Add_Delta_YM
+ );
=head1 NAME
my $column = $input->param("Column");
my @filters = $input->param("Filter");
my $digits = $input->param("digits");
+my $period = $input->param("period");
my $borstat = $input->param("status");
my $borstat1 = $input->param("activity");
my $output = $input->param("output");
if ($activity) {
push @loopfilter,{crit=>"Activity",filter=>$activity};
}
+# year of activity
+ my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);
+ my $newperioddate=$period_year."-".$period_month."-".$period_day;
+ warn "PERIOD".$period;
# 1st, loop rows.
my $linefield;
if (($line =~/zipcode/) and ($digits)) {
$strcalc .= " AND sort1 like '" . @$filters[5] ."'" if ( @$filters[5] );
@$filters[6]=~ s/\*/%/g if (@$filters[6]);
$strcalc .= " AND sort2 like '" . @$filters[6] ."'" if ( @$filters[6] );
- $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) from issues where timestamp > ' 2007-01-01')" if ($activity eq 'active');
- $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from issues where timestamp > ' 2007-01-01')" if ($activity eq 'nonactive');
+ $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) from issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'active');
+ $strcalc .= " AND borrowernumber not in (select distinct(borrowernumber) from issues where issuedate > '" . $newperioddate . "')" if ($activity eq 'nonactive');
$strcalc .= " AND $status='1' " if ($status);
$strcalc .= " group by $linefield, $colfield";
warn "". $strcalc;