<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php $_order = $this->getOrder() ?>
<?php
$orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
$orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
?>
<div class="box-left">
    <!--Order Information-->
    <div class="entry-edit">
        <?php if ($_order->getEmailSent()):
            $_email = Mage::helper('sales')->__('the order confirmation email was sent');
        else:
            $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
        endif; ?>
        <div class="entry-edit-head">
        <?php if ($this->getNoUseOrderLink()): ?>
            <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
        <?php else: ?>
            <a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
            <strong>(<?php echo $_email ?>)</strong>
        <?php endif; ?>
        </div>
        <div class="fieldset">
            <table cellspacing="0" class="form-list">
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
                <td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
            </tr>
            <?php if ($orderAdminDate != $orderStoreDate):?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
                <td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
            </tr>
            <?php endif;?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
                <td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
            </tr>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
                <td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
            </tr>
            <?php if($_order->getRelationChildId()): ?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the New Order') ?></label></td>
                <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
                    <?php echo $_order->getRelationChildRealId() ?>
                </a></td>
            </tr>
            <?php endif; ?>
            <?php if($_order->getRelationParentId()): ?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the Previous Order') ?></label></td>
                <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
                    <?php echo $_order->getRelationParentRealId() ?>
                </a></td>
            </tr>
            <?php endif; ?>
            <?php if($_order->getRemoteIp()): ?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
                <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $_order->getXForwardedFor() . ')':''; ?></strong></td>
            </tr>
            <?php endif; ?>
            <?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
                <td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
            </tr>
            <?php endif; ?>
            <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
            <tr>
                <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
                <td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
            </tr>
            <?php endif; ?>
            </table>
        </div>
    </div>
</div>
<div class="box-right">
    <!--Account Information-->
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
        </div>
        <div class="fieldset">
            <div class="hor-scroll">
                <table cellspacing="0" class="form-list">
                <tr>
                    <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
                    <td class="value">
                    <?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
                        <a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong></a>
                    <?php else: ?>
                        <strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong>
                    <?php endif; ?>
                    </td>
                </tr>
                <tr>
                    <td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
                    <td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
                </tr>
                <?php if ($_groupName = $this->getCustomerGroupName()) : ?>
                <tr>
                    <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
                    <td class="value"><strong><?php echo $_groupName ?></strong></td>
                </tr>
                <?php endif; ?>
                <?php foreach ($this->getCustomerAccountData() as $data):?>
                <tr>
                    <td class="label"><label><?php echo $data['label'] ?></label></td>
                    <td class="value"><strong><?php echo $data['value'] ?></strong></td>
                </tr>
                <?php endforeach;?>
                </table>
            </div>
        </div>
    </div>
</div>
<div class="clear"></div>

<div class="box-left">
    <!--Billing Address-->
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
        </div>
        <fieldset>
            <address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
        </fieldset>
    </div>
</div>
<?php if (!$this->getOrder()->getIsVirtual()): ?>
<div class="box-right">
    <!--Shipping Address-->
    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
        </div>
        <fieldset>
            <address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
        </fieldset>
    </div>
</div>
<div class="clear"></div>
<?php endif; ?>
