<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
	<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
</head>
<body>
<div class="row">
	<div class="col-md-12">
		<div class="margin-top-20">
			<div class="card">
				<table class="table table-striped" border="0">
					<thead>
						<tr>
							<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>  - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%></th>
						</tr>
						<% if @shift_from %>
						<tr>
							<% if @shift_data.employee %>		
							<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
							<% end %>			
							<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> =  <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
						</tr>
						<% end %>	 

						<tr>
			                <th><%= t("views.right_panel.detail.req_date") %></th>
			                <th><%= t("views.right_panel.detail.req_no") %></th>
			                <th><%= t("views.right_panel.detail.req_amount") %></th>
			                <th><%= t("views.right_panel.detail.res_date") %></th>
			                <th><%= t("views.right_panel.detail.ref_no") %></th>
			                <th><%= t("views.right_panel.detail.res_amount") %></th>
			                <th><%= t("views.right_panel.detail.payment_type") %></th>
			                <th><%= t("views.right_panel.detail.Customer_name") %></th>
			                <th><%= t("views.right_panel.detail.Cashier_name") %></th>
			                <th><%= t("views.right_panel.detail.detail") %></th>
			            </tr>
					</thead>
					<tbody>
		              	<% if @cardSales != 0 %>
		                  	<% @cardSales.each do |cardSale| %>
		                    	<tr>
			                      	<td><%= cardSale.req_date %> <%= cardSale.req_time.utc.getlocal.strftime("%I:%M %p") %></td>
			                      	<td><%= cardSale.req_inv_no %></td>
			                      	<td><%= cardSale.req_amt %></td>
			                      	<td><%= cardSale.res_date %> <%= cardSale.res_time.utc.getlocal.strftime("%I:%M %p") %></td>
			                      	<td><%= cardSale.ref_no %></td>
			                      	<td><%= cardSale.res_amt %></td>
			                      	<td>
			                      		<% if cardSale.app == 'cup' %>
			                      			UnionPay
			                      		<% else %>
			                      			<%= cardSale.app %>
			                      		<% end %>		
			                      	</td>
			                      	<td><%= cardSale.sale.customer.name rescue '-' %></td>
			                      	<td><%= cardSale.sale.cashier_name rescue '-' %></td>
	                                <td>
	                                  <% if cardSale.terminal_id != ''  %>
	                                    TID : <%= cardSale.terminal_id %>
	                                    <br>
	                                  <% end %>
	                                  <% if cardSale.merchant_id != ''  %>  
	                                    MID : <%= cardSale.merchant_id %>
	                                    <br>
	                                  <% end %>
	                                  <% if cardSale.batch_no != ''  %>  
	                                    Batch : <%= cardSale.batch_no %>
	                                    <br>
	                                  <% end %>
	                                  <% if cardSale.trace != ''  %>   
	                                    Trace : <%= cardSale.trace %>
	                                  <% end %>  
	                                </td>                   
		                    	</tr>
		                  	<% end %>
		              	<% else %>
		                    <tr><td colspan="10"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
		             	<% end %>
		            </tbody>
		      	</table>
			</div>
		</div>
	</div>
</div>
</body>
</html>