Koha/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt
Owen Leonard 09f011493c Bug 28949: Use Flatpickr on reports pages
This patch replaces the use of jQueryUI's datepicker on reports pages.

To test, apply the patch and test the following reports pages to confirm
that datepickers work correctly. "Linked" date fields should prevent a
"to" selection which preceeds the selected "from" date.

- Acquisitions statistic wizard: Linked pairs of fields for
  "placed on" and "received on."
- Patrons with the most checkouts: Linked pairs of fields for
  "Checkout date from" and "Check-in date from"
- Patrons who haven't checked out: "Not checked out since"
  field.
- Cash register statistics wizard: Linked "From" and "To"
  fields.
- Most-circulated items: Linked pairs of fields for
  "Checkout date from" and "Check-in date from"
- Catalog statistics wizard: Linked pairs of fields for "Date acquired
  (item)" and "Date deleted (item)" The latter is shown by checking the
  "Count deleted items" radio button.
- View dictionary -> New definition:
  - Enter a definition name
  - Select table Circulation
  - Choose a date column, e.g. "Date of birth" or "Registration date"
  - Select "Date range"
    - Test that the "Start of date range" and "End of date range" fields
      are linked correctly.
- Create guided report:
  - Module: catalog
  - Type: Tabular
  - Select columns (any)
  - Select criteria to limit on: There should be three pairs of linked
    fields, "Creation date," "Modification date," and "Due date."
  - Confirm that the report is saved correctly with the dates you chose.
- Create from SQL -> Test a report with one or more date
  fields, e.g. https://wiki.koha-community.org/wiki/SQL_Reports_Library#Items_added_by_Collection
- Average loan time: Linke pairs of fields for "Checkout
  date" and "Returns."
- Reports -> Circulation statistics wizard: Linked "Period" fields.
- Reports -> Holds statistics wizard: Linked pairs of fields "Hold
  date," "Notification date," "Reminder date," "Waiting date," and
  "Cancellation date."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-05 10:58:13 +02:00

371 lines
14 KiB
Text

