Merge branch 'staging' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-08-02 12:14:52 +06:30
11 changed files with 121 additions and 62 deletions

View File

@@ -37,6 +37,8 @@ class Ability
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
can :index, :credit_payment
can :index, :void_sale
can :get_customer, Customer
can :add_customer, Customer
@@ -113,6 +115,8 @@ class Ability
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
can :index, :credit_payment
can :index, :void_sale
elsif user.role == "supervisour"

View File

@@ -43,6 +43,8 @@
<li><%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %></li>
</ul>
</li>
<li class="navbar-nav mr-auto">

View File

@@ -132,6 +132,7 @@
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span></p>
</div>
@@ -143,7 +144,10 @@
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
<p>Customer : <%= @sale_array[0].customer.name rescue '' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<%end%>
@@ -302,10 +306,10 @@
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<% if @dining.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
@@ -316,6 +320,7 @@
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>

View File

@@ -26,9 +26,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -32,12 +32,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -132,6 +132,7 @@
<p> Receipt No: <span id="receipt_no">
<% if @status == 'sale' %>
<%= @obj.receipt_no rescue '' %>
<% end %>
</span></p>
</div>
@@ -139,12 +140,15 @@
<p>Date: <span id="receipt_date"><%= @obj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<%end%>
<% if @status == 'sale' %>
<p class="hidden customer-id"><%= @obj.customer_id rescue '' %></p>
<p>Customer : <%= @obj.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>
@@ -284,10 +288,10 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<% if @room.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status == 'order' && @status != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
@@ -297,6 +301,7 @@
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
<% else %>
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>

View File

@@ -120,9 +120,11 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<p>Customer : <%= @sale.customer.name rescue "-" %></p>
</div>
</div>

View File

@@ -26,9 +26,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -32,12 +32,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -44,8 +44,7 @@
<th>Grand Total</th>
<th>Rounding Adj.</th>
<th>Grand Total + <br/>Rounding Adj.</th>
<th>Sale Status</th>
<th>Remarks</th>
<!-- <th>Sale Status</th> -->
</tr>
</thead>
<tbody>
@@ -62,8 +61,8 @@
<td><%= item.grand_total.to_f rescue '-'%> </td>
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
<td><%= item.sales_status rescue '-' %> </td>
<td><%= item.remarks rescue '-' %> </td>
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
<!-- <td><%= item.remarks rescue '-' %> </td> -->
</tr>
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
<% grand_total = grand_total.to_f + item.grand_total.to_f %>

View File

@@ -1,39 +1,63 @@
<div class="container margin-top-20">
<div class="card row">
<% unless @sale_data.blank? %>
<table class="table table-striped" border="0">
<thead>
<% if !params[:from].blank?%>
<tr>
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
</tr>
<% end %>
<tr>
<th> Shift Name </th>
<th> Receive No</th>
<th> Cashier Name</th>
<th> Customer Name</th>
<th> Credit Amount </th>
</tr>
</thead>
<tbody>
<% @sale_data.each do |credit| %>
<tr>
<% if @shift_from.nil? && @shift_to.nil? %>
<td><%= credit.sale_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-'%></td>
<% else %>
<td><%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%></td>
<% end %>
<td><%= credit.receipt_no rescue '-' %></td>
<td><%= credit.cashier_name rescue '-' %></td>
<td><%= credit.sale.customer.name rescue '-' %></td>
<td><%= credit.payment_amount rescue '-' %></td>
</tr>
<% end %>
</tbody>
</table>
<% if @sale_data.count > 0 %>
<table class="table table-striped" border="0">
<thead>
<% if !params[:from].blank?%>
<tr>
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
</tr>
<% end %>
<% if @shift_from %>
<tr>
<% if @shift %>
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
<% end %>
<th colspan="3">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
</tr>
<% end %>
<tr>
<th>Receipt No</th>
<th>Sale Date</th>
<th>Total Amount</th>
<th>Grand Total</th>
<th>Rounding Adj.</th>
<th>Grand Total + <br/>Rounding Adj.</th>
<!-- <th>Sale Status</th> -->
</tr>
</thead>
<tbody>
<% total_amount = 0.0 %>
<% grand_total = 0.0 %>
<% rounding_adjustment = 0.0 %>
<% grand_rounding_adjustment = 0.0 %>
<% @sale_data.each do |result| %>
<% result[:items].each do |item| %>
<tr>
<td><%= item.receipt_no rescue '-' %> </td>
<td><%= item.date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
<td><%= item.total_amount.to_f rescue '-'%> </td>
<td><%= item.grand_total.to_f rescue '-'%> </td>
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
<!-- <td><%= item.remarks rescue '-' %> </td> -->
</tr>
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
<% end %>
<% end %>
<tr style="border-top:4px double #666;font-weight:600;">
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
<td><%= total_amount rescue '-' %></td>
<td><%= grand_total rescue '-' %></td>
<td><%= rounding_adjustment rescue '-'%></td>
<td colspan=""><%= grand_rounding_adjustment rescue '-'%></td>
</tr>
</tbody>
</table>
<% end %>
</div>
</div>