1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha › Reports › Guided Reports<!-- TMPL_IF NAME="create" --> › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a> › <strong>Create from SQL</strong><!-- /TMPL_IF --></title>
4 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
5 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
8 <!-- TMPL_INCLUDE NAME="header.inc" -->
9 <!-- TMPL_INCLUDE NAME="circ-search.inc" -->
11 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
12 › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a><!-- TMPL_IF NAME="start" --> › <strong>Guided Reports Wizard </strong><!-- /TMPL_IF --><!-- TMPL_IF NAME="saved1" --> › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a> › <strong>Saved Reports</strong><!-- /TMPL_IF --><!-- TMPL_IF NAME="create" --> › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a> › <strong>Create from SQL</strong><!-- /TMPL_IF --><!-- TMPL_IF NAME="showsql" -->
13 › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a> › Saved Reports › <strong>SQL View</strong><!-- /TMPL_IF --></div>
15 <div id="doc3" class="yui-t1">
23 <!-- TMPL_IF NAME="start" -->
24 <h2>Guided Reports</h2>
25 <p>Use the guided reports engine to create non standard reports.
26 This feature aims to provide some middle ground between the built in
27 canned reports and writing custom SQL reports.</p>
29 <h3>Build And Run Reports</h3>
30 <form action="/cgi-bin/koha/reports/guided_reports.pl">
31 <input type="hidden" name="phase" value="Build new" />
32 <input type="submit" name="submit" value="Build new"/>
34 <form action="/cgi-bin/koha/reports/guided_reports.pl">
35 <input type="hidden" name="phase" value="Used saved"/>
36 <input type="submit" name="submit" value="Used saved"/>
38 <form action="/cgi-bin/koha/reports/guided_reports.pl">
39 <input type="hidden" name="phase" value="Create report from SQL"/>
40 <input type="submit" name="submit" value="Create report from SQL"/>
43 <h3>Reports Dictionary</h3>
44 <p>Use the reports dictionary to define custom criteria to use in your
46 <form action="/cgi-bin/koha/reports/dictionary.pl">
47 <input type="hidden" name="phase" value="View Dictionary"/>
48 <input type="submit" name="submit" value="View Dictionary"/>
52 <!-- TMPL_IF NAME="saved1" -->
53 <h1>Saved Reports</h1>
54 <p>Choose the report to run from the list</p>
56 <form action="/cgi-bin/koha/reports/guided_reports.pl">
57 <th>Report Name</th><th>Type</th><th>Notes</th><th>Saved Results</th><th>Saved SQL</th><th>Delete</th>
58 <!-- TMPL_LOOP NAME="savedreports" -->
59 <tr><td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&phase=Run%20this%20report"><!-- TMPL_VAR NAME="report_name" --></td>
60 <td><!-- TMPL_VAR NAME="type" --></td>
61 <td><!-- TMPL_VAR NAME="notes" --></td>
62 <td><!-- TMPL_IF NAME="date_run" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="date_run" --></a><!-- /TMPL_IF -->
64 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&phase=Show%20SQL">Show SQL</a></td>
65 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&phase=Delete%20Saved">Delete</a></td></tr>
72 <!-- TMPL_IF NAME="build1" -->
73 <h1>Build A Report</h1>
74 <h3>Step 1 of 6: Choose a Module to Report on</h3>
75 <form action="/cgi-bin/koha/reports/guided_reports.pl">
77 <!-- TMPL_LOOP NAME="areas" -->
78 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
82 <input type=button value="Back" onClick="history.go(-1)">
83 <input type="hidden" name="phase" value="Report on this Area">
84 <input type="submit" name="submit" value="Report on this Area">
89 <!-- TMPL_IF NAME="build2" -->
90 <h1>Build A Report</h1>
91 <h3>Step 2 of 6: Pick a Report Type</h3>
92 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
93 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->">
95 <!-- TMPL_LOOP NAME="types" -->
96 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
100 <input type=button value="Back" onClick="history.go(-1)">
101 <input type="hidden" name="phase" value="Choose this type">
102 <input type="submit" name="submit" value="Choose this type">
106 <img src="/intranet-tmpl/prog/img/reports-tabular-graphic.gif" />
107 <!--- Summary and Matrix reports have not yet been implemented-->
109 <img src="/intranet-tmpl/prog/img/reports-summary-graphic.gif" />
111 <img src="/intranet-tmpl/prog/img/reports-matrix-graphic.gif" />-->
115 <!-- TMPL_IF NAME="build3" -->
116 <h3>Step 3 of 6: Select Columns for Display</h3>
117 <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>
118 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
119 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->">
120 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
121 <select id="availableColumns" name="oldcolumns2" multiple size="25" style="width:200px;height:300px;">
122 <!-- TMPL_LOOP NAME="columns" -->
123 <!-- TMPL_IF NAME="table" -->
125 <!-- TMPL_IF NAME="__first__" -->
130 <optgroup label="<!-- TMPL_VAR NAME="table"-->">
132 <option value="<!-- TMPL_VAR NAME="name" -->">
133 <!-- TMPL_IF NAME="description" --><!-- TMPL_VAR NAME="description" -->
135 <!-- TMPL_VAR NAME="name" -->
141 <input type="button" name="Add" value="Add" class="button" onClick="addColumn()"/>
142 <select id="selectedColumns" name="columns" multiple size="25" style="width:200px;height:300px;"></select>
143 <input type="button" name="delete" value="delete" class="button" onClick="delColumn()"/>
145 <input type=button value="Back" onClick="history.go(-1)">
146 <input type="hidden" name="phase" value="Choose these columns">
147 <input type="submit" name="submit" value="Choose these columns">
151 <!-- TMPL_IF NAME="build4" -->
152 <h3>Step 4 of 6: Select Criteria to Limit on </h3>
154 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
155 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->">
156 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
157 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->">
159 <!-- TMPL_LOOP NAME="criteria" -->
160 <tr><td><input type=checkbox name="criteria_column" value="<!-- TMPL_VAR
161 NAME="name" -->"> <!-- TMPL_VAR NAME="description" -->
163 <!-- TMPL_IF NAME="date" -->
164 <td><input type="text" size="10" id="<!-- TMPL_VAR NAME="name"
165 -->_value" name="<!-- TMPL_VAR NAME="name" -->_value" value=""
166 ><img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom1" style="cursor: pointer;" />
167 <script type="text/javascript">
169 inputField : "<!-- TMPL_VAR NAME="name" -->_value",
170 ifFormat : "%Y-%m-%d",
171 button : "buttonfrom1",
177 <td><select name="<!-- TMPL_VAR NAME="name" -->_value">
178 <!-- TMPL_LOOP NAME="values" -->
179 <option value="<!-- TMPL_VAR NAME="availablevalues"-->"><!-- TMPL_VAR NAME="availablevalues" --></option>
186 <!-- TMPL_IF NAME="definitions" -->
187 <h4>Dictionary Definitions</h4> <br />
189 <!-- TMPL_LOOP NAME="definitions" -->
191 <tr><td><input type=checkbox name="definition" value="<!--
192 TMPL_VAR NAME="id" -->"> <!-- TMPL_VAR NAME="name" --></td></tr>
197 <input type=button value="Back" onClick="history.go(-1)">
198 <input type="hidden" name="phase" value="Choose these criteria">
199 <input type="submit" name="submit" value="Choose these criteria">
204 <!-- TMPL_IF NAME="build5" -->
205 <h3>Step 5 of 6: Pick which columns to total</h3>
206 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
207 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->">
208 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
209 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->">
210 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->">
211 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->">
213 <!-- TMPL_LOOP NAME="total_by" -->
214 <tr><td><input type=checkbox name="total_by" value="<!-- TMPL_VAR
215 NAME="name" -->"> <!-- TMPL_VAR NAME="name"--></td>
216 <td><select name="<!-- TMPL_VAR NAME="name" -->_tvalue">
218 <!-- TMPL_LOOP NAME="select" -->
219 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
226 <input type=button value="Back" onClick="history.go(-1)">
227 <input type="hidden" name="phase" value="Choose These Operations">
228 <input type="submit" name="submit" value="Choose These Operations">
233 <!-- TMPL_IF NAME="build6" -->
234 <h3>Step 6 of 6: Select how you want the report ordered</h3>
235 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
236 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->">
237 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
238 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->">
239 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->">
240 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->">
241 <input type="hidden" name="totals" value="<!-- TMPL_VAR NAME="totals" -->">
242 <table><!-- TMPL_LOOP NAME="order_by" -->
243 <tr><td><input type=checkbox name="order_by" value="<!-- TMPL_VAR
244 NAME="name" -->"> <!-- TMPL_VAR NAME="name"--></td><td>
245 <select name="<!-- TMPL_VAR NAME="name" -->_ovalue">
247 <!-- TMPL_LOOP NAME="select" -->
248 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
256 <input type=button value="Back" onClick="history.go(-1)">
257 <input type="hidden" name="phase" value="Build Report">
258 <input type="submit" name="submit" value="Build Report">
263 <!-- TMPL_IF NAME="showreport" -->
264 <h1>Confirm Custom Report</h1>
265 <p>Your report will be generated with the following SQL statement.
267 <!-- TMPL_VAR NAME="sql" -->
270 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
271 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" -->">
272 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
273 <p>You will need to save the report before you can execute it</p>
274 <input type=button value="Back" onClick="history.go(-1)">
275 <input type="hidden" name="phase" value="Save">
276 <input type="submit" name="submit" value="Save">
280 <!-- TMPL_IF NAME="save" -->
281 <h1>Save Your Custom Report</h1>
282 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
283 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" -->">
284 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->">
285 Report Name: <input type="text" name="reportname"> <br />
286 Notes: <textarea name="notes"></textarea><br />
287 <input type="hidden" name="phase" value="Save Report">
288 <input type="submit" name="submit" value="Save Report">
292 <!-- TMPL_IF NAME="execute" -->
293 <h1>Show results</h1>
294 <h2><!-- TMPL_VAR NAME="name" --></h2>
295 <p><!-- TMPL_VAR NAME="notes" --></p>
297 <!-- TMPL_LOOP NAME="results" -->
298 <!-- TMPL_VAR NAME="row" -->
300 <p>Download the report</p>
302 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
303 <select name="format">
304 <option value="csv">Comma Separated Text</option>
305 <option value="tab">Tab Separated Text</option>
307 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" -->">
308 <input type="hidden" name="phase" value="Export">
309 <input type="submit" name="submit" value="Export">
313 <!-- TMPL_IF NAME="create" -->
314 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
315 <fieldset class="rows">
316 <legend>Create Report From SQL</legend>
318 <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" /> </li>
319 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2"></textarea></li>
320 <li><label for="types">Type:</label><select id="types" name="types"><!-- TMPL_LOOP NAME="types" --><option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option><!-- /TMPL_LOOP --></select></li>
321 <li><label for="sql">SQL: </label><textarea id="sql" name="sql" cols="50" rows="10"></textarea></li>
325 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" /><input type="submit" name="submit" value="Save Report" /></fieldset>
329 <!-- TMPL_IF NAME="compound" -->
330 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
331 Master: <select name="master">
332 <!-- TMPL_LOOP NAME="savedreports" -->
333 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
337 Sub report:<select name="subreport">
338 <!-- TMPL_LOOP NAME="savedreports" -->
339 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
343 <input type="hidden" name="phase" value="Save Compound" />
344 <input type="submit" name="submit" value="Save Compound" />
348 <!-- TMPL_IF NAME="save_compound" -->
349 <!-- TMPL_VAR NAME="master" --> <br />
350 <!-- TMPL_VAR NAME="subsql" -->
354 <!-- TMPL_IF NAME="retresults" -->
355 <h1>Saved Report Results</h1>
356 <h2><!-- TMPL_VAR NAME="name" --></h2>
357 <p><!-- TMPL_VAR NAME="notes" --></p>
359 <!-- TMPL_LOOP NAME="results" -->
360 <!-- TMPL_VAR NAME = "row" -->
366 <!-- TMPL_IF NAME="showsql" -->
367 <!-- TMPL_VAR NAME="sql" -->
370 <!-- TMPL_IF NAME="save_successful" -->
371 <!-- TMPL_VAR NAME="sql" -->
372 <h1>Save Your Custom Report</h1>
373 <h2>Your report has been saved</h2>
374 <p>The report you have created has now been saved. You can now</p>
376 <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Used+saved">Saved Reports Page</a></li>
377 <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
378 <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Used+saved">Guided Reports</a></li>
389 <!-- TMPL_INCLUDE NAME="guided-reports-view.inc" -->
392 <script type="text/javascript">
394 function setObjects() {
395 selectedColumnsObj=document.getElementById('selectedColumns');
396 availableColumnsObj=document.getElementById('availableColumns');
400 function addColumn() {
401 for (i=0;i<availableColumnsObj.length;i++) {
402 if (availableColumnsObj.options[i].selected==true) {
403 var newColumnObj=document.createElement("OPTION");
404 newColumnObj.value=availableColumnsObj.options[i].value;
405 newColumnObj.text=availableColumnsObj.options[i].text;
406 selectedColumnsObj.appendChild(newColumnObj);
407 newColumnObj.selected=true;
412 function delColumn() {
413 for (i=0;i<=selectedColumnsObj.options.length;i++) {
414 if (selectedColumnsObj.options.selectedIndex>=0)
415 selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
420 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->