{%- import "macros.jinja2" as macros %}
<Orders>
    {%- if user_info %}
    <AccountMaintenance>
        <AccountDetail>
            {{ macros.emit_user_info(user_info) }}
        </AccountDetail>
    </AccountMaintenance>
    {%- endif %}
    <NewOrder>
        <Function>{{ function_value }}</Function>
        <ErrorLevel>2</ErrorLevel>
        <ReferenceNumber>{{ reference_number }}</ReferenceNumber>
        <Check>
            <CheckHeader>
                <TableNumber>{{ table_number }}</TableNumber>
                <CostCenter>{{ revenue_center }}</CostCenter>
                <ServerNumber>{{ server_number }}</ServerNumber>
                <NumberInParty>{{ number_in_party }}</NumberInParty>
                <TerminalNumber>{{ terminal_number }}</TerminalNumber>
                {%- if user_info %}
                <Account>
                    {{ macros.emit_user_info(user_info) }}
                </Account>
                {%- endif %}
                {%- if fire_time %}
                <AdvanceOrderDate>{{ fire_date }}</AdvanceOrderDate>
                <AdvanceOrderTime>{{ fire_time }}</AdvanceOrderTime>
                {%- if fire_offset %}
                <AdvanceOrderOffset>{{ fire_offset }}</AdvanceOrderOffset>
                {%- endif %}
                {%- endif %}
            </CheckHeader>
            {%- if ticket_name and ticket_name_item and ticket_name_modifier %}
            <ItemDetail>
                {{ macros.id_node(ticket_name_item) }}
                <Quantity>1</Quantity>
                <ItemName>NAME</ItemName>
            </ItemDetail>
            <ItemDetail>
                {{ macros.id_node(ticket_name_modifier) }}
                <Quantity>1</Quantity>
                <ItemName>NAME</ItemName>
                <Memo>{{ ticket_name|e }}</Memo>
            </ItemDetail>
            {%- endif %}
        </Check>
    </NewOrder>
</Orders>