Files
sx-fc/app/views/transactions/sales/show.html.erb

264 lines
11 KiB
Plaintext
Executable File

<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>">Home</a></li>
<li class="breadcrumb-item"><a href="<%= transactions_sales_path %>">Sales</a></li>
<li class="breadcrumb-item active">Details</li>
<span class="float-right">
<%= link_to 'Back', transactions_sales_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- Column One -->
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab">Sale Details </a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders Details</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#sale_audit" role="tab">Sale Audits</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px;">
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier_name rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th>Sale item name</th>
<th> Qty</th>
<th>Unit price</th>
<th>Total pirce </th>
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% @sale.sale_taxes.each do |r|%>
<tr>
<td colspan=2 style="text-align:center"></td>
<td><%= r.tax_name %> </td>
<td colspan="2"><%= number_with_precision(r.tax_payable_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% end %>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td colspan="5">&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Total Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<% @sale_receivables.each do |r|%>
<tr>
<td colspan=2 style="text-align:center"></td>
<td> <%= r.payment_method.capitalize rescue ' '%> Payment</td>
<td colspan="2"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
</td>
</tr>
<% end %>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="booking" role="tabpanel">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
<th>Created at </th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.order_id %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="customer" role="tabpanel">
<br>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Card No</th>
<th>Name</th>
<th>Company</th>
<th>Contact no</th>
<th>Email</th>
<th>NRC/Passport No</th>
<th>Address</th>
<th>DOB</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @customer.card_no rescue '-'%></td>
<td><%= @customer.name %></td>
<td><%= @customer.company rescue '-' %></td>
<td><%= @customer.contact_no %></td>
<td><%= @customer.email %></td>
<td><%= @customer.nrc_no %></td>
<td><%= @customer.address%></td>
<td><%= @customer.date_of_birth %></td>
</tr>
<tr></tr>
<tr>
<th colspan="5">Membership Transactions</th>
</tr>
<tr>
<th>Date</th>
<th>Redeem</th>
<th>Rebate</th>
<th>Balance</th>
<th>From Account</th>
<th>Status</th>
<th>Receipt No</th>
</tr>
<%
if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td>
<td><%= transaction["account_status"] %></td>
<td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="sale_audit" role="tabpanel">
<br>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Action </th>
<th>Action At</th>
<th>Approved At</th>
<th>Remark</th>
</tr>
</thead>
<tbody>
<% @sale_audits.each do |audit| %>
<tr>
<td><%= audit.action%></td>
<td><%= audit.action_at.strftime("%m-%d-%Y %H:%M %p")%></td>
<td><%= audit.approved_by.to_datetime.strftime("%m-%d-%Y %H:%M %p")%></td>
<td><%= audit.remark%></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>