<?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>
        <CalculateTransactionTotals xmlns="http://micros-hosting.com/EGateway/">
            <vendorCode />
            <ppMenuItems>
                {%- if items is not none %}
                {%- for item in items %}
                <SimphonyPosApi_MenuItem>
                    {%- if item.modifiers %}
                    <Condiments>
                        {%- for modifier in item.modifiers %}
                        <SimphonyPosApi_MenuItemDefinition>
                            <ItemDiscount>
                                <DiscObjectNum>0</DiscObjectNum>
                            </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 %}
                        </SimphonyPosApi_MenuItemDefinition>
                        {%- endfor %}
                    </Condiments>
                    {%- endif %}
                    <MenuItem>
                        {%- for item_discount in item.discounts %}
                        <ItemDiscount>
                            <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 %}
                        </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>
                        <MiPriveLevel>0</MiPriveLevel>
                        {%- if item.price_per_unit is not none %}
                        <MiOverridePrice>{{ cents_to_dollars(item.price_per_unit) }}</MiOverridePrice>
                        {%- endif %}
                    </MenuItem>
                </SimphonyPosApi_MenuItem>
                {%- endfor %}
                {%- endif %}
            </ppMenuItems>
            <ppComboMeals>
                {%- for combo in combos %}
                {%- set combo_generated_item = combo.generated_item %}
                <SimphonyPosApi_ComboMeal>
                    <ComboMealObjectNum>{{ combo.menu_combo.id }}</ComboMealObjectNum>
                    <ComboMealMenuItem>
                        <Condiments>
                            {%- for modifier in combo_generated_item.modifiers %}
                            <SimphonyPosApi_MenuItemDefinition>
                                <ItemDiscount>
                                    <DiscObjectNum>0</DiscObjectNum>
                                </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 %}
                            </SimphonyPosApi_MenuItemDefinition>
                            {%- endfor %}
                        </Condiments>
                        <MenuItem>
                            <ItemDiscount>
                                <DiscObjectNum>0</DiscObjectNum>
                            </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>
                            <MiPriveLevel>0</MiPriveLevel>
                        </MenuItem>
                    </ComboMealMenuItem>
                    {%- set combo_main_item = combo.order_items[0] %}
                    <ComboMealMainItem>
                        <Condiments>
                            {%- for modifier in combo_main_item.modifiers %}
                            <SimphonyPosApi_MenuItemDefinition>
                                <ItemDiscount>
                                    <DiscObjectNum>0</DiscObjectNum>
                                </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 %}
                            </SimphonyPosApi_MenuItemDefinition>
                            {%- endfor %}
                        </Condiments>
                        <MenuItem>
                            <ItemDiscount>
                                <DiscObjectNum>0</DiscObjectNum>
                            </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_MenuItem>
	                        <Condiments>
                                {%- for modifier in item.modifiers %}
                                <SimphonyPosApi_MenuItemDefinition>
                                    <ItemDiscount>
                                        <DiscObjectNum>0</DiscObjectNum>
                                    </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 %}
                                </SimphonyPosApi_MenuItemDefinition>
                                {%- endfor %}
                            </Condiments>
	                        <MenuItem>
                                <ItemDiscount>
                                    <DiscObjectNum>0</DiscObjectNum>
                                </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>
                                <MiPriveLevel>0</MiPriveLevel>
	                        </MenuItem>
	                    </SimphonyPosApi_MenuItem>
                        {%- endfor %}
                    </SideItems>
                </SimphonyPosApi_ComboMeal>
                {%- endfor %}
            </ppComboMeals>
            {%- if service_charge is not none %}
            <pServiceChg>
                <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 %}
            </pServiceChg>
            {%- endif %}
            {%- if ticket_discount is not none %}
            <pSubtotalDiscount>
                <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 %}
            </pSubtotalDiscount>
            {%- endif %}
            <revenueCenter>{{ revenue_center }}</revenueCenter>
            <orderType>{{ order_type }}</orderType>
            <employeeNumber>{{ employee_num }}</employeeNumber>
        </CalculateTransactionTotals>
    </soap:Body>
</soap:Envelope>