<Orders>
    {%- if user_info %}
    <AccountMaintenance>
        <AccountDetail>
            <AccountNumber>{{ user_info.account_number or '' }}</AccountNumber>
            <LastName>{{ user_info.last_name or '' }}</LastName>
            <FirstName>{{ user_info.first_name or '' }}</FirstName>
            <MiddleInitial>{{ user_info.middle_initial or '' }}</MiddleInitial>
            {%- if user_info.address %}
            <Address1>{{ user_info.address.street1 or '' }}</Address1>
            <Address2>{{ user_info.address.street2 or '' }}</Address2>
            <Address3>{{ user_info.address.street3 or '' }}</Address3>
            <City>{{ user_info.address.city or '' }}</City>
            <State>{{ user_info.address.state or '' }}</State>
            <Zip>{{ user_info.address.zip or '' }}</Zip>
            {%- endif %}
            <Phone>{{ user_info.phone or '' }}</Phone>
            <PhoneExt>{{ user_info.phone_ext or '' }}</PhoneExt>
        </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>
                {%- if terminal_number %}
                <TerminalNumber>{{ terminal_number }}</TerminalNumber>
                {%- endif %}
                {%- if user_info %}
                <Account>
                    <AccountNumber>{{ user_info.account_number or '' }}</AccountNumber>
                    <LastName>{{ user_info.last_name or '' }}</LastName>
                    <FirstName>{{ user_info.first_name or '' }}</FirstName>
                    <MiddleInitial>{{ user_info.middle_initial or '' }}</MiddleInitial>
                </Account>
                {%- endif %}
                {%- if fire_time %}
                <AdvanceOrderDate>{{ fire_date }}</AdvanceOrderDate>
                <AdvanceOrderTime>{{ fire_time }}</AdvanceOrderTime>
                {%- endif %}
            </CheckHeader>
            {%- if ticket_name and ticket_name_data_set %}
            <ItemDetail>
                <ScreenCell>{{ ticket_name_item_screen_cell_id }}</ScreenCell>
                <Quantity>1</Quantity>
                <ItemName>NAME</ItemName>
            </ItemDetail>
            <ItemDetail>
                {%- if ticket_name_modifier_screen_cell_id -%}
                <ScreenCell>{{ ticket_name_modifier_screen_cell_id }}</ScreenCell>
                {%- else %}
                <ItemNumber>{{ ticket_name_modifier_inv_id }}</ItemNumber>
                {%- endif %}
                <Quantity>1</Quantity>
                <ItemName>NAME</ItemName>
                <Memo>{{ ticket_name }}</Memo>
            </ItemDetail>
            {%- endif %}
        </Check>
    </NewOrder>
</Orders>