<?php

_e("<h1>Chi Tiết Hóa Đơn</h1>");
$ordersDetail = getOrdersDetails($orderID);
$order = getOrders($orderID);
foreach ($order as $info) {
    $user_info = get_userdata($info->userID);
    $total = get_total_from_db($info->ID);
    $infor_user = explode('-', $info->name);
    _e('Hóa đơn lập lúc: ' . date('h:i d-m-Y', $info->datetime) . "<br/>");
    _e('Khách hàng: <strong>' . $infor_user[0] . "</strong><br/>");
    _e('Email: <strong>' . $user_info->user_email . "</strong><br/>");
    _e('Điện Thoai: <strong>' . $infor_user[1] . "</strong><br/>");
    _e('Địa Chỉ: <strong>' . $infor_user[2] . "</strong>");
}
$num = 0;
?>
	<table id="insured_list" class="tablesorter center"> 
	<thead>
	  <tr class="center">
	    <th> STT </th>
	    <th> Tên Sản phẩm </th>
	    <th style="width: 150px;"> Đơn giá (VND)</th>
	    <th style="width: 100px;"> Giảm giá (%)</th>
	    <th style="width: 150px;"> Số lượng (cái)</th>
	    <th style="width: 150px;"> Thành tiền (VND) </th>
	  </tr>
	  </thead>
	  <tbody>
	  <?php 
foreach ($ordersDetail as $detail) {
</td>
	    <td><?php 
        _e($infor_user[1]);
        ?>
</td>
	    <td><?php 
        _e($infor_user[2]);
        ?>
</td>
	    <td style="text-align:center"><?php 
        _e(date('H:i d/m/Y', $order->datetime));
        ?>
</td>
	    <td style="text-align:right">
	     <?php 
        echo number_format(get_total_from_db($order->ID), 0);
        $md = md5($order->userID);
        ?>
		</td>
		<td>
			<?php 
        if ($order->status == 0) {
            echo 'Chưa giao';
        } else {
            if ($order->status == 1) {
                echo 'Đang giao';
            } else {
                echo 'Chuyển thành công';
            }
        }
        ?>