ruạṛ
<?php /** * Print order invoice * @version 0.9 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS * @todo this has fallen out of sync with /resources/template/section_order_print.php * particularly I note that this doesn't include discount codes * see if we can just pull in section_order_print */ $data_dir = $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/'; //$template_dir = $_SERVER['DOCUMENT_ROOT'].'/resources/template/'; require_once $data_dir.'universal.php'; //require_once $template_dir.'functions.php'; $connID = connect_to_db(); $order_id = is_numeric_id($_GET['order'],0); $order = new cart(); $order->recreate_from_order($order_id); ob_start(); ?> <?php echo '<!DOCTYPE html>'; ?> <html> <head> <title>Order <?php echo $order->reference; ?></title> <link rel="stylesheet" type="text/css" href="scripts-includes/print_preview.css" /> <link rel="stylesheet" type="text/css" href="scripts-includes/print_hide.css" media="print" /> </head> <body> <ul class="navigation"> <li><a href="<?php echo $_SERVER['HTTP_REFERER']; ?>" class="Back" >Back</a></li> <li><a href="" class="print" onclick="window.print()">Print</a></li> </ul> <div class="banner"><img src="images/logo.jpg" /></div> <?php if(!$order->reference): ?> <p>Order not found.</p> <?php else: ?> <div class="customer"> <p class="name"><?php echo $order->customer['name']; ?></p> <p class="address"><?php echo nl2br($order->customer['delivery_address']); ?></p> <p class="phone"><?php echo $order->customer['phone']; ?></p> <p class="email"><?php echo $order->customer['email']; ?></p> </div> <div class="store"> <p>[<?php echo SITE_FROM_NAME; ?> details pending]</p> </div> <div class="details"> <h1>Order <?php echo $order->reference; echo ($order->paid) ? ' [Paid]' : ''; ?></h1> <h2>Order details</h2> <p class="date">Order placed: <?php echo date('j-m-Y',$order->reference); ?></p> <table class="order"> <thead> <tr> <th class="name">Product name</th> <th class="options">Options</th> <th class="price">Price</th> <th class="quantity">Quantity</th> <th class="total">Total</th> </tr> </thead> <tfoot> <tr> <th colspan="4" class="name">Order total</th> <td class="total"><?php echo format_price($order->order_total(),2); ?></td> </tr> </tfoot> <tbody> <?php foreach($order->products as $k => $p) { ?> <tr> <th class="name"><?php echo $p->name; ?></th> <td class="options"> <?php foreach($p->options as $o=>$opt){ if($opt != ''){ echo ucwords(str_replace('_',' ',$o)).': '.$opt.' <br /> '; } } ?></td> <td class="price"><?php echo format_price($p->price,2); ?></td> <td class="quantity"><?php echo $p->quantity; ?></td> <td class="total"><?php echo format_price($p->price*$p->quantity,2); ?></td> </tr> <?php } ?> </tbody> <?php if($order->shipping_cost>0 || $order->transaction_fee > 0) { ?> <tbody> <tr> <th colspan="4" class="name">Subtotal</th> <td class="total"><?php echo format_price($order->cart_total,2); ?></td> </tr> <?php if($order->shipping_cost>0): ?> <tr> <th colspan="4" class="name">Shipping (<?php echo $order->shipping_location; ?>)</th> <td class="total"><?php echo format_price($order->shipping_cost,2); ?></td> </tr> <?php endif; ?> <?php if($order->transaction_fee>0): ?> <tr> <th colspan="4" class="name">Transaction fee (<?php echo $order->customer['payment_method']; ?>)</th> <td class="right"><?php echo format_price($order->transaction_fee,2); ?></td> </tr> <?php endif; ?> </tbody> <?php } ?> </table> <h2>Delivery instructions</h2> <p class="instructions"><?php echo nl2br($order->customer['delivery_instructions']); ?></p> </div> <?php endif; //product ?> </body> </html> <?php ob_end_flush(); exit; ?>
cải xoăn