Improved guided reports (#3929)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Reports &rsaquo; Guided Reports Wizard 
3 <!-- TMPL_IF    NAME="saved1"  -->&rsaquo; Saved Reports
4 <!-- TMPL_ELSIF NAME="create"  -->&rsaquo; Create from SQL
5 <!-- TMPL_ELSIF NAME="showsql" -->&rsaquo; Saved Reports &rsaquo; SQL View
6 <!-- TMPL_ELSIF NAME="execute" -->&rsaquo; Saved Reports &rsaquo; <!-- TMPL_VAR NAME="name" --> Report
7 <!-- TMPL_ELSIF NAME="buildx"  -->&rsaquo; Build A Report, Step <!-- TMPL_VAR NAME="buildx" --> of 6:
8 <!-- TMPL_IF    NAME="build1" -->Choose a Module
9 <!-- TMPL_ELSIF NAME="build2" -->Pick a Report Type
10 <!-- TMPL_ELSIF NAME="build3" -->Select Columns for Display
11 <!-- TMPL_ELSIF NAME="build4" -->Select Criteria to Limit on
12 <!-- TMPL_ELSIF NAME="build5" -->Pick which columns to total
13 <!-- TMPL_ELSIF NAME="build6" -->Select how you want the report ordered
14 <!-- /TMPL_IF -->
15 <!-- /TMPL_IF -->
16 </title>
17 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
18 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
19 <style type="text/css">
20     #sql { width: 90%; height: 9em; border: 1px solid #EEE; }
21 </style>
22 <script type="text/javascript">
23 //<![CDATA[
24 $(document).ready(function(){
25 <!-- TMPL_IF NAME="showsql" -->
26     $("#sql").focus(function() {
27         $(this).select();
28     });
29 <!-- /TMPL_IF -->
30 <!-- TMPL_IF NAME="saved1" -->
31     $(".confirmdelete").click(function(){
32         $(this).parents('tr').attr("class","warn");
33         if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){
34             return true;
35         } else {
36             $(this).parents('tr').attr("class","");
37             return false;
38         }
39     });
40 <!-- /TMPL_IF -->
41 });
42 //]]>
43 </script>
44 </head>
45 <body>
46 <!-- TMPL_INCLUDE NAME="header.inc" -->
47 <!-- TMPL_INCLUDE NAME="circ-search.inc" -->
48
49 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
50 &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
51 &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a>
52 &rsaquo; 
53 <!-- TMPL_IF NAME="saved1"  --><strong>Saved Reports</strong>
54 <!-- TMPL_ELSIF NAME="create"  --><strong>Create from SQL</strong>
55 <!-- TMPL_ELSIF NAME="showsql" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; <strong>SQL View</strong>
56 <!-- TMPL_ELSIF NAME="execute" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; <em><!-- TMPL_VAR NAME="name" --></em> Report
57 <!-- TMPL_ELSIF NAME="buildx"  --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build A Report</a> &rsaquo; Step <!-- TMPL_VAR NAME="buildx" --> of 6:
58     <!-- TMPL_IF    NAME="build1" -->Choose a Module
59     <!-- TMPL_ELSIF NAME="build2" -->Pick a Report Type
60     <!-- TMPL_ELSIF NAME="build3" -->Select Columns for Display
61     <!-- TMPL_ELSIF NAME="build4" -->Select Criteria to Limit on
62     <!-- TMPL_ELSIF NAME="build5" -->Pick which columns to total
63     <!-- TMPL_ELSIF NAME="build6" -->Select how you want the report ordered
64     <!-- /TMPL_IF -->
65 <!-- /TMPL_IF -->
66 </div>
67
68 <div id="doc3" class="yui-t1">
69 <div id="bd">
70 <div id="yui-main">
71     <div class="yui-b">
72     <div class="details">
73
74 <!-- TMPL_IF NAME="start" -->
75     <h2>Guided Reports</h2>
76     <p>Use the guided reports engine to create non standard reports.
77 This feature aims to provide some middle ground between the built in
78 canned reports and writing custom SQL reports.</p>
79
80     <h3>Build And Run Reports</h3>
81         <!-- TMPL_IF NAME="CAN_user_reports_create_reports" -->
82         <form action="/cgi-bin/koha/reports/guided_reports.pl">
83             <input type="hidden" name="phase" value="Build new" />
84             <input type="submit" name="submit" value="Build new"/>
85         </form>
86         <!-- /TMPL_IF -->
87         <!-- TMPL_IF NAME="CAN_user_reports_execute_reports" -->
88         <form action="/cgi-bin/koha/reports/guided_reports.pl">
89             <input type="hidden" name="phase" value="Use saved"/>
90             <input type="submit" name="submit" value="Use saved"/>
91         </form>
92         <!-- /TMPL_IF -->
93         <!-- TMPL_IF NAME="CAN_user_reports_create_reports" -->
94         <form action="/cgi-bin/koha/reports/guided_reports.pl">
95             <input type="hidden" name="phase" value="Create report from SQL"/>
96             <input type="submit" name="submit" value="Create report from SQL"/>
97         </form>
98         <!-- /TMPL_IF -->
99 <h3>Reports Dictionary</h3>
100 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
101 <form action="/cgi-bin/koha/reports/dictionary.pl">
102 <input type="hidden" name="phase" value="View Dictionary"/>
103 <input type="submit" name="submit" value="View Dictionary"/>
104 </form>
105 <!-- /TMPL_IF -->
106
107 <!-- TMPL_IF NAME="saved1" -->
108 <!-- TMPL_IF NAME="savedreports" --><h1>Saved Reports</h1>
109 <p>Choose the report to run from the list</p>
110 <form action="/cgi-bin/koha/reports/guided_reports.pl">
111 <table>
112 <tr><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">&nbsp;</th></tr>
113 <!-- TMPL_LOOP NAME="savedreports" -->
114 <tr><td><!-- TMPL_VAR NAME="report_name" --></td>
115 <td><!-- TMPL_VAR NAME="type" --></td>
116 <td><!-- TMPL_VAR NAME="notes" --></td>
117 <td><!-- TMPL_VAR NAME="borrowersurname" --><!-- TMPL_IF NAME="borrowerfirstname" -->, <!-- TMPL_VAR NAME="borrowerfirstname" --><!-- /TMPL_IF --> (<!-- TMPL_VAR NAME="borrowernumber" -->)</td>
118 <td><!-- TMPL_VAR NAME="date_created" --></td>
119 <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 -->
120 </td>
121 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Show%20SQL">Show SQL</a> 
122 &nbsp; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Edit%20SQL">Edit SQL</a></td>
123 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Run%20this%20report">Run</a></td>
124 <td><a href="/cgi-bin/koha/tools/scheduler.pl?id=<!-- TMPL_VAR NAME="id" -->">Schedule</a></td>
125 <td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Delete%20Saved">Delete</a></td></tr>
126 <!-- /TMPL_LOOP -->
127 </table>
128 </form>
129 <!-- TMPL_ELSE --><h4>There are no saved reports. <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a></h4><!-- /TMPL_IF -->
130 <!-- /TMPL_IF -->
131
132
133 <!-- TMPL_IF NAME="build1" -->
134 <h1>Build A Report</h1>
135 <form action="/cgi-bin/koha/reports/guided_reports.pl">
136 <fieldset class="rows">
137 <legend>Step 1 of 6: Choose a Module to Report on</legend>
138 <ol><li><label for="areas">Choose: </label><select name="areas" id="areas">
139 <!-- TMPL_LOOP NAME="areas" -->
140 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
141 <!-- /TMPL_LOOP -->
142 </select></li></ol>
143 </fieldset>
144 <fieldset class="action">
145 <input type="hidden" name="phase" value="Report on this Area" />
146 <input type="submit" name="submit" value="Next &gt;&gt;" />
147
148 </fieldset>
149 </form>
150 <!-- /TMPL_IF -->
151
152
153 <!-- TMPL_IF NAME="build2" -->
154 <h1>Build A Report</h1>
155 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
156 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
157 <fieldset class="rows"><legend>Step 2 of 6: Pick a Report Type</legend>
158 <ol><li><label for="types">Choose: </label>
159     <select id="types" name="types">
160         <option value="1">Tabular</option>
161         <option value="2" disabled="disabled">Summary</option>
162         <option value="3" disabled="disabled">Matrix</option>
163     </select>
164 </li></ol></fieldset>
165
166 <fieldset class="action">
167     <input type="hidden" name="phase" value="Choose this type" />
168     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
169     <input type="submit" name="submit" value="Next &gt;&gt;" />
170 </fieldset>
171 </form>
172 </div>
173 <div class="yui-gb"><div class="yui-u first"></div>
174
175 <!--- Summary and Matrix reports have not yet been implemented-->
176 <!--<div class="yui-u">Summary:
177 <img src="/intranet-tmpl/prog/img/reports-summary-graphic.gif" /></div>
178 <div class="yui-u">Matrix:
179 <img src="/intranet-tmpl/prog/img/reports-matrix-graphic.gif" /></div>-->
180
181 <!-- /TMPL_IF -->
182
183 <!-- TMPL_IF NAME="build3" -->
184 <h3>Step 3 of 6: Select Columns for Display</h3>
185 <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>
186
187 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
188     <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
189     <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
190     <fieldset>
191 <div class="yui-g">
192 <div class="yui-u first">       <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
193 <!-- TMPL_LOOP NAME="columns" -->
194 <!-- TMPL_IF NAME="table" -->
195
196 <!-- TMPL_IF NAME="__first__" -->
197 <!-- TMPL_ELSE -->
198 </optgroup>
199 <!-- /TMPL_IF -->
200
201 <optgroup label="<!-- TMPL_VAR NAME="table"-->">
202 <!-- TMPL_ELSE -->
203 <option value="<!-- TMPL_VAR NAME="name" -->">
204 <!-- TMPL_IF NAME="description" --><!-- TMPL_VAR NAME="description" -->
205 <!-- TMPL_ELSE -->
206 <!-- TMPL_VAR NAME="name" -->
207 <!-- /TMPL_IF -->
208 </option>
209 <!-- /TMPL_IF -->
210 <!-- /TMPL_LOOP -->
211 </optgroup>
212 </select></div>
213 <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 />
214 <input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" onclick="delColumn()" /></div>
215 </div>
216
217 <div class="yui-u">
218 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
219 </div>
220 </div>
221 </fieldset>
222 <div class="yui-g">
223 <fieldset class="action">
224     <input type="hidden" name="phase" value="Choose these columns" />
225     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
226     <input type="submit" name="submit" value="Next &gt;&gt;" />
227 </fieldset>
228 </div>
229 </form>
230
231 <!-- /TMPL_IF -->
232
233 <!-- TMPL_IF NAME="build4" -->
234 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
235     <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
236     <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
237     <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
238     <fieldset><legend>Step 4 of 6: Select Criteria to Limit on</legend>
239     <table>
240         <!-- TMPL_LOOP NAME="criteria" -->
241         <tr>
242         <td>
243             <input type="checkbox" name="criteria_column" id="<!-- TMPL_VAR NAME="name" -->" value="<!-- TMPL_VAR NAME="name" -->" /> 
244             <label for="<!-- TMPL_VAR NAME="name" -->"><!-- TMPL_VAR NAME="description" --> </label>
245         </td>
246         <!-- TMPL_IF NAME="date" -->
247         <td>
248             <input type="text" size="10" id="<!-- TMPL_VAR NAME="name" -->_value" name="<!-- TMPL_VAR NAME="name" -->_value" value="" />
249             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
250             <script type="text/javascript">   
251             Calendar.setup({  
252             inputField     : "<!-- TMPL_VAR NAME="name" -->_value",
253             ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
254             button         : "buttonfrom<!-- TMPL_VAR NAME="name" -->",
255             align          : "Tl" 
256             });     
257             </script>          
258         </td>
259         </tr>
260         <!-- TMPL_ELSE -->
261         <!-- TMPL_IF NAME="textrange" -->
262             <td>from
263             <input type="text" size="10" id="<!-- TMPL_VAR NAME="from" -->_value" name="<!-- TMPL_VAR NAME="from" -->_value" value="" /> to 
264             <input type="text" size="10" id="<!-- TMPL_VAR NAME="to" -->_value" name="<!-- TMPL_VAR NAME="to" -->_value" value="" />
265             </td>
266             </tr>
267         <!-- TMPL_ELSE -->
268             <!-- TMPL_IF NAME="daterange" -->
269             <td>from 
270             <input type="text" size="10" id="from_<!-- TMPL_VAR NAME="name" -->_value" name="from_<!-- TMPL_VAR NAME="name" -->_value" value="" />
271             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfromfrom_<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
272             <script type="text/javascript">   
273                 Calendar.setup({  
274                 inputField     : "from_<!-- TMPL_VAR NAME="name" -->_value",
275                 ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
276                 button         : "buttonfromfrom_<!-- TMPL_VAR NAME="name" -->",
277                 align          : "Tl" 
278                 });     
279             </script>         
280             to
281             <input type="text" size="10" id="to_<!-- TMPL_VAR NAME="name" -->_value" name="to_<!-- TMPL_VAR NAME="name" -->_value" value="" />
282             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfromto_<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
283             <script type="text/javascript">   
284                 Calendar.setup({  
285                 inputField     : "to_<!-- TMPL_VAR NAME="name" -->_value",
286                 ifFormat       : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
287                 button         : "buttonfromto_<!-- TMPL_VAR NAME="name" -->",
288                 align          : "Tl" 
289                 });     
290             </script>        
291             </td>
292         </tr>
293             <!-- TMPL_ELSE -->
294             <td>
295                 <select name="<!-- TMPL_VAR NAME="name" -->_value">
296                 <!-- TMPL_LOOP NAME="values" -->
297                 <option value="<!-- TMPL_VAR NAME="availablevalues"-->"><!-- TMPL_IF name="default" -->Default<!-- TMPL_ELSE --><!-- TMPL_VAR NAME="availablevalues" ESCAPE="HTML"--><!-- /TMPL_IF --></option>
298                 <!-- /TMPL_LOOP -->
299                 </select>
300             </td>
301             </tr>
302             <!-- /TMPL_IF -->
303         <!-- /TMPL_IF -->
304         <!-- /TMPL_IF -->
305     <!-- /TMPL_LOOP -->
306     </table>
307     </fieldset>
308
309 <!-- TMPL_IF NAME="definitions" -->
310 <fieldset><legend>Dictionary Definitions</legend><table>
311 <!-- TMPL_LOOP NAME="definitions" -->
312     <tr><td><input type="checkbox" name="definition" value="<!--
313 TMPL_VAR NAME="id" -->" /> <!-- TMPL_VAR NAME="name" --></td></tr>
314 <!-- /TMPL_LOOP -->
315 </table>
316 <!-- /TMPL_IF -->
317
318 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
319     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
320     <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
321 </form>
322 <!-- /TMPL_IF -->
323
324
325 <!-- TMPL_IF NAME="build5" -->
326 <h3>Step 5 of 6: Pick which columns to total</h3>
327 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
328 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
329 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
330 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
331 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->" />
332 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->" />
333 <fieldset><table>
334 <!-- TMPL_LOOP NAME="total_by" -->
335 <tr><td><input type="checkbox" name="total_by" id="<!-- TMPL_VAR
336 NAME="name" -->" value="<!-- TMPL_VAR
337 NAME="name" -->" /> <label for="<!-- TMPL_VAR
338 NAME="name" -->"><!-- TMPL_VAR NAME="name" --></label></td>
339 <td><select name="<!-- TMPL_VAR NAME="name" -->_tvalue">
340
341 <!-- TMPL_LOOP NAME="select" -->
342 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
343 <!-- /TMPL_LOOP -->
344 </select>
345
346 </td></tr>
347 <!-- /TMPL_LOOP -->
348 </table></fieldset>
349
350 <fieldset class="action"><input type="hidden" name="phase" value="Choose These Operations" />
351     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
352     <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
353 </form>
354 <!-- /TMPL_IF -->
355
356
357 <!-- TMPL_IF NAME="build6" -->
358 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
359 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
360 <input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
361 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
362 <input type="hidden" name="column" value="<!-- TMPL_VAR NAME="column" -->" />
363 <input type="hidden" name="criteria" value="<!-- TMPL_VAR NAME="criteriastring" -->" />
364 <input type="hidden" name="definition" value="<!-- TMPL_VAR NAME="definition" -->" />
365 <input type="hidden" name="totals" value="<!-- TMPL_VAR NAME="totals" -->" />
366 <fieldset><table><!-- TMPL_LOOP NAME="order_by" -->
367 <tr><td><input type="checkbox" id="<!-- TMPL_VAR
368 NAME="name" -->" name="order_by" value="<!-- TMPL_VAR
369 NAME="name" -->" /> <label for="<!-- TMPL_VAR
370 NAME="name" -->"><!-- TMPL_VAR NAME="name"--></label></td><td>
371 <select name="<!-- TMPL_VAR NAME="name" -->_ovalue">
372
373 <!-- TMPL_LOOP NAME="select" -->
374 <option value="<!-- TMPL_VAR NAME="value"-->"><!-- TMPL_VAR NAME="value" --></option>
375 <!-- /TMPL_LOOP -->
376 </select>
377 </td></tr>
378
379 <!-- /TMPL_LOOP -->
380 </table></fieldset>
381
382 <fieldset class="action">
383 <input type="hidden" name="phase" value="Build Report" />
384 <input type="submit" name="submit" value="Finish" /></fieldset>
385 </form>
386 <!-- /TMPL_IF -->
387
388
389 <!-- TMPL_IF NAME="showreport" -->
390 <h1>Confirm Custom Report</h1>
391 <p>Your report will be generated with the following SQL statement.</p>
392 <p> 
393 <!-- TMPL_VAR NAME="sql" ESCAPE="HTML" -->
394 </p>
395
396 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
397 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" -->" />
398 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
399 <p>You will need to save the report before you can execute it</p>
400 <fieldset class="action"><input type="hidden" name="phase" value="Save" />  
401 <input type="submit" name="submit" value="Save" />  </fieldset>
402 </form>
403 <!-- /TMPL_IF -->
404
405 <!-- TMPL_IF NAME="save" -->
406 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
407 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
408 <input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
409 <fieldset class="rows">
410 <legend>Save Your Custom Report</legend>
411 <ol>
412     <li><label for="reportname">Report Name: </label><input type="text" id="reportname" name="reportname" /></li>
413     <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
414 </ol></fieldset>
415 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
416 <input type="submit" name="submit" value="Save Report" /></fieldset>
417 </form>
418 <!-- /TMPL_IF -->
419
420 <!-- TMPL_IF name="enter_params" -->
421     <form action='/cgi-bin/koha/reports/guided_reports.pl'>
422         <input type='hidden' name='phase' value='Run this report' />
423         <input type='hidden' name='reports' value="<!--TMPL_VAR name='reports' -->" />
424         <h1>Enter parameters for report <!-- TMPL_VAR name="name" -->:</h1>
425         <!-- TMPL_IF NAME="notes" --><p><!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
426         <!-- TMPL_LOOP name="sql_params" -->
427             <p><!-- TMPL_VAR name="entry" -->: <!-- TMPL_VAR name='input' --></p>
428         <!-- /TMPL_LOOP -->
429         <input type='submit' value='Run the report'/>
430     </form>
431 <!-- /TMPL_IF -->
432
433 <!-- TMPL_IF NAME="execute" -->
434 <h1><!-- TMPL_VAR NAME="name" --></h1>
435 <!-- TMPL_IF NAME="notes" --><p><!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
436 <!-- TMPL_IF NAME="unlimited_total" --><p>Total number of rows matching the (unlimited) query is <!-- TMPL_VAR NAME="unlimited_total" -->.</p><!-- /TMPL_IF -->
437 <!-- TMPL_VAR name="sql" -->
438 <!-- TMPL_VAR NAME='pagination_bar' DEFAULT="" -->
439 <!-- TMPL_UNLESS name="errors" -->
440 <table>
441 <tr><!-- TMPL_LOOP NAME="header_row" --><th><!-- TMPL_VAR NAME="cell" --></th><!-- /TMPL_LOOP --></tr>
442 <!-- TMPL_LOOP NAME="results" -->
443 <tr>
444     <!-- TMPL_LOOP NAME="cells" --><td><!-- TMPL_VAR NAME="cell" --></td><!-- /TMPL_LOOP -->
445 </tr>
446 <!-- /TMPL_LOOP -->
447 </table>
448 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
449 <fieldset class="action">
450 <label for="format">Download the report: </label>
451 <select name="format" id="format">
452 <option value="csv">Comma Separated Text</option>
453 <option value="tab">Tab Separated Text</option>
454 </select>
455 <input type="hidden" name="sql" value="<!-- TMPL_VAR NAME="sql" ESCAPE="html" -->" />
456 <input type="hidden" name="phase" value="Export" />
457 <input type="submit" name="submit" value="Download" /></fieldset>
458 </form>
459 <!-- /TMPL_UNLESS -->
460 <!-- /TMPL_IF -->
461
462 <!-- TMPL_IF NAME="create" -->
463 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
464 <fieldset class="rows">
465 <legend>Create Report From SQL</legend>
466 <ol>
467     <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" <!-- TMPL_IF NAME="reportname" --> value="<!-- TMPL_VAR NAME="reportname" -->"<!-- /TMPL_IF --> /> </li>
468     <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2"><!-- TMPL_VAR NAME="notes" DEFAULT="" --></textarea></li>
469     <li><label for="types">Type:</label>
470         <select id="types" name="types">
471             <option value="1">Tabular</option>
472             <option value="2" disabled="disabled">Summary</option>
473             <option value="3" disabled="disabled">Matrix</option>
474         </select>
475     </li>
476     <li><label for="sql">SQL: </label><textarea  id="sql" name="sql" cols="50" rows="10"><!-- TMPL_VAR NAME="sql" DEFAULT="" --></textarea></li>
477 </ol>
478 </fieldset>
479
480 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
481 <input type="submit" name="submit" value="Save Report" /></fieldset>
482 </form>
483 <!-- /TMPL_IF -->
484
485 <!-- TMPL_IF NAME="compound" -->
486 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
487 Master: <select name="master">
488 <!-- TMPL_LOOP NAME="savedreports" -->
489 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
490 <!-- /TMPL_LOOP -->
491 </select>
492 &nbsp;
493 Sub report:<select name="subreport">
494 <!-- TMPL_LOOP NAME="savedreports" -->
495 <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="report_name"--></option>
496 <!-- /TMPL_LOOP -->
497 </select>
498 <br />
499 <input type="hidden" name="phase" value="Save Compound" />
500 <input type="submit" name="submit" value="Save Compound" />
501 </form>
502 <!-- /TMPL_IF -->
503
504 <!-- TMPL_IF NAME="save_compound" -->
505 <!-- TMPL_VAR NAME="master" --> <br />
506 <!-- TMPL_VAR NAME="subsql" -->
507 <!-- /TMPL_IF -->
508
509
510 <!-- TMPL_IF NAME="retresults" -->
511 <h1>Saved Report Results</h1>
512 <h2><!-- TMPL_VAR NAME="name" --></h2>
513 <p><!-- TMPL_VAR NAME="notes" --></p>
514 <table>
515 <!-- TMPL_LOOP NAME="results" -->
516 <!-- TMPL_VAR NAME="row" -->
517 <!-- /TMPL_LOOP -->
518 </table>
519 <!-- /TMPL_IF -->
520
521 <!-- TMPL_IF NAME="showsql" -->
522 <textarea id="sql"><!-- TMPL_VAR NAME="sql" --></textarea>
523 <!-- /TMPL_IF -->
524
525 <!-- TMPL_IF NAME="editsql" -->
526 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
527 <input type="hidden" name="phase" value="Update SQL" />
528 <input type="hidden" name="id" value="<!-- TMPL_VAR NAME="id" -->"/>
529 <fieldset class="rows">
530 <legend>Edit SQL</legend>
531 <ol>
532 <li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="<!-- TMPL_VAR NAME="reportname" -->" /></li>
533 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2"><!-- TMPL_VAR NAME="notes" --></textarea></li>
534 <li><textarea id="sql" name="sql" rows="10" cols="60"><!-- TMPL_VAR NAME="sql" --></textarea></li>
535 </ol>
536 </fieldset>
537
538 <fieldset class="action">
539 <input type="submit" name="submit" value="Update SQL" /></fieldset>
540 </form>
541
542
543 <!-- /TMPL_IF -->
544
545 <!-- TMPL_IF NAME="save_successful" -->
546 <!-- TMPL_UNLESS NAME="errors" -->
547 <h2>Your report has been saved</h2>
548 <p>The report you have created has now been saved. You can now</p>
549 <ul>
550     <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
551     <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
552     <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
553 </ul>
554 <!-- /TMPL_UNLESS -->
555 <!-- /TMPL_IF -->
556
557 <!-- TMPL_IF NAME="errors" -->
558 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
559 <div class="dialog alert">
560 <b>The following error was encountered:</b><br />
561 <!-- TMPL_LOOP name="errors" -->
562     <!-- TMPL_IF NAME="sqlerr" -->This report contains the SQL keyword <b><!-- TMPL_VAR name="sqlerr" --></b>.
563     <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
564     <br />Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
565     <!-- TMPL_ELSIF NAME="queryerr" -->The database returned the following error: <br /><!-- TMPL_VAR NAME="queryerr" --><br />Please check the log for further details.
566     <!-- TMPL_ELSE -->
567     <!-- /TMPL_IF -->
568 <!-- /TMPL_LOOP -->
569 </div>
570 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
571 <input type="submit" name="submit" value="Saved Reports" /></fieldset>
572 </form>
573 <!-- /TMPL_IF -->
574
575 </div>
576 </div>
577 </div>
578 <div class="yui-b">
579 <!-- TMPL_INCLUDE NAME="guided-reports-view.inc" -->
580 </div>
581 </div>
582 <script type="text/javascript">
583 //<![CDATA[
584 function addColumn() {
585     $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
586 }
587 function delColumn() {
588     $("#selectedColumns option:selected").remove();
589 }
590 $("#column_submit").submit(function() {
591     if ($("#selectedColumns option").size() < 1) {
592         alert(_("No columns selected!"));
593         return false;
594     }
595     $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
596     return true;
597 });
598 //]]>
599 </script>
600 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->