[% META title="Print Authorised Reports" %]

<!-- BEGIN printrun/do.tt -->
    [% #PROCESS dumper.tt dump = count %]
    [% #PROCESS dumper.tt dump = start_date.datetime %]
    [% #PROCESS dumper.tt dump = end_date.datetime %]

    <h3 class="header">Print Authorised Reports</h3>

	<script type="text/javascript">
		function submitForm(s) {
			s.value = "Compiling reports, please wait ...";
	 		return true;
		}
	</script>

    <div class="indent">
		<p>
			[% IF start_date.ymd == end_date.ymd %]
				For <strong>[% start_date.strftime('%A %d %b %Y') %]</strong>
			[% ELSE %]
				From <strong>[% start_date.strftime('%A %d %b %Y') %]</strong> to
					<strong>[% end_date.strftime('%A %d %b %Y') %]</strong>
			[% END %]
			[[% count %]]:
		</p>

		<form action="[% app_url %]/printrun/do_offset" method="post" id="printRun"			
                onsubmit="return submitForm(this.submit);" name="printRun">
			<div style="width: 10em; padding: 0.5em">
                [% total = count; offset = 0; WHILE count > 0 %]
                    <div align="right">[% offset + 1 %] ..
                        [% offset + 50 > total ? total : offset + 50 %]
                        <input type="radio" name="offset" value="[% offset %]" />
                    </div>
                    [% count = count - 50; offset = offset + 50 %]
                [% END %]
                <p align="right">
                    <input type="submit" value="Go" name="submit" class="button" />
                </p>
            </div>
            <input type="hidden" name="total" value="[% total %]" />        
            <input type="hidden" name="start" value="[% start_date.datetime %]" />        
            <input type="hidden" name="end"   value="[% end_date.datetime %]" />        
        </form>
    </div>
<!-- END printrun/do.tt -->