<div class="container">
	<div style="border: 1px solid #ebebeb;border-radius: 6px;box-shadow: 0 2px 6px 0 rgba(0,0,0,.07); padding: 30px 40px; background-color: #ffff; margin-top: 50px;margin-left: auto; 
    margin-right: auto; border-bottom: 3px solid #ff8500;
	 ">
		<h4><i class="fa fa-list"></i> ประวัติการซื้อของคุณ</h4>
		<div class="table-responsive mt-5">
			<table id="datatable_user_random" class="table table-striped table-bordered" style="width:100%">
				<thead>
					<tr>
						<th><span>ลำดับ</span></th>
                        <th><span>สินค้า</span></th>
						<th><span>ดาวน์โหลด</span></th>
						<th><span>จำนวน</span></th>
						<th><span>รวม</span></th>
                        <th><span>ส่วนลด</span></th>
                        <th><span>เมื่อ</span></th>
					</tr>
				</thead>
				<?php 
                    $this->db->where('id_users', $this->session->userdata('id_users'));
					$this->db->order_by('id_log', 'desc');
					$query = $this->db->get('logbuyproduct',50);
					 ?>
				<tbody>
					<?php 
						$i=1;
						foreach($query->result_array() as $data)
						{ ?>
					<tr>
						<td><?php echo $i; ?></td>
                        <td><?php echo $data['product'] ?></td>
						<td> <a href="<?php echo base_url('order/order_'.$data['name'].'.txt') ?>" download>คลิกเพื่อดาวน์โหลด <i class="fa fa-file-text-o" aria-hidden="true"></i></a></td>
						<td> <?php echo $data['amount'] ?></td>
                        <td><?php echo $data['total'] ?></td>
                        <td><?php 
                        if($data['discount'] != null)
                        {
                            echo $data['discount'];
                        }else{
                            echo '-';
                        } ?></td>
						<td><?php echo $data['timestamp'] ?></td>
					</tr>
					<?php 
						$i++;
						} ?>
				</tbody>
			</table>
		</div>

	</div>
</div>