[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( do_it ) %]Acquisitions statistics &rsaquo; Results[% ELSE %]Acquisitions statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="rep_acquisitions_stats" class="rep">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
</li>
[% IF ( do_it ) %]
<li>
<a href="/cgi-bin/koha/reports/acquisitions_stats.pl">Acquisitions statistics</a>
</li>
<li>
<a href="#" aria-current="page">
Results
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Acquisitions statistics
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF ( do_it ) %]
[% FOREACH mainloo IN mainloop %]
<h1>Acquisitions statistics </h1>
[% IF ( mainloo.loopfilter.size ) %]
<p><strong>Filtered on:</strong></p>
[% FOREACH loopfilte IN mainloo.loopfilter %]
<p>
[% SWITCH loopfilte.crit %]
[% CASE '0' %] Placed on (from)
[% CASE '1' %] Placed on (to)
[% CASE '2' %] Received on (from)
[% CASE '3' %] Received on (to)
[% CASE '4' %] Vendor
[% CASE '5' %] Home library
[% CASE '6' %] Collection
[% CASE '7' %] Item type
[% CASE '8' %] Fund
[% CASE '9' %] Sort1
[% CASE '10' %] Sort2
[% CASE %] Unknown filter
[% END %]
: [% loopfilte.filter | html %]
</p>
[% END %]
[% END %]
<table>
<tr >
<th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
[% FOREACH loopco IN mainloo.loopcol %]
<th>[% loopco.coltitle | html %]</th>
[% END %]
<th>TOTAL</th>
</tr>
[% FOREACH loopro IN mainloo.looprow %]
<tr>
[% IF ( loopro.hilighted ) %]<td class="hilighted">[% ELSE %]<td>[% END %]
[% loopro.rowtitle | html %]</td>
[% FOREACH loopcel IN loopro.loopcell %]
[% IF ( loopcel.hilighted ) %]<td>[% ELSE %]<td>[% END %]
[% IF ( loopcel.value ) %][% loopcel.value | html %]
[% ELSE %] &nbsp;
[% END %]
</td>
[% END %]
[% IF ( loopro.hilighted ) %]<td>[% ELSE %]<td>[% END %]
[% loopro.totalrow | html %]
</td>
</tr>
[% END %]
<tr >
<th>TOTAL</th>
[% FOREACH loopfoote IN mainloo.loopfooter %]
<th>
[% loopfoote.totalcol | html %]
</th>
[% END %]
<th>[% mainloo.total | html %]</th>
</tr>
</table>
[% END %]
[% ELSE %]
<form method="post" action="/cgi-bin/koha/reports/acquisitions_stats.pl">
<fieldset class="rows">
<legend>Acquisitions statistics</legend>
<table>
<thead>
<tr>
<th>Title</th>
<th>Row</th>
<th>Column</th>
<th>Filter</th>
</tr>
</thead>
<tbody>
<tr class="hilighted">
<td>Placed on</td>
<td><input type="radio" name="Line" value="aqbasket.closedate" /></td>
<td><input type="radio" checked="checked" name="Column" value="aqbasket.closedate" /> </td>
<td>
From <input type="text" size="10" id="placedonfrom" name="Filter" value="" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
To <input size="10" id="placedonto" name="Filter" type="text" value="" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</td>
</tr>
<tr class="hilighted">
<td>&nbsp;</td>
<td colspan="2">group by <select name="PlacedOnDisplay">
<option value="">None</option>
<option value ="1">Day of week</option>
<option value ="2">Month</option>
<option value ="3">Year</option>
</select>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Received on</td>
<td><input type="radio" name="Line" value="aqorders.datereceived" /></td>
<td><input type="radio" name="Column" value="aqorders.datereceived" /></td>
<td>
From <input type="text" size="10" id="receivedonfrom" name="Filter" value="" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
To <input type="text" size="10" id="receivedonto" name="Filter" value="" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">group by <select name="ReceivedOnDisplay">
<option value="">None</option>
<option value ="1">Day of week</option>
<option value ="2">Month</option>
<option value ="3">Year</option>
</select>
</td>
<td>&nbsp;</td>
</tr>
<tr class="hilighted">
<td>Vendor</td>
<td><input type="radio" checked="checked" name="Line" value="aqbooksellers.name" /></td>
<td><input type="radio" name="Column" value="aqbooksellers.name" /></td>
<td>
<select name="Filter">
<option value="">All vendors</option>
[% FOREACH bookseller IN booksellers %]
<option value="[% bookseller.name | html %]">[% bookseller.name | html %]</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>Home library</td>
<td><input type="radio" name="Line" value="items.homebranch" /></td>
<td><input type="radio" name="Column" value="items.homebranch" /></td>
<td>
<select name="Filter">
<option value="" selected="selected">All libraries</option>
[% FOREACH branch IN branches %]
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>
[% IF ccode_label %]
[% ccode_label | html %]
[% ELSE %]
Collection
[% END %]
</td>
<td><input type="radio" name="Line" value="items.ccode" /></td>
<td><input type="radio" name="Column" value="items.ccode" /></td>
<td>
[% IF ccode_avlist.size %]
<select name="Filter">
<option value="" selected="selected">All</option>
[% FOREACH ccode_av IN ccode_avlist %]
<option value="[% ccode_av.authorised_value | html %]">[% ccode_av.lib | html %]</option>
[% END %]
</select>
[% ELSE %]
<input type="text" name="Filter" />
[% END %]
</td>
</tr>
<tr>
<td>Item type</td>
<td><input type="radio" name="Line" value="biblioitems.itemtype" /></td>
<td><input type="radio" name="Column" value="biblioitems.itemtype" /></td>
<td>
<select name="Filter" id="itemtypes">
<option value="">All item types</option>
[% FOREACH itemtype IN itemtypes %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
[% END %]
</select>
</td>
</tr>
<tr>
<td>Fund</td>
<td><input type="radio" name="Line" value="aqbudgets.budget_code" /></td>
<td><input type="radio" name="Column" value="aqbudgets.budget_code" /></td>
<td>
<select name="Filter" id="budget">
<option value="">All funds</option>
[% FOREACH value IN Budgets.values %]
<option value="[% value | html %]">[% Budgets.labels.$value | html %]</option>
[% END %]
</select>
</td>
</tr>
[% IF ( hassort1 ) %]
<tr class="hilighted">
<td>Sort1</td>
<td><input type="radio" name="Line" value="aqorders.sort1" /></td>
<td><input type="radio" name="Column" value="aqorders.sort1" /></td>
<td>
<select name="Filter" id="sort1">
<option value="">All</option>
[% FOREACH value IN Sort1.values %]
<option value="[% value | html %]">[% Sort1.labels.$value | html %]</option>
[% END %]
</select>
</td>
</tr>
[% END %]
[% IF ( hassort2 ) %]
[% IF ( HglghtSort2 ) %]<tr class="hilighted"> [% ELSE %]<tr>[% END %]
<td>Sort2</td>
<td><input type="radio" name="Line" value="aqorders.sort2" /></td>
<td><input type="radio" name="Column" value="aqorders.sort2" /></td>
<td>
<select name="Filter" id="sort2">
<option value="">All</option>
[% FOREACH value IN Sort2.values %]
<option value="[% value | html %]">[% Sort2.labels.$value | html %]</option>
[% END %]
</select>
</td>
</tr>
[% END %]
</tbody>
</table><br />
</fieldset>
<fieldset class="rows">
<legend> Cell value </legend>
<ol>
<li>
<label for="cellvalue1">Count items:</label><input type="radio" name="Cellvalue" id="cellvalue1" value="1" checked="checked" />
</li>
<li>
<label for="cellvalue2">Count unique bibliographic records:</label><input type="radio" name="Cellvalue" id="cellvalue2" value="2" />
</li>
<li>
<label for="cellvalue3">Amount:</label><input type="radio" name="Cellvalue" id="cellvalue3" value="3" />
</li>
<li>
<label for="cellvalue4">Ordered amount:</label><input type="radio" name="Cellvalue" id="cellvalue4" value="4" />
</li>
<li>
<label for="cellvalue5">Spent amount:</label><input type="radio" name="Cellvalue" id="cellvalue5" value="5" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Output</legend>
<ol>
<li>
<label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
</li>
<li>
<label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
<label class="inline" for="basename">Named: </label> <input type="text" name="basename" id="basename" value="Export" />
<label class="inline" for="MIME">Into an application:</label>
<select name="MIME" id="MIME">
<option value="CSV">CSV</option>
</select>
<select name="sep" id="sep">
[% FOREACH value IN CGIsepChoice.values.sort() %]
[% IF ( value == CGIsepChoice.default ) %]
<option value="[% value | html %]" selected="selected">[% value | html %]</option>
[% ELSE %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
[% END %]
</select>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<input type="hidden" name="report_name" value="[% report_name | html %]" />
<input type="hidden" name="do_it" value="1" />
</fieldset>
</form>
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'reports-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
var placedonfrom = $("#placedonfrom").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
placedonto.set('minDate', selectedDates[0]);
}
});
var placedonto = $("#placedonto").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
var receivedonfrom = $("#receivedonfrom").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
receivedonto.set('minDate', selectedDates[0]);
}
});
var receivedonto = $("#receivedonto").flatpickr({
onClose: function( selectedDates, dateText, instance) {
validate_date( selectedDates, instance );
},
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]