<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <CalculateTransactionTotalsEx xmlns="http://micros-hosting.com/EGateway/">
            <ppMenuItemsEx>
                {%- if items is not none %}
                {%- for item in items %}
                <SimphonyPosApi_MenuItemEx>
                    {%- if item.modifiers %}
                    <Condiments>
                        {%- for modifier in item.modifiers %}
                        <SimphonyPosApi_MenuItemDefinitionEx>
                            <ItemDiscount />
                            {% set mod_obj_num = modifier.menu_modifier.id.split('-')[0] %}
                            <MiObjectNum>{{ mod_obj_num }}</MiObjectNum>
                            {%- if modifier.comment is not none %}
                            <MiReference>{{ modifier.comment }}</MiReference>
                            {%- endif %}
                            <MiWeight />
                            <MiMenuLevel>{{ modifier.main_level }}</MiMenuLevel>
                            <MiSubLevel>{{ modifier.sub_level }}</MiSubLevel>
                            {%- if modifier.price_per_unit is not none %}
                            <MiOverridePrice>{{ cents_to_dollars(modifier.price_per_unit) }}</MiOverridePrice>
                            {%- endif %}
                            <MiQuantity>1</MiQuantity>
                            <MiPriceLevel>0</MiPriceLevel>
                            {% set mod_definition_seq = modifier.menu_modifier.id.split('-')[1] %}
					        <MiDefinitionSeqNum>{{ mod_definition_seq }}</MiDefinitionSeqNum>
                        </SimphonyPosApi_MenuItemDefinitionEx>
                        {%- endfor %}
                    </Condiments>
                    {%- endif %}
                    <MenuItem>
                        {%- for item_discount in item.discounts %}
                        <ItemDiscount>
                            <SimphonyPosApi_DiscountEx>
                                <DiscAmountOrPercent>{{ get_micros_discount_price(item_discount) }}</DiscAmountOrPercent>
                                <DiscObjectNum>{{ item_discount.discount.id }}</DiscObjectNum>
                                {%- if item_discount.comment is not none %}
                                <DiscReference>{{ item_discount.comment }}</DiscReference>
                                {%- endif %}
                            </SimphonyPosApi_DiscountEx>
                        </ItemDiscount>
                        {%- endfor %}
                        {% set mi_obj_num = item.menu_item.id.split('-')[0] %}
                        <MiObjectNum>{{ mi_obj_num }}</MiObjectNum>
                        {%- if item.comment is not none %}
                        <MiReference>{{ item.comment }}</MiReference>
                        {%- endif %}
                        <MiWeight />
                        <MiMenuLevel>{{ item.main_level }}</MiMenuLevel>
                        <MiSubLevel>{{ item.sub_level }}</MiSubLevel>
                        {%- if item.price_per_unit is not none %}
                        <MiOverridePrice>{{ cents_to_dollars(item.price_per_unit) }}</MiOverridePrice>
                        {%- endif %}
                        <MiQuantity>1</MiQuantity>
                        <MiPriceLevel>0</MiPriceLevel>
                        {% set definition_seq = item.menu_item.id.split('-')[1] %}
                        <MiDefinitionSeqNum>{{ definition_seq }}</MiDefinitionSeqNum>
                    </MenuItem>
                </SimphonyPosApi_MenuItemEx>
                {%- endfor %}
                {%- endif %}
            </ppMenuItemsEx>
            <ppComboMealsEx>
                {%- for combo in combos %}
                {%- set combo_generated_item = combo.generated_item %}
                <SimphonyPosApi_ComboMealEx>
                    <ComboMealObjectNum>{{ combo.menu_combo.id }}</ComboMealObjectNum>
                    <ComboMealMenuItem>
                        <Condiments>
                            {%- for modifier in combo_generated_item.modifiers %}
                            <SimphonyPosApi_MenuItemDefinitionEx>
                                <ItemDiscount />
                                {% set mod_obj_num = modifier.menu_modifier.id.split('-')[0] %}
                                <MiObjectNum>{{ mod_obj_num }}</MiObjectNum>
                                {%- if modifier.comment is not none %}
                                <MiReference>{{ modifier.comment }}</MiReference>
                                {%- endif %}
                                <MiWeight />
                                <MiMenuLevel>{{ modifier.main_level }}</MiMenuLevel>
                                <MiSubLevel>{{ modifier.sub_level }}</MiSubLevel>
                                {%- if modifier.price_per_unit is not none %}
                                <MiOverridePrice>{{ cents_to_dollars(modifier.price_per_unit) }}</MiOverridePrice>
                                {%- endif %}
                                <MiQuantity>1</MiQuantity>
                                <MiPriceLevel>0</MiPriceLevel>
                                {% set mod_definition_seq = modifier.menu_modifier.id.split('-')[1] %}
                                <MiDefinitionSeqNum>{{ mod_definition_seq }}</MiDefinitionSeqNum>
                            </SimphonyPosApi_MenuItemDefinitionEx>
                            {%- endfor %}
                        </Condiments>
                        <MenuItem>
                            <ItemDiscount>
                                <SimphonyPosApi_DiscountEx>
                                    <DiscAmountOrPercent>{{ get_micros_discount_price(item_discount) }}</DiscAmountOrPercent>
                                    <DiscObjectNum>{{ item_discount.discount.id }}</DiscObjectNum>
                                    {%- if item_discount.comment is not none %}
                                    <DiscReference>{{ item_discount.comment }}</DiscReference>
                                    {%- endif %}
                                </SimphonyPosApi_DiscountEx>
                            </ItemDiscount>
                            {% set combo_generated_item_obj_num = combo_generated_item.menu_combo_item.menu_item.id.split('-')[0] %}
                            <MiObjectNum>{{ combo_generated_item_obj_num }}</MiObjectNum>
                            {%- if combo_generated_item.comment is not none %}
                            <MiReference>{{ combo_generated_item.comment }}</MiReference>
                            {%- endif %}
                            <MiWeight />
                            <MiMenuLevel>0</MiMenuLevel>
                            <MiSubLevel>0</MiSubLevel>
                            <MiQuantity>1</MiQuantity>
                            <MiPriceLevel>0</MiPriceLevel>
                            {% set definition_seq = item.menu_item.id.split('-')[1] %}
                            <MiDefinitionSeqNum>{{ definition_seq }}</MiDefinitionSeqNum>
                        </MenuItem>
                    </ComboMealMenuItem>
                    {%- set combo_main_item = combo.order_items[0] %}
                    <ComboMealMainItem>
                        <Condiments>
                            {%- for modifier in combo_main_item.modifiers %}
                            <SimphonyPosApi_MenuItemDefinitionEx>
                                <ItemDiscount />
                                {% set mod_obj_num = modifier.menu_modifier.id.split('-')[0] %}
                                <MiObjectNum>{{ mod_obj_num }}</MiObjectNum>
                                {%- if modifier.comment is not none %}
                                <MiReference>{{ modifier.comment }}</MiReference>
                                {%- endif %}
                                <MiWeight />
                                <MiMenuLevel>{{ modifier.main_level }}</MiMenuLevel>
                                <MiSubLevel>{{ modifier.sub_level }}</MiSubLevel>
                                {%- if modifier.price_per_unit is not none %}
                                <MiOverridePrice>{{ cents_to_dollars(modifier.price_per_unit) }}</MiOverridePrice>
                                {%- endif %}
                                <MiQuantity>1</MiQuantity>
                                <MiPriceLevel>0</MiPriceLevel>
                                {% set mod_definition_seq = modifier.menu_modifier.id.split('-')[1] %}
                                <MiDefinitionSeqNum>{{ mod_definition_seq }}</MiDefinitionSeqNum>
                            </SimphonyPosApi_MenuItemDefinitionEx>
                            {%- endfor %}
                        </Condiments>
                        <MenuItem>
                            <ItemDiscount>
                                <SimphonyPosApi_DiscountEx>
                                    <DiscObjectNum>0</DiscObjectNum>
                                </SimphonyPosApi_DiscountEx>
                            </ItemDiscount>
                            {% set combo_main_mi_obj_num = combo_main_item.menu_combo_item.id.split('-')[1] %}
                            <MiObjectNum>{{ combo_main_mi_obj_num }}</MiObjectNum>
                            {%- if combo_main_item.comment is not none %}
                            <MiReference>{{ combo_main_item.comment }}</MiReference>
                            {%- endif %}
                            <MiWeight />
                            <MiMenuLevel>{{ combo_main_item.main_level }}</MiMenuLevel>
                            <MiSubLevel>{{ combo_main_item.sub_level }}</MiSubLevel>
                            <MiPriveLevel>0</MiPriveLevel>
                        </MenuItem>
                    </ComboMealMainItem>
                    <SideItems>
                        {%- for item in combo.order_items[1:] %}
                        <SimphonyPosApi_MenuItemEx>
	                        <Condiments>
                                {%- for modifier in item.modifiers %}
                                <SimphonyPosApi_MenuItemDefinitionEx>
                                    <ItemDiscount />
                                    {% set mod_obj_num = modifier.menu_modifier.id.split('-')[0] %}
                                    <MiObjectNum>{{ mod_obj_num }}</MiObjectNum>
                                    {%- if modifier.comment is not none %}
                                    <MiReference>{{ modifier.comment }}</MiReference>
                                    {%- endif %}
                                    <MiWeight />
                                    <MiMenuLevel>{{ modifier.main_level }}</MiMenuLevel>
                                    <MiSubLevel>{{ modifier.sub_level }}</MiSubLevel>
                                    {%- if modifier.price_per_unit is not none %}
                                    <MiOverridePrice>{{ cents_to_dollars(modifier.price_per_unit) }}</MiOverridePrice>
                                    {%- endif %}
                                    <MiQuantity>1</MiQuantity>
                                    <MiPriceLevel>0</MiPriceLevel>
                                    {% set mod_definition_seq = modifier.menu_modifier.id.split('-')[1] %}
                                    <MiDefinitionSeqNum>{{ mod_definition_seq }}</MiDefinitionSeqNum>
                                </SimphonyPosApi_MenuItemDefinitionEx>
                                {%- endfor %}
                            </Condiments>
	                        <MenuItem>
                                <ItemDiscount>
                                    <SimphonyPosApi_DiscountEx>
                                        <DiscObjectNum>0</DiscObjectNum>
                                    </SimphonyPosApi_DiscountEx>
                                </ItemDiscount>
                                {% set mi_obj_num = item.menu_combo_item.id.split('-')[1] %}
                                <MiObjectNum>{{ mi_obj_num }}</MiObjectNum>
                                {%- if item.comment is not none %}
                                <MiReference>{{ item.comment }}</MiReference>
                                {%- endif %}
                                <MiWeight />
                                <MiMenuLevel>{{ item.main_level }}</MiMenuLevel>
                                <MiSubLevel>{{ item.sub_level }}</MiSubLevel>
                                <MiQuantity>1</MiQuantity>
                                <MiPriceLevel>0</MiPriceLevel>
                                {% set definition_seq = item.menu_item.id.split('-')[1] %}
                                <MiDefinitionSeqNum>{{ definition_seq }}</MiDefinitionSeqNum>
	                        </MenuItem>
	                    </SimphonyPosApi_MenuItemEx>
                        {%- endfor %}
                    </SideItems>
                </SimphonyPosApi_ComboMealEx>
                {%- endfor %}
            </ppComboMealsEx>
            {%- if service_charge is not none %}
            <pServiceChgEx>
                <SvcChgObjectNum>{{ service_charge.service_charge.id }}</SvcChgObjectNum>
                <SvcChgAmountOrPercent>{{ get_micros_service_charge_price(service_charge) }}</SvcChgAmountOrPercent>
                {%- if service_charge.comment is not none %}
                <SvcChgReference>{{ service_charge.comment }}</SvcChgReference>
                {%- endif %}
            </pServiceChgEx>
            {%- endif %}
            {%- if ticket_discount is not none %}
            <pSubTotalDiscountEx>
                <SimphonyPosApi_DiscountEx>
                    <DiscAmountOrPercent>{{ get_micros_discount_price(ticket_discount) }}</DiscAmountOrPercent>
                    <DiscObjectNum>{{ ticket_discount.discount.id }}</DiscObjectNum>
                    {%- if ticket_discount.comment is not none %}
                    <DiscReference>{{ ticket_discount.comment }}</DiscReference>
                    {%- endif %}
                </SimphonyPosApi_DiscountEx>
            </pSubTotalDiscountEx>
            {%- endif %}
            <revenueCenterObjectNum>{{ revenue_center }}</revenueCenterObjectNum>
            <orderType>{{ order_type }}</orderType>
            <employeeObjectNum>{{ employee_num }}</employeeObjectNum>
            <checkGuestcount>0</checkGuestcount>
        </CalculateTransactionTotalsEx>
    </soap:Body>
</soap:Envelope>