});
	</script>
</head>
<body <?php 
body_class();
?>
 id="sunshine">

<header id="sunshine-header">

	<div id="sunshine-logo">
		<h1><a href="<?php 
bloginfo('url');
?>
"><?php 
sunshine_logo();
?>
</a></h1>
	</div>

	<div id="sunshine-main-menu-container">
		<a href="#" id="sunshine-mobile-menu"><i class="fa fa-bars"></i> Menu</a>
		<?php 
sunshine_main_menu();
?>
	</div>
	
	<?php 
if ($sunshine->options['template_gallery_password_box']) {
    ?>
	<div id="sunshine-gallery-password-form">
function sunshine_invoice_display()
{
    if (!isset($_GET['page']) || $_GET['page'] != 'sunshine_invoice_display') {
        return;
    }
    if (!isset($_GET['order']) || !wp_verify_nonce($_GET['nonce'], 'sunshine_invoice')) {
        wp_die(__('Sorry, no order specified', 'sunshine'));
        exit;
    }
    $order_id = intval($_GET['order']);
    $order = get_post($order_id);
    $order_data = unserialize(get_post_meta($order_id, '_sunshine_order_data', true));
    $items = unserialize(get_post_meta($order_id, '_sunshine_order_items', true));
    ?>
<!DOCTYPE html>
<html>
<head>
	<title>Invoice for Order #<?php 
    echo $order_id;
    ?>
</title>
	<meta charset="UTF-8" />
	<style type="text/css">
		*
		{
			border: 0;
			box-sizing: content-box;
			color: inherit;
			font-family: inherit;
			font-size: inherit;
			font-style: inherit;
			font-weight: inherit;
			line-height: inherit;
			list-style: none;
			margin: 0;
			padding: 0;
			text-decoration: none;
			vertical-align: top;
		}

		/* content editable */

		/* heading */

		h1 { font: bold 100% sans-serif; letter-spacing: 0.5em; text-align: center; text-transform: uppercase; }

		/* table */

		table { font-size: 75%; table-layout: fixed; width: 100%; }
		th, td { border-bottom: 1px solid #DDD; padding: 0.5em; position: relative; text-align: left; }
		th { background: #EEE; }
		td { border-color: #DDD; }

		td td { border: none; }


		/* page */

		html { font: 16px/1 'Open Sans', sans-serif; overflow: auto; padding: 0.5in; }
		html { background: #999; cursor: default; }

		body { box-sizing: border-box; height: 11in; margin: 0 auto; /*overflow: hidden;*/ padding: 0.5in; width: 8.5in; }
		body { background: #FFF; border-radius: 1px; box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5); }

		/* header */

		header { margin: 0 0 3em; }
		header:after { clear: both; content: ""; display: table; }

		header { text-align: center; margin: 0 0 25px 0; }
		header h1 { background: #000; border-radius: 0.25em; color: #FFF; margin: 0 0 1em; padding: 0.5em 0; }
		header img { margin: 0 auto; height: auto; width: auto; max-height: 75px; }

		/* article */

		article, article address, table.meta, table.inventory { margin: 0 0 3em; }
		article:after { clear: both; content: ""; display: table; }
		article h1 { clip: rect(0 0 0 0); position: absolute; }

		article address { float: left; font-weight: bold; }

		/* table meta & balance */

		table.meta, table.balance { float: right; width: 36%; }
		table.meta:after, table.balance:after { clear: both; content: ""; display: table; }

		/* table meta */

		table.meta th { width: 40%; }
		table.meta td { width: 60%; }

		/* table items */

		table.inventory { clear: both; width: 100%; }
		table.inventory th { font-weight: bold; text-align: center; }

		table.inventory td { padding: 20px 0; }
		table.inventory td td { padding: 5px 0; }
		table.inventory td:nth-child(1) { width: 26%; }
		table.inventory td:nth-child(2) { width: 38%; }
		table.inventory td:nth-child(3) { text-align: right; width: 12%; }
		table.inventory td:nth-child(4) { text-align: right; width: 12%; }
		table.inventory td:nth-child(5) { text-align: right; width: 12%; }

		table.inventory td img { max-width: 100px; height: auto; }
		table.inventory td td img { max-width: 40px; height: auto; }
		/* table balance */

		table.balance th, table.balance td { width: 50%; white-space: nowrap;  }
		table.balance td { text-align: right;}

		/* aside */

		aside h1 { border: none; border-width: 0 0 1px; margin: 0 0 1em; }
		aside h1 { border-color: #999; border-bottom-style: solid; }


		@media print {
			* { -webkit-print-color-adjust: exact; }
			html { background: none; padding: 0; }
			body { box-shadow: none; margin: 0; }
			span:empty { display: none; }
			.add, .cut { display: none; }
		}

		@page { margin: 0; }
	</style>
</head>
<body>

	<header>
		<?php 
    sunshine_logo();
    ?>
	</header>
	<article>
		<h1><?php 
    _e('Recipient', 'sunshine');
    ?>
</h1>
		<address>
			<p>
				<?php 
    echo $order_data['first_name'] . ' ' . $order_data['last_name'] . '<br />' . $order_data['address'];
    if ($order_data['address2']) {
        echo '<br />' . $order_data['address2'];
    }
    echo '<br />' . $order_data['city'] . ', ' . $order_data['state'] . ' ' . $order_data['zip'] . '<br />' . $order_data['country'] . '<br />' . $order_data['email'] . '<br />' . $order_data['phone'];
    ?>
			</p>
		</address>
		<table class="meta" cellspacing="0" cellpadding="0">
			<tr>
				<th><span><?php 
    _e('Order #', 'sunshine');
    ?>
</span></th>
				<td><span><?php 
    echo $order_id;
    ?>
</span></td>
			</tr>
			<tr>
				<th><span><?php 
    _e('Date', 'sunshine');
    ?>
</span></th>
				<td><span><?php 
    echo get_the_date(get_option('date_format'), $order_id);
    ?>
</span></td>
			</tr>
			<tr>
				<th><span><?php 
    _e('Order Total', 'sunshine');
    ?>
</span></th>
				<td><span><?php 
    sunshine_money_format($order_data['total']);
    ?>
</span></td>
			</tr>
		</table>
		<table class="inventory">
			<thead>
				<tr>
					<th><span><?php 
    _e('Image', 'sunshine');
    ?>
</span></th>
					<th><span><?php 
    _e('Product', 'sunshine');
    ?>
</span></th>
					<th><span><?php 
    _e('Quantity', 'sunshine');
    ?>
</span></th>
					<th><span><?php 
    _e('Price', 'sunshine');
    ?>
</span></th>
					<th><span><?php 
    _e('Item Total', 'sunshine');
    ?>
</span></th>
				</tr>
			</thead>
			<tbody>
				<?php 
    $i = 1;
    foreach ($items as $item) {
        ?>
					<tr class="item">
						<td class="image">
							<?php 
        if ($item['image_id'] > 0) {
            $image = get_post($item['image_id']);
            $gallery = get_post($image->post_parent);
            if ($thumb = wp_get_attachment_image_src($item['image_id'], 'sunshine-thumbnail')) {
                $image_html = '<img src="' . $thumb[0] . '" alt="' . $item['image_name'] . '" width="100" />';
            } else {
                $image_html = '<img src="http://placehold.it/100&text=Image+deleted" alt="Image has been deleted" />';
            }
        }
        echo apply_filters('sunshine_cart_image_html', $image_html, $item, $thumb);
        ?>
						</td>
						<td class="name">
							<strong><?php 
        echo $item['product_name'];
        ?>
</strong><br />
							<div class="comments"><?php 
        echo apply_filters('sunshine_cart_item_comments', $item['comments'], $item);
        ?>
</div>
						</td>
						<td class="qty">
							<?php 
        echo $item['qty'];
        ?>
						</td>
						<td class="price">
							<?php 
        sunshine_money_format($item['price']);
        ?>
						</td>
						<td class="total">
							<?php 
        sunshine_money_format($item['total']);
        ?>
						</td>
					</tr>

				<?php 
        $i++;
    }
    ?>
			</tbody>
		</table>
		<table class="balance">
			<tr class="subtotal totals">
				<th colspan="4" align="right"><?php 
    _e('Subtotal', 'sunshine');
    ?>
</th>
				<td><?php 
    sunshine_money_format($order_data['subtotal']);
    ?>
</td>
			</tr>
			<tr class="tax totals">
				<th colspan="4" align="right"><?php 
    _e('Tax', 'sunshine');
    ?>
</th>
				<td><?php 
    sunshine_money_format($order_data['tax']);
    ?>
</td>
			</tr>
			<tr class="shipping totals">
				<th colspan="4" align="right"><?php 
    _e('Shipping', 'sunshine');
    ?>
 (<?php 
    echo $order_data['shipping_method'];
    ?>
)</th>
				<td>
					<?php 
    sunshine_money_format($order_data['shipping_cost']);
    ?>
				</td>
			</tr>
			<tr class="discounts totals">
				<th colspan="4" align="right">
					<?php 
    _e('Discounts', 'sunshine');
    ?>
					<?php 
    if (!empty($order_data['discount_items'])) {
        $discount_names = array();
        foreach ($order_data['discount_items'] as $discount_item) {
            $discount_names[] = $discount_item->name;
        }
        echo '<br />(' . join(', ', $discount_names) . ')';
    }
    ?>
				</th>
				<td>-<?php 
    sunshine_money_format($order_data['discount_total']);
    ?>
</td>
			</tr>
			<?php 
    if ($order_data['credits'] > 0) {
        ?>
			<tr class="credits totals">
				<th colspan="4" align="right"><?php 
        _e('Credits', 'sunshine');
        ?>
</th>
				<td>-<?php 
        sunshine_money_format($order_data['credits']);
        ?>
</td>
			</tr>
			<?php 
    }
    ?>

			<tr class="total totals">
				<th colspan="4" align="right"><?php 
    _e('Total', 'sunshine');
    ?>
</th>
				<td><?php 
    sunshine_money_format($order_data['total']);
    ?>
</td>
			</tr>
			<tr class="payment-method totals">
				<th colspan="4" align="right"><?php 
    _e('Payment Method', 'sunshine');
    ?>
</th>
				<td><?php 
    echo $order_data['payment_method'];
    ?>
</td>
			</tr>
		</table>
	</article>
</body>
</html>

<?php 
    exit;
}