[% # INCLUDE dumper.tt dump = data.packs; USE today = DateTime(today = 1); # INCLUDE dumper.tt dump = today; %]

Your current status

[% current = data.packs.first; # INCLUDE dumper.tt dump = current %] [% IF current.request_status.match('complete') %] [% IF current.pack_due >= today %] Next assessment is due on [% current.pack_due.strftime('%d.%b.%Y') %] [% ELSIF current.pack_sent < today; delta_pack_sent = current.pack_sent.delta_days(today).delta_days; # INCLUDE dumper.tt dump = delta_pack_sent; %] A pack was sent on [% current.pack_sent.strftime('%d.%b.%Y') %] [[% delta_pack_sent %] days ago] but has not been received. [% IF delta_pack_sent > 2 %]Please call us to discuss.[% END %] [% ELSE %]** current request status complete but pack_due not ≥ today and pack_sent not %lt; today ** [% END %] [% ELSIF current.request_status.match('new') %] A pack was received on [% current.registered.strftime('%d.%b.%Y') %] and laboratory tests have been initiated. [% ELSIF current.request_status.match('screened') %] A pack was received on [% current.registered.strftime('%d.%b.%Y') %] and initial results indicate that no urgent action is required. It may take three weeks to obtain all the laboratory test results but we will contact your GP if there are any issues. [% ELSE %]** current request status is not complete ** [% END %]
[% FOREACH entry IN data.packs.reverse; # because data collected in reverse order NEXT IF entry.option.match('dead'); # oops %] [% END %]
Pack Received Lab number Action Pack sent
#[% loop.count %] [% entry.registered.strftime('%d.%b.%Y') %] [% entry.request_number %]/[% use String(entry.year - 2000); String.format('%02d') %] [% IF entry.option.match('month'); 'next pack '; UNLESS entry.label.match('immediate'); 'in '; END; END; entry.outcome; %] [% # INCLUDE dumper.tt name = loop.count dump = entry.pack_due >= date; IF entry.option.match('clinic_return'); '[not required]'; ELSIF entry.pack_due AND entry.pack_due >= today; '[ due '; entry.pack_due.strftime('%d.%b.%Y'); ' ]'; ELSIF entry.pack_sent; entry.pack_sent.strftime('%d.%b.%Y'); END; %]