[%- META title="Record Search";

    request_data = data.as_tree; # save multiple lookups if undefined
    report  = data.request_report; # PROCESS dumper.tt dump = report.as_tree;
    patient = data.patient_case.patient; # PROCESS dumper.tt dump = patient.as_tree;

    # print_run, print_record, email_report, mail_reports:
	UNLESS is_print_request; # unless already set in do_email_report() or mail_reports.pl:
	  is_print_request = c.get_current_runmode.match('print') ? 1 : 0;
	END; # PROCESS dumper.tt dump = is_print_request;

    # PROCESS dumper.tt dump = history;
    # PROCESS dumper.tt dump = is_locked;
    # PROCESS dumper.tt dump = request_errors;
    # PROCESS dumper.tt dump = request_data;
    # PROCESS dumper.tt dump = report_data_maps;
    # PROCESS dumper.tt dump = result_summaries;
	# PROCESS dumper.tt dump = special_formatting;
	# PROCESS dumper.tt dump = outstanding_tests;
	# FOREACH i IN previous_diagnoses; PROCESS dumper.tt dump = i.as_tree; END;
-%]

    [% IF NOT c.is_lab_staff OR is_print_request;
        PROCESS record/print_view.tt;
	  ELSE; # ONLY LAB-STAFF IN NON-PRINT VIEW: %]
        <!-- BEGIN [% template.name # IE <9 can't cope with anything before DOCTYPE %] -->
        [% PROCESS record/content_header.tt %]

        [% INCLUDE site/previous_requests.tt # don't use PROCESS or 'data' gets clobbered %]
		[% INCLUDE site/previous_lab_tests.tt IF previous_requests.size %]

        [% IF patient.patient_note %]
            <p><span class="bold">Patient notes</span>:
                [% patient.patient_note.detail %]</p>
        [% END %]

        [% IF has_optional.initial_screen OR has_optional.report;
          PROCESS record/report.tt;
        END;

        PROCESS record/lab_tests.tt;
    %]
      <p align="right" class="classname">Request logs:
        <a href="[% app_url %]/history/request_view/[% data.id %]">view</a> ::
        <a href="[% app_url %]/history/request_print/[% data.id %]">print</a>
      </p>
    [% END %]
<!-- END [% template.name %] -->
