<table class="editablepop" style="width: 100%;  margin-top:10px;">
    <thead>
        <tr>
            <th style="text-align:left;" colspan="12" class="ui-widget-header">
                {$i.controlpanel_offers_ordered}
            </th>
        </tr>
        {if $offers_ordered}
            <tr>
                <th>{$i.offers_management_offer_no}</th>
                <th>{$i.offers_management_title}</th>
                <th>{$i.offers_management_name}</th>
                <th>{$i.offers_management_staff_name}</th>
                <th>{$i.offers_management_status}</th>
                <th>{$i.controlpanel_is_calcexp}</th>
                <th>{$i.controlpanel_estimate}</th>
                <th>{$i.offers_management_address_name}</th>
                <th>{$i.offers_management_date}</th>
                <th>{$i.offers_management_valid_to_date}</th>
                <th>{$i.offers_management_order_date}</th>
                <th>{$i.offers_management_costs_sum}</th>
            </tr>
        {/if}
    </thead>
    {if $offers_ordered}
        <tbody>
            {foreach item=field name="index" from=$offers_ordered}
                <tr class="{if $smarty.foreach.index.iteration is even}even{/if}">
                    <td>{$field->offer_no}</td>
                    <td>{$field->title}</td>
                    <td>{$field->name|truncate:120:"..."}</td>
                    <td>{$field->staff_name}</td>
                    <td>{$field->status_name}</td>
                    <td>{boolview value=$field->is_calcexp}</td>
                    <td>{boolview value=$field->is_estimation}</td>
                    <td>{$field->address_name}</td>
                    <td>{$field->date->us_date()}</td>
                    <td>{$field->valid_to_date->us_date()}</td>
                    <td>{$field->order_date->us_date()}</td>
                    {$offers_sum_ordered = $offers_sum_ordered + $field->costs_sum}
                    <td style="text-align:right;" class="floatval">{isfloat value=$field->costs_sum maxf=2}</td>
                </tr>
            {/foreach}
        </tbody>
        <tfoot>
            <tr>
                <td colspan="11">{$i.basic_total}</td>
                <td style="text-align:right;" class="floatval">{isfloat value=$offers_sum_ordered maxf=2}</td>
            </tr>
        </tfoot>
    {/if}
</table>

<table class="editablepop" style="width: 100%;  margin-top:10px;">
    <thead>
        <tr>
            <th style="text-align:left;" colspan="12" class="ui-widget-header">
                {$i.controlpanel_offers_offered}
            </th>
        </tr>
        {if $offers_offered}
            <tr>
                <th>{$i.offers_management_offer_no}</th>
                <th>{$i.offers_management_title}</th>
                <th>{$i.offers_management_name}</th>
                <th>{$i.offers_management_staff_name}</th>
                <th>{$i.offers_management_status}</th>
                <th>{$i.controlpanel_is_calcexp}</th>
                <th>{$i.controlpanel_estimate}</th>
                <th>{$i.offers_management_address_name}</th>
                <th>{$i.offers_management_date}</th>
                <th>{$i.offers_management_valid_to_date}</th>
                <th>{$i.offers_management_order_date}</th>
                <th>{$i.offers_management_costs_sum}</th>
            </tr>
        {/if}
    </thead>
    {if $offers_offered}
        {$offers_sum_offered=0}
        <tbody>
            {foreach item=field name="index" from=$offers_offered}
                <tr class="{if $smarty.foreach.index.iteration is even}even{/if}">
                    <td>{$field->offer_no}</td>
                    <td>{$field->title}</td>
                    <td>{$field->name|truncate:120:"..."}}</td>
                    <td>{$field->staff_name}</td>
                    <td>{$field->status_name}</td>
                    <td>{boolview value=$field->is_calcexp}</td>
                    <td>{boolview value=$field->is_estimation}</td>
                    <td>{$field->address_name}</td>
                    <td>{$field->date->us_date()}</td>
                    <td>{$field->valid_to_date->us_date()}</td>
                    <td>{$field->order_date->us_date()}</td>
                    {$offers_sum_offered = $offers_sum_offered + $field->costs_sum}
                    <td style="text-align:right;" class="floatval">{isfloat value=$field->costs_sum maxf=2}</td>
                </tr>
            {/foreach}
        </tbody>
        <tfoot>
            <tr>
                <td colspan="11">{$i.basic_total}</td>
                <td style="text-align:right;" class="floatval">{isfloat value=$offers_sum_offered maxf=2}</td>
            </tr>
        </tfoot>
    {/if}
</table>