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

Your current pack status

[% current = data.packs.first; # INCLUDE dumper.tt dump = current %] [% IF current.request_status.match('complete') %] [% # if pack_due on or after today: IF current.pack_due AND current.pack_due >= today %] Next assessment is due on [% current.pack_due.strftime('%d.%b.%Y') %] [% # if pack_due before today and pack_sent before today: ELSIF current.pack_sent AND current.pack_sent < today; # INCLUDE dumper.tt dump = current.pack_sent name = 'pre'; delta_pack_sent = current.pack_sent.delta_days(today).delta_days; class = delta_pack_sent > 7 ? 'danger' : 'success'; # INCLUDE dumper.tt dump = delta_pack_sent; %] A pack was sent on [% current.pack_sent.strftime('%d.%b.%Y') %] [[% delta_pack_sent %] days ago] [% IF class.match('danger') %] but has not been received. Please call us to discuss.[% END %] [% ELSIF current.pack_due AND NOT current.pack_sent # pack due before today and pack not sent: %] Pack was due for dispatch on [% current.pack_due.strftime('%d.%b.%Y') %] but has not been sent. Please call us to discuss. [% ELSE # ? no pack_due date ? %] [% current.outcome.ucfirst %] [% END %] [% ELSIF current.section_data_count > 1 %] 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. [% ELSIF current.request_status.match('new|screened') %] A pack was received on [% current.registered.strftime('%d.%b.%Y') %] and laboratory tests have been initiated. [% ELSE %]** UNKNOWN RECORD STATUS - CHECK DETAILS ** [% 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 '; IF loop.last AND entry.pack_due AND NOT entry.pack_sent; entry.outcome = ' due out ' _ entry.pack_due.strftime('%d.%b.%Y'); ELSIF NOT entry.outcome.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; %]