<?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@magento.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.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * @deprecated  after 1.4.0.0-beta1
 */
?>
<?php $_order = $this->getOrder() ?>
<div class="page-title title-buttons">
    <h1><?php echo $this->__('My Orders - Details') ?></h1>
    <button class="button"><span><span><?php echo $this->__('Print All Invoices') ?></span></span></button>
</div>
<h3><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h3>
<?php foreach ($this->getInvoices() as $_invoice): ?>
<div class="page-title">
    <h3><?php echo $this->__('Invoice #%s', $_invoice->getIncrementId()) ?></h3>
    <a href="#" class="link-print"><?php echo $this->__('Print Invoice') ?></a>
</div>
<div class="col2-set">
    <div class="col-1">
        <h4><?php echo $this->__('Shipping Address') ?></h4>
        <?php $_shipping = $_invoice->getShippingAddress() ?>
        <address><?php echo $_shipping->getFirstname() ?> <?php echo $_shipping->getLastname() ?><br />
        <?php echo $_shipping->getCompany() ?><br />
        <?php echo $_shipping->getStreet() ?><br />
        <?php echo $_shipping->getCity() ?>, <?php echo $_shipping->getRegion() ?> <?php echo $_shipping->getPostcode() ?><br />
        <strong>T</strong> | <?php echo $_shipping->getTelephone();
        if($_shipping->getFax()): ?>
            <br /><strong>F</strong> | <?php echo $_shipping->getFax() ?>
        <?php endif; ?>
        </address>
    </div>
    <div class="col-2">
        <h4><?php echo $this->__('Billing Address') ?></h4>
        <?php $_billing = $_invoice->getbillingAddress() ?>
        <address><?php echo $_billing->getFirstname() ?> <?php echo $_billing->getLastname() ?><br />
        <?php echo $_billing->getCompany() ?><br />
        <?php echo $_billing->getStreet() ?><br />
        <?php echo $_billing->getCity() ?>, <?php echo $_billing->getRegion() ?> <?php echo $_billing->getPostcode() ?><br />
        <strong>T</strong> | <?php echo $_billing->getTelephone();
        if($_billing->getFax()): ?>
            <br /><strong>F</strong> | <?php echo $_billing->getFax() ?>
        <?php endif; ?>
        </address>
    </div>
</div>
<br />
<div class="col2-set">
    <div class="col-1">
        <h4><?php echo $this->__('Shipping Method') ?></h4>
        <?php echo $this->escapeHtml($_order->getShippingMethod()) ?> <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
    </div>
    <div class="col-2">
        <h4><?php echo $this->__('Payment Method') ?></h4>
        <?php $_payment = $_order->getPayment() ?>
        <?php echo $_payment->getMethod() ?>: <?php echo $_payment->getCcType() ?> xxxx<?php echo $_payment->getCcLast4() ?>
    </div>
</div>
<br />
<h4><?php echo $this->__('Items Ordered') ?></h4>
<table class="data-table">
    <thead>
        <tr>
            <th><?php echo $this->__('Product Name') ?></th>
            <th class="a-right" width="15%"><?php echo $this->__('Price') ?></th>
            <th class="a-center" width="10%"><?php echo $this->__('Qty Ordered') ?></th>
            <th class="a-center" width="10%"><?php echo $this->__('Qty Shipped') ?></th>
            <th class="a-right" width="20%"><?php echo $this->__('Subtotal') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php $_items = $_invoice->getItemsCollection(); ?>
        <?php $_count = $_items->count(); ?>
        <?php $_index = 0; ?>
        <?php foreach ($_items as $_item): ?>
        <tr<?php echo ($_index++ > $_count ? ' class="last"' : '') ?>>
            <td><?php echo $this->escapeHtml($_item->getProductName()) ?></td>
            <td class="a-right"><?php echo $_order->formatPrice($_item->getPrice()*1) ?></td>
            <td class="a-center"><?php echo $_item->getQty()*1 ?></td>
            <td class="a-center"><?php echo $_item->getQty()*1 ?></td>
            <td class="a-right"><?php echo $_order->formatPrice($_item->getRowTotal()*1) ?></td>
            <?php endforeach; ?>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="4" class="a-right"><?php echo $this->__('Order Subtotal') ?></td>
            <td class="a-right"><?php echo $_order->formatPrice($_invoice->getSubtotal()) ?></td>
        </tr>
    </tfoot>
</table>
<br />
<?php endforeach; ?>
