Files
sx-fc/app/views/transactions/sales/show.html.erb
2017-06-15 18:18:35 +06:30

253 lines
11 KiB
Plaintext

<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= transactions_sale_path(@sale.sale_id) %>"><%= @sale.sale_id %></a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10">
<!-- 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>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<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>
<td colspan="6">&nbsp;</td>
</tr>
<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("%d-%m-%Y") %> </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>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<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>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<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>
<% @sale_receivables.each do |r|%>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Payment <%= r.payment_method rescue ' '%></td>
<td colspan="2"><%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="booking" role="tabpanel">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<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">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<th width="20%"><h4>Customer Details</h4></th>
<th width="20%"></th>
<td></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Name</th>
<td><%= @customer.name %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Email</th>
<td><%= @customer.email %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Contact no</th>
<td><%= @customer.contact_no %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Company</th>
<td><%= @customer.company rescue '-' %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Date Of Birth</th>
<td><%= @customer.date_of_birth rescue '-' %> </td>
</tr>
<tr>
<th width="20%"><h4>Membership Details</h4></th>
<td width="20%"></td>
<td></td>
</tr>
<% if @membership == 0 %>
<tr>
<td colspan="2">"There is no membership data"</td>
</tr>
<% else %>
<% @membership.each do |member| %>
<tr>
<td width="20%"></td>
<th width="20%"><%= member["accountable_type"] %></th>
<td><%= member["balance"] %></td>
</tr>
<% end %>
<% end %>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<a href="<%= transactions_sales_path%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
<!-- Temporary No Needs -->
<a href="<%= transactions_void_path(@sale)%>" style="margin-top: 10px " class="btn btn-danger pull-right btn-lg">
<i class="fa fa-trash fa-lg"></i> Void Sale
</a>
<!-- <a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success pull-right btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale
</a> -->
</div>
</div>