{%- import "macros.jinja2" as macros %}
<Orders>
    <UpdateOrder>
        <Function>{{ function_value }}</Function>
        <ErrorLevel>2</ErrorLevel>
        <ReferenceNumber>{{ reference_number }}</ReferenceNumber>
        <CheckNumber>{{ ticket_number }}</CheckNumber>
        {%- if sub_ticket_number %}
        <SubCheckNumber>{{sub_ticket_number}}</SubCheckNumber>
        {%- endif %}
        <Check>
            <CheckHeader>
               {%- if terminal_number %}
               <TerminalNumber>{{ terminal_number }}</TerminalNumber>
               {%- endif %}
            </CheckHeader>
            {%- for comp in comps %}
                {% if comp.value %}
                <ItemDetail>
                    {{ macros.id_node(comp) }}
                    <Price>{{ comp.value }}</Price>
                </ItemDetail>
                {%- else %}
                <CompItem>
                    {{ macros.id_node(comp) }}
                    <CompSerialNumber>{{ comp.comp_serial_number }}</CompSerialNumber>
                </CompItem>
                {%- endif %}
           {%- endfor %}
        </Check>
    </UpdateOrder>
</Orders>
