<div id="revStats">
    <table class="displayStatsHeader headerCurrent">
        <tr>
            <td colspan="6" class="physicalTableHeader">Current</td>
        </tr>
        <tr>
            <th>OH</th>
            <th>Open Orders</th>
            <th>ON PO</th>
            <th>Projected OH</th>
            <th>RIP</th>
        </tr>
        <tr class="subtext">
            <?php
                $currentColumns = array(
                    'OH',
                    array(
                        'unit' =>'OPEN_ORDERS_QTY',
                        'price'=>'OPEN_ORDERS_PRCE'
                    ),
                    'ON_PO',
                    'PROJECTED_OH',
                    'RETURNS'
                );
                foreach ($currentColumns as $sqlAlias) {
                ?>
                <td class="stats">
                    <?php
                    if (is_array($sqlAlias)) { ?>
                    <?php foreach ($sqlAlias as $class => $alias) { ?>
                            <div class="<?php echo $class ?>">
                                <?php echo $this->summary[$alias] ?>
                            </div>
                    <?php }
                    } else {
                        echo $this->summary[$sqlAlias];
                    }
                    ?>
                </td>
                <?php
                }
                ?>
        </tr>
    </table>
    <table class="displayStatsHeader headerHistory">
        <tr>
            <td colspan="6" class="physicalTableHeader">
                <div style="float: right; width: 13px;">
                    <a id="detailed_dates"><img src="/images/icons/question.png"></a>
                </div>
                Order history since: <?php echo $this->render('inventory/_period.phtml') ?>
            </td>
        </tr>
        <tr>
            <th>SHIP</th>
            <th>RTN</th>
            <th>NET</th>
            <th>RTN %</th>
        </tr>
        <tr class="subtext">
            <?php
            $historyColumns = array(
                array(
                    'unit' =>'SHIP_QTY',
                    'price'=>'SHIP_PRCE'),
                array(
                    'unit' =>'RTN_QTY',
                    'price'=>'RTN_PRCE'),
                array(
                    'unit' =>'NET',
                    'price'=>'NET_PRCE'),
                'RTN_PER');
            foreach ($historyColumns as $sqlAlias) {
            ?>
            <td class="stats">
                <?php
                if (is_array($sqlAlias)) { ?>
                <?php foreach ($sqlAlias as $class => $alias) { ?>
                        <div class="<?php echo $class ?>">
                            <?php echo $this->summary[$alias] ?>
                        </div>
                <?php }
                } else {
                    echo $this->summary[$sqlAlias];
                } ?>
            </td>
            <?php
            }
            ?>
        </tr>
    </table>
    <div class="clear"></div>
</div>
<script>
/** apply tooltips to page elements */
var art_title = $("#detailed_dates").attr('title');
$("#detailed_dates").tooltip({
    delay: 250,
    showURL: false,
    fixPNG: true,
    fade: 150,
    bodyHandler: function() {
        return "<div class='page_tooltips'>"+art_title+"</div>";
    }
});
</script>