ruạṛ
<?php session_start(); require_once 'scripts-includes/universal.php'; require_once 'scripts-includes/display.php'; if(!$order_id = is_numeric_id($_GET['order'])) { getout('Invalid page ID','index.php'); exit; } $connID = connect_to_db(); if(!$order = mysql_query("select * from orders where order_id = '$order_id'")) { getout('Order not found','orders.php'); exit; } foreach(mysql_fetch_assoc($order) as $f => $v) { $$f = $v; } $products = mysql_query("select op.*, p.prod_id from order_products as op left join products as p on p.prod_id = op.product_id where op.order_id = '$order_id'"); head('orders','Manage Order'); if($customer_id) { $customer_name = '<a href="customer-manage.php?customer='.$customer_id.'">'.$customer_name.'</a>'; } ?> <h1>Manage order <?php echo $order_ref; ?></h1> <p class="right">| <a href="print-order.php?order=<?php echo $order_id; ?>">Print</a> <p>Placed: <?php echo date('j-m-Y',$order_ref); ?></p> <?php if($paid): ?> <p>Transaction reference: <?php echo $payment_ref; ?></p> <?php else: ?> <form action="processes/process-payment-manual.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="order_id" value="<?php echo $order_id; ?>" /> <p>Payment reference: <input type="text" name="payment_ref" size="20" value="<?php echo $payment_ref; ?>" /> <input type="submit" value="Mark as paid" /></p> </form> <?php endif; ?> <h2>Customer: <?php echo $customer_name; ?></h2> <p>- email: <a href="mailto:<?php echo $customer_email; ?>"><?php echo $customer_email; ?></a><br /> - phone: <?php echo $customer_phone; ?></p> <h2>Delivery</h2> <p><?php echo nl2br($delivery_address); ?></p> <p> </p> <p><?php echo nl2br($delivery_instructions); ?></p> <p> </p> <table class="control_panel" style="margin-left: 20px" > <thead> <tr> <th class="left">Product name</th> <th class="left">Options</th> <th>Price</th> <th>Quantity</th> <th>Total</th> </tr> </thead> <tfoot> <tr> <th colspan="4" class="right">Order total</th> <td class="right"><?php echo format_price($order_total-$discount_amount+$shipping_cost,2); ?></td> </tr> </tfoot> <tbody> <?php while($p=mysql_fetch_assoc($products)) { $pName = (is_null($p['prod_id'])) ? $p['product_name'] : '<a href="edit-product.php?prod='.$p['prod_id'].'">'.$p['product_name'].'</a>'; ?> <tr> <th class="left"><?php echo $pName; ?></th> <td class="left"> <?php $selected = json_decode($p[options]); foreach($selected as $o=>$opt){ if($opt != ''){ echo $o.': '.$opt.' <br /> '; } } ?> </td> <td class="right"><?php echo format_price($p['price'],2); ?></td> <td><?php echo $p['quantity']; ?></td> <td class="right"><?php echo format_price($p['price']*$p['quantity'],2); ?></td> </tr> <?php } ?> </tbody> <tbody> <tr> <th colspan="4" class="right">Subtotal</th> <td class="right"><?php echo format_price($order_total,2); ?></td> </tr> <?php if($discount_code !=''): ?> <tr> <th colspan="4" class="right">Discount code <?php echo $discount_code; ?> </th> <td class="right">-<?php echo format_price($discount_amount,2); ?></td> </tr> <?php endif; ?> <?php if($shipping_cost > 0): ?> <tr> <th colspan="4" class="right">Shipping (<?php echo $shipping_location; ?>)</th> <td class="right"><?php echo format_price($shipping_cost,2); ?></td> </tr> <?php endif; ?> <?php if($transaction_fee > 0): ?> <tr> <th colspan="4" class="right">Transaction Fee (<?php echo $payment_method; ?>)</th> <td class="right"><?php echo format_price($transaction_fee,2); ?></td> </tr> <?php endif; ?> </tbody> </table> <?php footer(); exit; ?>
cải xoăn