[%- content_only = 1; # no html wrappers; called from record/default.tt -%] [%# INCLUDE site/lab_number.tt want_url = 0 %] [% settings = c.cfg('settings') %] [%# base href only needed so wkhtmltopdf can find static files as http addr: %] [% UNLESS is_print_request # wrecks span width formatting %] [% END %] [% # define static vars - don't change between requests if print-run request: ukas = 'hmds.info/ukas'; text_str = { csf => 'absence of involvement of the cerebro-spinal fluid does not' _ ' exclude the possibility of intracerebral disease', tests_pending => 'there are further laboratory investigations pending', service_url => 'the definitive report is available online at <' _ settings.service_url _ '>', pb_sample => 'please send a peripheral blood sample with all bone marrow specimens', clinic_return => 'Currently unsuitable for community monitoring: an appointment' _ ' will be made at the haematology clinic.', # clinic_return => 'A haematology clinic appointment is required. If you do not' # _ ' receive confirmation of an appointment within two weeks, please contact us.', pack_dispatch => 'Suitable for community monitoring: a pack will be sent out', ukas => 'all lab-tests performed were accredited to ISO 15189:2012 ' _ "[ref ${ukas}] ", # include trailing space cytogenetics_sample => 'sample sent to cytogenetics department', }; acronym_class = is_print_request ? 'normal' : 'acronym'; # don't display if print req tt_name = c.cfg('settings').report_template; report_tmpl = "record/report/local/${tt_name}.tt"; # INCLUDE dumper.tt dump = report_tmpl; %] [% # PROCESS dumper.tt dump = data.as_tree %] [% IF reports.size; # HTML print-run request: offset = c.query.param('offset') || 0; # next offset value count = c.query.param('total') || 0; # total number of records in print run start = c.query.param('start') | uri; end = c.query.param('end') | uri; offset_next = offset + 50; offset_lower = offset_next + 1; # start of next offset offset_upper = offset_next + 50; # end of next offset url = []; url.push("total=$count"); url.push("offset=$offset_next"); url.push("start=$start"); url.push("end=$end"); # PROCESS dumper.tt dump = url; %]

[% site.html.back_button %] [% IF count >= offset_lower; # still more records to print: %] [% offset_lower %] to [% ( offset_upper > count ) ? count : offset_upper %] » [% ELSE %] [finished] [% END %]

[% FOREACH entry IN reports; import(entry); # clobbers all previous keys (history, has_optional, etc): # need to (re)define vars not set in caller record/default.tt: 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; %]
[% INCLUDE $report_tmpl %]
[% END %] [% ELSE; INCLUDE $report_tmpl; END %]