1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha › Reports › Guided Reports Wizard
3 [% IF ( saved1 ) %]› Saved Reports
4 [% ELSIF ( create ) %]› Create from SQL
5 [% ELSIF ( showsql ) %]› Saved Reports › SQL View
6 [% ELSIF ( execute ) %]› Saved Reports › [% name %] Report
7 [% ELSIF ( buildx ) %]› Build A Report, Step [% buildx %] of 6:
8 [% IF ( build1 ) %]Choose a Module
9 [% ELSIF ( build2 ) %]Pick a Report Type
10 [% ELSIF ( build3 ) %]Select Columns for Display
11 [% ELSIF ( build4 ) %]Select Criteria to Limit on
12 [% ELSIF ( build5 ) %]Pick which columns to total
13 [% ELSIF ( build6 ) %]Select how you want the report ordered
17 [% INCLUDE 'doc-head-close.inc' %]
18 [% INCLUDE 'calendar.inc' %]
19 <style type="text/css">
20 #sql { width: 90%; height: 9em;}
22 <script type="text/javascript">
24 $(document).ready(function(){
26 $("#sql").focus(function() {
31 $(".confirmdelete").click(function(){
32 $(this).parents('tr').attr("class","warn");
33 if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){
36 $(this).parents('tr').attr("class","");
46 [% INCLUDE 'header.inc' %]
47 [% INCLUDE 'circ-search.inc' %]
49 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
50 › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
51 › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a>
53 [% IF ( saved1 ) %]Saved Reports
54 [% ELSIF ( create ) %]Create from SQL
55 [% ELSIF ( showsql ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> › SQL View
56 [% ELSIF ( execute ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> › <em>[% name %]</em> Report
57 [% ELSIF ( buildx ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build A Report</a> › Step [% buildx %] of 6:
58 [% IF ( build1 ) %]Choose a Module
59 [% ELSIF ( build2 ) %]Pick a Report Type
60 [% ELSIF ( build3 ) %]Select Columns for Display
61 [% ELSIF ( build4 ) %]Select Criteria to Limit on
62 [% ELSIF ( build5 ) %]Pick which columns to total
63 [% ELSIF ( build6 ) %]Select how you want the report ordered
68 <div id="doc3" class="yui-t1">
74 <h2>Guided Reports</h2>
75 <p>Use the guided reports engine to create non standard reports.
76 This feature aims to provide some middle ground between the built in
77 canned reports and writing custom SQL reports.</p>
79 <h3>Build And Run Reports</h3>
80 [% IF ( CAN_user_reports_create_reports ) %]
81 <form action="/cgi-bin/koha/reports/guided_reports.pl">
82 <input type="hidden" name="phase" value="Build new" />
83 <input type="submit" name="submit" value="Build new"/>
86 [% IF ( CAN_user_reports_execute_reports ) %]
87 <form action="/cgi-bin/koha/reports/guided_reports.pl">
88 <input type="hidden" name="phase" value="Use saved"/>
89 <input type="submit" name="submit" value="Use saved"/>
92 [% IF ( CAN_user_reports_create_reports ) %]
93 <form action="/cgi-bin/koha/reports/guided_reports.pl">
94 <input type="hidden" name="phase" value="Create report from SQL"/>
95 <input type="submit" name="submit" value="Create report from SQL"/>
98 <h3>Reports Dictionary</h3>
99 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
100 <form action="/cgi-bin/koha/reports/dictionary.pl">
101 <input type="hidden" name="phase" value="View Dictionary"/>
102 <input type="submit" name="submit" value="View Dictionary"/>
107 [% IF ( savedreports ) %]<h1>Saved Reports</h1>
108 <p>Choose the report to run from the list</p>
109 <form action="/cgi-bin/koha/reports/guided_reports.pl">
111 <tr><th>ID</th><th>Report Name</th><th>Type</th><th>Notes</th><th>Author</th><th>Creation Date</th><th>Saved Results</th><th>Saved SQL</th><th colspan="3"> </th></tr>
112 [% FOREACH savedreport IN savedreports %]
113 [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
114 <td>[% savedreport.id %]</td>
115 <td>[% savedreport.report_name %]</td>
116 <td>[% savedreport.type %]</td>
117 <td>[% savedreport.notes %]</td>
118 <td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td>
119 <td>[% savedreport.date_created %]</td>
120 <td>[% IF ( savedreport.date_run ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% savedreport.id %]">[% savedreport.date_run %]</a>[% END %]
123 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Show%20SQL">Show SQL</a>
124 [% IF ( savedreport.CAN_user_reports_create_reports ) %]
125 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Edit%20SQL">Edit SQL</a>
128 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Run%20this%20report">Run</a></td>
129 <td><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]">Schedule</a></td>
130 [% IF ( savedreport.CAN_user_reports_create_reports ) %]
131 <td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Delete%20Saved">Delete</a></td>
137 [% ELSE %]<h4>There are no saved reports.
138 [% IF ( CAN_user_reports_create_reports ) %]
139 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a>
147 <h1>Build A Report</h1>
148 <form action="/cgi-bin/koha/reports/guided_reports.pl">
149 <fieldset class="rows">
150 <legend>Step 1 of 6: Choose a Module to Report on</legend>
151 <ol><li><label for="areas">Choose: </label><select name="areas" id="areas">
152 [% FOREACH area IN areas %]
153 <option value="[% area.id %]">[% area.name %]</option>
157 <fieldset class="action">
158 <input type="hidden" name="phase" value="Report on this Area" />
159 <input type="submit" name="submit" value="Next >>" />
167 <h1>Build A Report</h1>
168 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
169 <input type="hidden" name="area" value="[% area %]" />
170 <fieldset class="rows"><legend>Step 2 of 6: Pick a Report Type</legend>
171 <ol><li><label for="types">Choose: </label>
172 <select id="types" name="types">
173 <option value="1">Tabular</option>
174 <option value="2" disabled="disabled">Summary</option>
175 <option value="3" disabled="disabled">Matrix</option>
177 </li></ol></fieldset>
179 <fieldset class="action">
180 <input type="hidden" name="phase" value="Choose this type" />
181 <input type="button" name="back" value="<< Back" onclick="javascript:history.back()" />
182 <input type="submit" name="submit" value="Next >>" />
186 <div class="yui-gb"><div class="yui-u first"></div>
188 <!--- Summary and Matrix reports have not yet been implemented-->
189 <!--<div class="yui-u">Summary:
190 <img src="/intranet-tmpl/prog/img/reports-summary-graphic.gif" /></div>
191 <div class="yui-u">Matrix:
192 <img src="/intranet-tmpl/prog/img/reports-matrix-graphic.gif" /></div>-->
197 <h3>Step 3 of 6: Select Columns for Display</h3>
198 <p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
200 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
201 <input type="hidden" name="area" value="[% area %]" />
202 <input type="hidden" name="type" value="[% type %]" />
205 <div class="yui-u first"> <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
206 [% FOREACH column IN columns %]
207 [% IF ( column.table ) %]
209 [% IF ( loop.first ) %]
214 <optgroup label="[% column.table %]">
216 <option value="[% column.name %]">
217 [% IF ( column.description ) %][% column.description %]
226 <div style="width: 6.3em; float: right; margin-top: 100px"><input type="button" name="Add" value="Add" class="button" style="width:6em;" onclick="addColumn()" /><br />
227 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" onclick="delColumn()" /></div>
231 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
236 <fieldset class="action">
237 <input type="hidden" name="phase" value="Choose these columns" />
238 <input type="button" name="back" value="<< Back" onclick="javascript:history.back()" />
239 <input type="submit" name="submit" value="Next >>" />
247 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
248 <input type="hidden" name="area" value="[% area %]" />
249 <input type="hidden" name="type" value="[% type %]" />
250 <input type="hidden" name="column" value="[% column %]" />
251 <fieldset><legend>Step 4 of 6: Select Criteria to Limit on</legend>
253 [% FOREACH criteri IN criteria %]
256 <input type="checkbox" name="criteria_column" id="[% criteri.name %]" value="[% criteri.name %]" />
257 <label for="[% criteri.name %]">[% criteri.description %] </label>
259 [% IF ( criteri.date ) %]
261 <input type="text" size="10" id="[% criteri.name %]_value" name="[% criteri.name %]_value" value="" />
262 <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
263 <script type="text/javascript">
265 inputField : "[% criteri.name %]_value",
266 ifFormat : "[% criteri.DHTMLcalendar_dateformat %]",
267 button : "buttonfrom[% criteri.name %]",
271 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
275 [% IF ( criteri.textrange ) %]
277 <input type="text" size="10" id="[% criteri.from %]_value" name="[% criteri.from %]_value" value="" /> to
278 <input type="text" size="10" id="[% criteri.to %]_value" name="[% criteri.to %]_value" value="" />
282 [% IF ( criteri.daterange ) %]
284 <input type="text" size="10" id="from_[% criteri.name %]_value" name="from_[% criteri.name %]_value" value="" />
285 <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfromfrom_[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
286 <script type="text/javascript">
288 inputField : "from_[% criteri.name %]_value",
289 ifFormat : "[% criteri.DHTMLcalendar_dateformat %]",
290 button : "buttonfromfrom_[% criteri.name %]",
295 <input type="text" size="10" id="to_[% criteri.name %]_value" name="to_[% criteri.name %]_value" value="" />
296 <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfromto_[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
297 <script type="text/javascript">
299 inputField : "to_[% criteri.name %]_value",
300 ifFormat : "[% criteri.DHTMLcalendar_dateformat %]",
301 button : "buttonfromto_[% criteri.name %]",
305 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
310 <select name="[% criteri.name %]_value">
311 [% FOREACH value IN criteri.values %]
312 <option value="[% value.availablevalues %]">[% IF ( value.default ) %]Default[% ELSE %][% value.availablevalues |html %][% END %]</option>
324 [% IF ( definitions ) %]
325 <fieldset><legend>Dictionary Definitions</legend><table>
326 [% FOREACH definition IN definitions %]
327 <tr><td><input type="checkbox" name="definition" value="<!--
328 TMPL_VAR NAME="id" -->" /> [% definition.name %]</td></tr>
333 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
334 <input type="button" name="back" value="<< Back" onclick="javascript:history.back()" />
335 <input type="submit" name="submit" value="Next >>" /> </fieldset>
341 <h3>Step 5 of 6: Pick which columns to total</h3>
342 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
343 <input type="hidden" name="area" value="[% area %]" />
344 <input type="hidden" name="type" value="[% type %]" />
345 <input type="hidden" name="column" value="[% column %]" />
346 <input type="hidden" name="definition" value="[% definition %]" />
347 <input type="hidden" name="criteria" value="[% criteriastring %]" />
349 [% FOREACH total_b IN total_by %]
350 <tr><td><input type="checkbox" name="total_by" id="<!-- TMPL_VAR
351 NAME="name" -->" value="<!-- TMPL_VAR
352 NAME="name" -->" /> <label for="<!-- TMPL_VAR
353 NAME="name" -->">[% total_b.name %]</label></td>
354 <td><select name="[% total_b.name %]_tvalue">
356 [% FOREACH selec IN total_b.select %]
357 <option value="[% selec.value %]">[% selec.value %]</option>
365 <fieldset class="action"><input type="hidden" name="phase" value="Choose These Operations" />
366 <input type="button" name="back" value="<< Back" onclick="javascript:history.back()" />
367 <input type="submit" name="submit" value="Next >>" /></fieldset>
373 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
374 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
375 <input type="hidden" name="area" value="[% area %]" />
376 <input type="hidden" name="type" value="[% type %]" />
377 <input type="hidden" name="column" value="[% column %]" />
378 <input type="hidden" name="criteria" value="[% criteriastring %]" />
379 <input type="hidden" name="definition" value="[% definition %]" />
380 <input type="hidden" name="totals" value="[% totals %]" />
381 <fieldset><table>[% FOREACH order_b IN order_by %]
382 <tr><td><input type="checkbox" id="<!-- TMPL_VAR
383 NAME="name" -->" name="order_by" value="<!-- TMPL_VAR
384 NAME="name" -->" /> <label for="<!-- TMPL_VAR
385 NAME="name" -->">[% order_b.name %]</label></td><td>
386 <select name="[% order_b.name %]_ovalue">
388 [% FOREACH selec IN order_b.select %]
389 <option value="[% selec.value %]">[% selec.value %]</option>
397 <fieldset class="action">
398 <input type="hidden" name="phase" value="Build Report" />
399 <input type="submit" name="submit" value="Finish" /></fieldset>
404 [% IF ( showreport ) %]
405 <h1>Confirm Custom Report</h1>
406 <p>Your report will be generated with the following SQL statement.</p>
411 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
412 <input type="hidden" name="sql" value="[% sql %]" />
413 <input type="hidden" name="type" value="[% type %]" />
414 <p>You will need to save the report before you can execute it</p>
415 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
416 <input type="submit" name="submit" value="Save" /> </fieldset>
421 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
422 <input type="hidden" name="sql" value="[% sql |html %]" />
423 <input type="hidden" name="type" value="[% type %]" />
424 <fieldset class="rows">
425 <legend>Save Your Custom Report</legend>
427 <li><label for="reportname">Report Name: </label><input type="text" id="reportname" name="reportname" /></li>
428 <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
430 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
431 <input type="submit" name="submit" value="Save Report" /></fieldset>
435 [% IF ( enter_params ) %]
436 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
437 <input type='hidden' name='phase' value='Run this report' />
438 <input type='hidden' name='reports' value="[% reports %]" />
439 <h1>Enter parameters for report [% name %]:</h1>
440 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
441 [% FOREACH sql_param IN sql_params %]
442 <p>[% sql_param.entry %]: [% sql_param.input %]</p>
444 <input type='submit' value='Run the report'/>
450 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
451 [% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
453 [% DEFAULT pagination_bar="" %]
454 [% UNLESS ( errors ) %]
456 <tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
457 [% FOREACH result IN results %]
459 [% FOREACH cell IN result.cells %]<td>[% cell.cell %]</td>[% END %]
463 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
464 <fieldset class="action">
465 <label for="format">Download the report: </label>
466 <select name="format" id="format">
467 <option value="csv">Comma Separated Text</option>
468 <option value="tab">Tab Separated Text</option>
470 <input type="hidden" name="sql" value="[% sql |html %]" />
471 <input type="hidden" name="phase" value="Export" />
472 <input type="submit" name="submit" value="Download" /></fieldset>
478 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
479 <fieldset class="rows">
480 <legend>Create Report From SQL</legend>
482 <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" [% IF ( reportname ) %] value="[% reportname %]"[% END %] /> </li>
483 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% DEFAULT notes="" %]</textarea></li>
484 <li><label for="types">Type:</label>
485 <select id="types" name="types">
486 <option value="1">Tabular</option>
487 <option value="2" disabled="disabled">Summary</option>
488 <option value="3" disabled="disabled">Matrix</option>
493 <fieldset class="rows">
494 <legend>SQL:</legend>
495 <div style="margin:1em;">
496 <textarea id="sql" name="sql" cols="50" rows="10">[% DEFAULT sql="" %]</textarea>
500 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
501 <input type="submit" name="submit" value="Save Report" /></fieldset>
505 [% IF ( compound ) %]
506 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
507 Master: <select name="master">
508 [% FOREACH savedreport IN savedreports %]
509 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
513 Sub report:<select name="subreport">
514 [% FOREACH savedreport IN savedreports %]
515 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
519 <input type="hidden" name="phase" value="Save Compound" />
520 <input type="submit" name="submit" value="Save Compound" />
524 [% IF ( save_compound ) %]
530 [% IF ( retresults ) %]
531 <h1>Saved Report Results</h1>
535 [% FOREACH result IN results %]
542 <textarea id="sql">[% sql %]</textarea>
546 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
547 <input type="hidden" name="phase" value="Update SQL" />
548 <input type="hidden" name="id" value="[% id %]"/>
549 <fieldset class="rows">
550 <legend>Edit SQL</legend>
552 <li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="[% reportname %]" /></li>
553 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
554 <li><textarea id="sql" name="sql" rows="10" cols="60">[% sql %]</textarea></li>
558 <fieldset class="action">
559 <input type="submit" name="submit" value="Update SQL" /></fieldset>
565 [% IF ( save_successful ) %]
566 [% UNLESS ( errors ) %]
567 <h2>Your report has been saved</h2>
568 <p>The report you have created has now been saved. You can now</p>
570 <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
571 <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
572 <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
578 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
579 <div class="dialog alert">
580 <b>The following error was encountered:</b><br />
581 [% FOREACH error IN errors %]
582 [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr %]</b>.
583 <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
584 <br />Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
585 [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr %]<br />Please check the log for further details.
590 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
591 <input type="submit" name="submit" value="Saved Reports" /></fieldset>
598 [% INCLUDE 'guided-reports-view.inc' %]
601 <script type="text/javascript">
603 function addColumn() {
604 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
606 function delColumn() {
607 $("#selectedColumns option:selected").remove();
609 $("#column_submit").submit(function() {
610 if ($("#selectedColumns option").size() < 1) {
611 alert(_("No columns selected!"));
614 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
619 [% INCLUDE 'intranet-bottom.inc' %]