RSS Git Download  Clone
Raw Blame History
[% META title = 'Resources » Stats & Audit » Lab Tests Signed Off' %]

<!-- BEGIN [% template.name %] -->
    [% # INCLUDE dumper.tt dump = lab_sections_map %]
    [% # INCLUDE dumper.tt dump = data %]
    [% # INCLUDE dumper.tt dump = title %]

    <h2>Lab tests signed off[% IF title %] [[% title %]][% END %]:</h2>
    
    <form method="post" action="[% app_url %]/audit/lab_tests_sign_off">
        <p class="bold indent">
            Select lab section: <select name="lab_section_id">
                <option value="">-- select one --</option>
                [% FOREACH section IN lab_sections_map %]
                    <option [% 'selected' IF section.value.id == c.query.param('lab_section_id') %]
                        value="[% section.value.id %]">[% section.key %]</option>
                [% END %]
            </select>
            [% site.html.submit %]
        </p>
    </form>

    [% IF section_id; # need initial selection
        PROCESS site/date_constraints.tt
            func_name = 'get_page'
            target_url = app_url _ '/audit/lab_tests_sign_off/' _ section_id # optional
            restricted = { # too slow to allow these:
                no_constraint = 1,
                all_since     = 1,
            };
    END %]

    [% IF data.size; col_count = 0; # create table of tables: %]
        <table id="lab-test-audit" class="indent">
          <tr>
            [% FOREACH entry IN data %]
            <td style="vertical-align: top">
                <table class="test">
                    <tr>
                        <th colspan="2">[% entry.key %]</th>
                    </tr>
                    [% total = 0; # reset
                        FOREACH result IN entry.value; # INCLUDE dumper.tt dump = result %]
                        <tr>
                            <td>
                                [% result.user.upper %]</td>
                            <td>[% result.f %]</td>
                        </tr>
                    [% total = total + result.f; END %]
                    <tr class="total"><td>Total</td><td>[% total %]</td></tr>
                </table>
            </td>
            [% col_count = col_count + 1; '</tr><tr>' UNLESS col_count % 6; # new row every 6 %]
        [% END; '</tr>' IF col_count % 6; # terminate row unless already have done %]
        </table>
    [% END %]
<!-- END [% template.name %] -->