<!-- BEGIN result/haem_data.tt -->
    [% # PROCESS dumper.tt dump = haem_data.as_tree %]
    
    [% BLOCK calculate;
        DEFAULT factor = 10; # unless supplied
        result = haem_data.item(var);
        flag = var _ '_f'; # eg wbc_f
        class = result.match('\*') || haem_data.item(flag) ? 'red' : 'normal';
        %]
        <td class="[% class %]">
            [%  IF result.match('\*'); result; # ie *000
                ELSE; 
                    IF float; # needs formatting:
                        FILTER format('%.' _ float _ 'f'); result / factor; END;
                    ELSE;
                        result / factor;
                    END; suffix;
                END;
            %]
        </td>
    [% END %]
    
    
    <div class="indent">
        <table class="indent">
            <tr>
                <th>WBC</th>
                <th>RBC</th>
                <th>Hb</th>
                <th>Plt</th>
                <th>HCT</th>
                <th>MCV</th>
                <th>MCH</th>
                <th>MCHC</th>
            </tr>
            <tr>
                [% INCLUDE calculate(var = 'wbc',  float = 1) %]
                [% INCLUDE calculate(var = 'rbc',  float = 2, factor = 100) %]
                [% INCLUDE calculate(var = 'hb',   float = 1)  %]
                [% INCLUDE calculate(var = 'plt',  float = 0, factor = 1) %]
                [% INCLUDE calculate(var = 'hct',  float = 1) %]
                [% INCLUDE calculate(var = 'mcv',  float = 1) %]
                [% INCLUDE calculate(var = 'mch',  float = 1) %]
                [% INCLUDE calculate(var = 'mchc', float = 1) %]
            </tr>
        </table>
        
        <span class="spacer">&nbsp;</span>
        
      <form method='post' action="[% app_url %]/result/accept_haem_data/[%
            haem_data.lab_number %]">
        <table class="indent">
            <tr>
                <th>Lymph</th>
                [% INCLUDE calculate(var = 'lymph', float = 1) %]
                [% INCLUDE calculate(var = 'lymph_percent', float = 1, suffix = '%') %]
                [% IF c.user_can('modify_results') AND NOT is_locked %]
                <td colspan="3" rowspan="3" class="borderless">
                    [% IF haem_data.status.match('default') %]
                        <input type="hidden" name="id" value="[% data.id %]">
                        <input type="hidden" name="func" value="[% function %]">
                        <input class="highlight" type="submit" value="ACCEPT">
                    [% END %]
                    [ <a href="[% app_url %]/result/delete_haem_data/[%
                        haem_data.lab_number %]?func=[% function %];id=[% data.id %]">
                        DELETE</a> ]                
                </td>
                [% END %]
            </tr>
            <tr>
                <th>Mixed</th>
                [% INCLUDE calculate(var = 'mixed', float = 1 ) %]
                [% INCLUDE calculate(var = 'mixed_percent', float = 1, suffix = '%') %]
            </tr>
            <tr>
                <th>Neutr</th>
                [% INCLUDE calculate(var = 'neutr', float = 1) %]
                [% INCLUDE calculate(var = 'neutr_percent', float = 1, suffix = '%') %]
            </tr>
        </table>
      </form>
      
        <span class="spacer">&nbsp;</span>
    </div>
<!--END result/haem_data.tt -->
